{"id":18645226,"url":"https://github.com/danigb/pitch-parser","last_synced_at":"2025-07-08T02:41:34.261Z","repository":{"id":66458359,"uuid":"44080114","full_name":"danigb/pitch-parser","owner":"danigb","description":"Music pitch parser for javascript","archived":false,"fork":false,"pushed_at":"2015-10-17T16:47:14.000Z","size":152,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-17T18:08:26.284Z","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-10-12T02:40:20.000Z","updated_at":"2020-03-27T05:22:27.000Z","dependencies_parsed_at":"2023-02-20T20:45:13.481Z","dependency_job_id":null,"html_url":"https://github.com/danigb/pitch-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danigb/pitch-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fpitch-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fpitch-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fpitch-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fpitch-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danigb","download_url":"https://codeload.github.com/danigb/pitch-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fpitch-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264183316,"owners_count":23569685,"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:15:07.250Z","updated_at":"2025-07-08T02:41:34.242Z","avatar_url":"https://github.com/danigb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pitch-parser\n\n[![Build Status](https://travis-ci.org/danigb/pitch-parser.svg?branch=master)](https://travis-ci.org/danigb/pitch-parser)\n[![Code Climate](https://codeclimate.com/github/danigb/pitch-parser/badges/gpa.svg)](https://codeclimate.com/github/danigb/pitch-parser)\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://badge.fury.io/js/pitch-parser.svg)](https://badge.fury.io/js/pitch-parser)\n\nMusic pitch parser for javascript.\n\nGiven a pitch string it returns a [pitch array](https://github.com/danigb/a-pitch), and given a pitch array it returns a pitch string:\n\n```js\nvar pitch = require('pitch-parser')\npitch('C#4') // =\u003e [0, 2, 4]\npitch([0, 2, 4]) // =\u003e 'C#4'\npitch('Ebb3') // =\u003e [2, -2, 3]\npitch([2, -2, 3]) // =\u003e 'Ebb3'\npitch('A#') // =\u003e [5, 1, null]\npitch([5, 1, null]) // =\u003e 'A#'\n```\n\nThe returned value is an array of 3 integers with the following form `[letter, accidentals, octave]` where:\n\n- __letter__: a positive integer between 0 and 6 to represent C, D... to B\n- __accidentals__: is an integer to represent pitch accidentals. 0 means no accidentals, negatives values are for flats and positives for sharps\n- __octave__: (Optional) the octave number or null if not specified\n\n## API\n\n\u003c!-- START docme generated API please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN docme TO UPDATE --\u003e\n\n\u003cdiv\u003e\n\u003cdiv class=\"jsdoc-githubify\"\u003e\n\u003csection\u003e\n\u003carticle\u003e\n\u003cdiv class=\"container-overview\"\u003e\n\u003cdl class=\"details\"\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cdl\u003e\n\u003cdt\u003e\n\u003ch4 class=\"name\" id=\"pitch\"\u003e\u003cspan class=\"type-signature\"\u003e\u003c/span\u003epitch\u003cspan class=\"signature\"\u003e(val)\u003c/span\u003e\u003cspan class=\"type-signature\"\u003e \u0026rarr; {Array|String}\u003c/span\u003e\u003c/h4\u003e\n\u003c/dt\u003e\n\u003cdd\u003e\n\u003cdiv class=\"description\"\u003e\n\u003cp\u003eConverts pitches between strings and \u003ca href=\"https://github.com/danigb/a-pitch\"\u003earray notation\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eThis functions parses a string in the form \u003ccode\u003e'letter + accidentals [+ octave]'\u003c/code\u003e.\nThe letter can be upper or down case and the accidentals can be sharps \u003ccode\u003e#\u003c/code\u003e\nflats \u003ccode\u003eb\u003c/code\u003e or double sharps \u003ccode\u003ex\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe pitch array notation is 3 integers is in the form \u003ccode\u003e[letter, accidentals, octave]\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis function caches the result to get better performance. If for some\nreason you don't want to cache, use \u003ccode\u003epitch.parse\u003c/code\u003e and \u003ccode\u003epitch.build\u003c/code\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003ch5\u003eParameters:\u003c/h5\u003e\n\u003ctable class=\"params\"\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eName\u003c/th\u003e\n\u003cth\u003eType\u003c/th\u003e\n\u003cth class=\"last\"\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd class=\"name\"\u003e\u003ccode\u003eval\u003c/code\u003e\u003c/td\u003e\n\u003ctd class=\"type\"\u003e\n\u003cspan class=\"param-type\"\u003eString\u003c/span\u003e\n|\n\u003cspan class=\"param-type\"\u003eArray\u003c/span\u003e\n\u003c/td\u003e\n\u003ctd class=\"description last\"\u003e\u003cp\u003ethe pitch (can be a string or array)\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cdl class=\"details\"\u003e\n\u003cdt class=\"tag-source\"\u003eSource:\u003c/dt\u003e\n\u003cdd class=\"tag-source\"\u003e\u003cul class=\"dummy\"\u003e\n\u003cli\u003e\n\u003ca href=\"https://github.com/danigb/pitch-parser/blob/master/index.js\"\u003eindex.js\u003c/a\u003e\n\u003cspan\u003e, \u003c/span\u003e\n\u003ca href=\"https://github.com/danigb/pitch-parser/blob/master/index.js#L43\"\u003elineno 43\u003c/a\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\u003c/dd\u003e\n\u003c/dl\u003e\n\u003ch5\u003eReturns:\u003c/h5\u003e\n\u003cdiv class=\"param-desc\"\u003e\n\u003cp\u003ethe converted val (string if it was an array,\nand array if it was string)\u003c/p\u003e\n\u003c/div\u003e\n\u003cdl\u003e\n\u003cdt\u003e\nType\n\u003c/dt\u003e\n\u003cdd\u003e\n\u003cspan class=\"param-type\"\u003eArray\u003c/span\u003e\n|\n\u003cspan class=\"param-type\"\u003eString\u003c/span\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003ch5\u003eExamples\u003c/h5\u003e\n\u003cpre class=\"prettyprint\"\u003e\u003ccode\u003epitch('C4') // =\u003e [0, 0, 4]\npitch([0, 0, 4]) // =\u003e 'C4'\u003c/code\u003e\u003c/pre\u003e\n\u003cpre class=\"prettyprint\"\u003e\u003ccode\u003e // parse\npitch('c2') // =\u003e [0, 0, 2]\npitch('F#') // =\u003e [4, 1, null] (no octave)\u003c/code\u003e\u003c/pre\u003e\n\u003cpre class=\"prettyprint\"\u003e\u003ccode\u003e // build\npitch([2, -1, 3]) // =\u003e 'Eb3'\npitch([6, -2, null]) // =\u003e 'Bbb'\u003c/code\u003e\u003c/pre\u003e\n\u003cpre class=\"prettyprint\"\u003e\u003ccode\u003e // return scientific notation\npitch(pitch('cbb')) // =\u003e 'Cbb'\npitch(pitch('fx')) // =\u003e 'F##'\u003c/code\u003e\u003c/pre\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/article\u003e\n\u003c/section\u003e\n\u003c/div\u003e\n\n*generated with [docme](https://github.com/thlorenz/docme)*\n\u003c/div\u003e\n\u003c!-- END docme generated API please keep comment here to allow auto update --\u003e\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanigb%2Fpitch-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanigb%2Fpitch-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanigb%2Fpitch-parser/lists"}