{"id":18645180,"url":"https://github.com/danigb/tonal.note","last_synced_at":"2025-11-05T03:30:26.094Z","repository":{"id":66458417,"uuid":"46849960","full_name":"danigb/tonal.note","owner":"danigb","description":"Musical notes for javascript","archived":false,"fork":false,"pushed_at":"2015-11-25T09:09:13.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-27T11:34:44.727Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danigb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-25T09:07:17.000Z","updated_at":"2017-07-10T11:56:07.000Z","dependencies_parsed_at":"2023-02-20T20:00:25.168Z","dependency_job_id":null,"html_url":"https://github.com/danigb/tonal.note","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Ftonal.note","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Ftonal.note/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Ftonal.note/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Ftonal.note/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danigb","download_url":"https://codeload.github.com/danigb/tonal.note/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239449552,"owners_count":19640532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T06:14:57.612Z","updated_at":"2025-11-05T03:30:26.066Z","avatar_url":"https://github.com/danigb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tonal.note\n\n[![Build Status](https://travis-ci.org/danigb/tonal.svg?branch=master)](https://travis-ci.org/danigb/tonal.note)\n[![Code Climate](https://codeclimate.com/github/danigb/tonal.note/badges/gpa.svg)](https://codeclimate.com/github/danigb/tonal.note)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n[![npm version](https://img.shields.io/npm/v/tonal.note.svg)](https://www.npmjs.com/package/tonal.note)\n[![license](https://img.shields.io/npm/l/tonal.note.svg)](https://www.npmjs.com/package/tonal.note)\n[![tonal](https://img.shields.io/badge/lib-tonal-yellow.svg)](https://www.npmjs.com/package/tonal)\n\n\n`tonal.note` is collection of functions to manipulate notes:\n\n```js\nvar note = require('tonal.note')\ndistance('C3', '3m') // =\u003e 'Eb3'\n```\n\nIt's part of [tonal](https://www.npmjs.com/package/tonal)\n\n## Features\n\n- Midi and frequencies: `midi`, `freq`, `fromMidi`\n- Note properties: `pitchClass`, `setOctave`\n- Enharmonics: `enharmonics`\n- Transposition and distances: `transpose`, `distance`\n\n## Install\n\nOnly via npm: `npm i --save tonal.note`\n\n## Usage\n\nNotes in tonal are represented by strings, and by default it uses scientific notation with the form: `letter[accidentals][octave]/[duration]`.\n\nPitch classes are note names without octave and duration. They are used a lot to describe pitch sets like scales.\n\nThe `note` function returns a scientific notation of the given string or null if not valid string. It can be used to check if some string is a note:\n\n```js\n// get a note\nnote('c2') // =\u003e 'C2'\nnote('fx') // =\u003e 'F##'\nnote('blah') // =\u003e null\n// filter notes\n['e', 'f', 'g', 'h', 'i'].filter(note) // =\u003e ['e', 'f', 'g']\n```\n\n#### Note properties\n\nThere are several functions to get note properties or to modify them:\n\n```js\n// get properties\nnote.octave('C#4') // =\u003e 4\nnote.pitchClass('Bb5/4') // =\u003e 'Bb'\n\n// set properties\nnote.setOctave(3, 'Bb0') // =\u003e 'Bb3'\n```\n\n#### Midi and frequencies\n\nYou can transform to midi and frequencies:\n\n```js\nnote.midi('A4') // =\u003e 69\nnote.fromMidi(13) // =\u003e 'Bb0'\nnote.freq(null, 'A4') // =\u003e '440'\n```\n\n#### Enharmonics\n\nThe `note.enharmonics` function return the nearest enharmonics of a note:\n\n```js\nnote.enharmonics('C') // =\u003e ['B#', 'C', 'Dbb']\n```\n\n#### Note transposition\n\nYou can transpose notes with the `note.transpose` function. The order of the parameters doesn't matter:\n\n```js\ntranspose('C2', '4A') // =\u003e 'F#2'\ntranspose('4A', 'C2') // =\u003e 'F#2'\n```\n\nIf you transpose pitch classes (note names without octaves), the returned value will be a pitch class:\n\n```js\ntranpose('A', '3M') // =\u003e 'C#'\ntranpose('A5', '3M') // =\u003e 'C#5'\n```\n\nAlso, you can partially apply the function to get a __transposer__:\n\n```js\nvar major3th = transpose('3M')\nmajor3th('D') // =\u003e 'F#'\n```\n\nTransposers allows to work with arrays seamlessly:\n\n```js\n['C', 'D', 'E', 'F', 'G'].map(transpose('3M')) // =\u003e ['E', 'F#', 'G#', 'A', 'B']\n['1P', '3m', '5P'].map(transpose('C')) // =\u003e ['C', 'Eb', 'G']\n```\n\n#### Note distances\n\nThe `note.distance` function get the interval between two notes:\n\n```js\nnote.distance('C2', 'D2') // =\u003e '2M'\n```\n\n#### More...\n\nRead the [generated documentation](https://github.com/danigb/tonal.notes/blob/master/API.md)\nor take a look at [tonal](https://www.npmjs.com/package/tonal)\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanigb%2Ftonal.note","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanigb%2Ftonal.note","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanigb%2Ftonal.note/lists"}