{"id":15384466,"url":"https://github.com/danielgamage/pitch-utils","last_synced_at":"2026-02-14T11:04:18.089Z","repository":{"id":153271194,"uuid":"626221320","full_name":"danielgamage/pitch-utils","owner":"danielgamage","description":"Pitch, frequency conversion utilities","archived":false,"fork":false,"pushed_at":"2024-11-12T06:36:26.000Z","size":629,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T02:33:53.935Z","etag":null,"topics":["frequency","frequency-domain","library","music","pitch"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielgamage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-11T03:18:42.000Z","updated_at":"2024-11-12T06:33:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"32e8e2f2-e205-4734-8e69-bfade0d8ba4d","html_url":"https://github.com/danielgamage/pitch-utils","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"a9218db133ff68e56729818e4ae4fd632b9e4a93"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgamage%2Fpitch-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgamage%2Fpitch-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgamage%2Fpitch-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgamage%2Fpitch-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielgamage","download_url":"https://codeload.github.com/danielgamage/pitch-utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249157253,"owners_count":21221913,"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":["frequency","frequency-domain","library","music","pitch"],"created_at":"2024-10-01T14:42:05.657Z","updated_at":"2026-02-14T11:04:18.083Z","avatar_url":"https://github.com/danielgamage.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [pitch-utils](#pitch-utils)\n  - [Installation](#installation)\n  - [Usage](#usage)\n  - [Conversion Overview](#conversion-overview)\n  - [Classes](#classes)\n  - [Type Aliases](#type-aliases)\n    - [Cents](#cents)\n    - [Hz](#hz)\n    - [MIDINoteNumber](#midinotenumber)\n    - [NoteName](#notename)\n    - [NoteObject](#noteobject)\n    - [Octave](#octave)\n    - [Ratio](#ratio)\n    - [RoundingMethod](#roundingmethod)\n    - [Semitones](#semitones)\n  - [Variables](#variables)\n    - [A4](#a4)\n    - [blackNotesOnPiano](#blacknotesonpiano)\n    - [chromaticScale](#chromaticscale)\n    - [enharmonicChromaticScale](#enharmonicchromaticscale)\n    - [whiteNotesOnPiano](#whitenotesonpiano)\n  - [Functions](#functions)\n    - [centsToHz](#centstohz)\n    - [centsToMidi](#centstomidi)\n    - [centsToNoteName](#centstonotename)\n    - [centsToNoteObject](#centstonoteobject)\n    - [centsToRatio](#centstoratio)\n    - [centsToSemitones](#centstosemitones)\n    - [cleanNoteName](#cleannotename)\n    - [formatHz](#formathz)\n    - [getNoteIndexInOctave](#getnoteindexinoctave)\n    - [getRoundingFunction](#getroundingfunction)\n    - [hzToCents](#hztocents)\n    - [hzToMidi](#hztomidi)\n    - [hzToNoteName](#hztonotename)\n    - [hzToNoteObject](#hztonoteobject)\n    - [hzToRatio](#hztoratio)\n    - [hzToSemitones](#hztosemitones)\n    - [isNoteBlackOnPiano](#isnoteblackonpiano)\n    - [isNoteWhiteOnPiano](#isnotewhiteonpiano)\n    - [midiToCents](#miditocents)\n    - [midiToHz](#miditohz)\n    - [midiToNoteName](#miditonotename)\n    - [midiToNoteObject](#miditonoteobject)\n    - [midiToRatio](#miditoratio)\n    - [midiToSemitones](#miditosemitones)\n    - [namedNoteToCents](#namednotetocents)\n    - [namedNoteToHz](#namednotetohz)\n    - [namedNoteToMidi](#namednotetomidi)\n    - [namedNoteToNoteObject](#namednotetonoteobject)\n    - [namedNoteToRatio](#namednotetoratio)\n    - [namedNoteToSemitones](#namednotetosemitones)\n    - [quantizeHz](#quantizehz)\n    - [ratioToCents](#ratiotocents)\n    - [ratioToHz](#ratiotohz)\n    - [ratioToMidi](#ratiotomidi)\n    - [ratioToNoteName](#ratiotonotename)\n    - [ratioToNoteObject](#ratiotonoteobject)\n    - [ratioToSemitones](#ratiotosemitones)\n    - [semitonesToCents](#semitonestocents)\n    - [semitonesToHz](#semitonestohz)\n    - [semitonesToMidi](#semitonestomidi)\n    - [semitonesToNoteName](#semitonestonotename)\n    - [semitonesToNoteObject](#semitonestonoteobject)\n    - [semitonesToRatio](#semitonestoratio)\n    - [validateHz](#validatehz)\n- [Classes](#classes-1)\n  - [Class: Pitch](#class-pitch)\n    - [Constructors](#constructors)\n    - [Properties](#properties)\n    - [Accessors](#accessors)\n    - [Methods](#methods)\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\u003ca name=\"modulesmd\"\u003e\u003c/a\u003e\n\n# pitch-utils\n\nThis (ESM)  module provides a collection of functions for converting between pitch and frequency units.\n\n## Installation\n```bash\nnpm install pitch-utils\n```\n\n## Usage\n```js\nimport { hzToSemitones } from \"pitch-utils\";\nhzToSemitones(880, 440); // +12\n```\n\n## Conversion Overview\n|                  | → hz                  | → ratio                  | → semitones                  | → cents                  | → midi                   | → named                     | → note object                 |\n| :--------------- | :-------------------- | :----------------------- | :--------------------------- | :----------------------- | :----------------------- | :-------------------------- | :---------------------------- |\n| hz\u0026nbsp;→        | _N/A_                 | [hzToRatio](#hztoratio)        | [hzToSemitones](#hztosemitones)        | [hzToCents](#hztocents)        | [hzToMidi](#hztomidi)         | [hzToNoteName](#hztonotename)        | [hzToNoteObject](#hztonoteobject)        |\n| ratio\u0026nbsp;→     | [ratioToHz](#ratiotohz)     | _N/A_                    | [ratioToSemitones](#ratiotosemitones)     | [ratioToCents](#ratiotocents)     | [ratioToMidi](#ratiotomidi)      | [ratioToNoteName](#ratiotonotename)     | [ratioToNoteObject](#ratiotonoteobject)     |\n| semitones\u0026nbsp;→ | [semitonesToHz](#semitonestohz) | [semitonesToRatio](#semitonestoratio) | _N/A_                        | [semitonesToCents](#semitonestocents) | [semitonesToMidi](#semitonestomidi)  | [semitonesToNoteName](#semitonestonotename) | [semitonesToNoteObject](#semitonestonoteobject) |\n| cents\u0026nbsp;→     | [centsToHz](#centstohz)     | [centsToRatio](#centstoratio)     | [centsToSemitones](#centstosemitones)     | _N/A_                    | [centsToMidi](#centstomidi)      | [centsToNoteName](#centstonotename)     | [centsToNoteObject](#centstonoteobject)     |\n| midi\u0026nbsp;→      | [midiToHz](#miditohz)      | [midiToRatio](#miditoratio)      | [midiToSemitones](#miditosemitones)      | [midiToCents](#miditocents)      | _N/A_                    | [midiToNoteName](#miditonotename)      | [midiToNoteObject](#miditonoteobject)      |\n| named\u0026nbsp;→     | [namedNoteToHz](#namednotetohz) | [namedNoteToRatio](#namednotetoratio) | [namedNoteToSemitones](#namednotetosemitones) | [namedNoteToCents](#namednotetocents) | [namedNoteToMidi](#namednotetomidi)  | _N/A_                       | [namedNoteToNoteObject](#namednotetonoteobject) |\n\n## Classes\n\n- [Pitch](#classespitchmd)\n\n## Type Aliases\n\n### Cents\n\nƬ **Cents**: `number`\n\nA granular pitch offset unit, e.g. `+100`, `-200`, `0`.\nSupports positive and negative numbers.\n\n#### Defined in\n\n[src/index.ts:55](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L55)\n\n___\n\n### Hz\n\nƬ **Hz**: `number`\n\nA frequency unit reflecting the number of cycles per second, e.g. `440`, `523.2511`, or `1600` (1.6kHz).\nSupports positive numbers.\n\n#### Defined in\n\n[src/index.ts:61](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L61)\n\n___\n\n### MIDINoteNumber\n\nƬ **MIDINoteNumber**: `number`\n\nInteger representation of pitch in [0, 127], e.g. `12` (C0), `69` (A4), `127` (G9).\n\n#### Defined in\n\n[src/index.ts:71](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L71)\n\n___\n\n### NoteName\n\nƬ **NoteName**: `string`\n\nA note name with its octave, e.g. `C4`, `A♯3`, `F♯5`.\nAlso accepts lowercase and keyboard-accessible accidentals like `bb3` and `b#3`.\n\n#### Defined in\n\n[src/index.ts:37](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L37)\n\n___\n\n### NoteObject\n\nƬ **NoteObject**: `Object`\n\nObject with note properties for flexible formatting.\n\n#### Type declaration\n\n| Name | Type |\n| :------ | :------ |\n| `detune` | [`Cents`](#cents) |\n| `hz` | [`Hz`](#hz) |\n| `note` | [`NoteName`](#notename) |\n| `octave` | [`Octave`](#octave) |\n\n#### Defined in\n\n[src/index.ts:76](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L76)\n\n___\n\n### Octave\n\nƬ **Octave**: `number`\n\nInteger pitch grouping, e.g. `-1`, `4`, `10`.\n\n#### Defined in\n\n[src/index.ts:66](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L66)\n\n___\n\n### Ratio\n\nƬ **Ratio**: `number`\n\nA frequency ratio, e.g. `1.5`, `2`, `0.5`.\nSupports positive numbers.\n\n#### Defined in\n\n[src/index.ts:43](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L43)\n\n___\n\n### RoundingMethod\n\nƬ **RoundingMethod**: ``\"nearest\"`` \\| ``\"up\"`` \\| ``\"down\"``\n\nRounding method for converting between frequency units.\n\n**`Todo`**\n\nmaybe eventually this can include hz rounding in addition to pitch rounding\n\n#### Defined in\n\n[src/index.ts:87](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L87)\n\n___\n\n### Semitones\n\nƬ **Semitones**: `number`\n\nA semitone pitch offset, e.g. `+3`, `-5`, `0`.\nSupports positive and negative numbers.\n\n#### Defined in\n\n[src/index.ts:49](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L49)\n\n## Variables\n\n### A4\n\n• `Const` **A4**: ``440``\n\nA4 frequency in Hz\n\n#### Defined in\n\n[src/index.ts:96](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L96)\n\n___\n\n### blackNotesOnPiano\n\n• `Const` **blackNotesOnPiano**: `string`[]\n\n#### Defined in\n\n[src/index.ts:137](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L137)\n\n___\n\n### chromaticScale\n\n• `Const` **chromaticScale**: `string`[]\n\nNormalized note names in the chromatic scale, using sharps\n\n#### Defined in\n\n[src/index.ts:100](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L100)\n\n___\n\n### enharmonicChromaticScale\n\n• `Const` **enharmonicChromaticScale**: `string`[][]\n\nNote names with alternate enharmonic names\n\n#### Defined in\n\n[src/index.ts:117](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L117)\n\n___\n\n### whiteNotesOnPiano\n\n• `Const` **whiteNotesOnPiano**: `string`[]\n\n#### Defined in\n\n[src/index.ts:134](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L134)\n\n## Functions\n\n### centsToHz\n\n▸ **centsToHz**(`cents`, `baseHz?`): [`Hz`](#hz)\n\n**`Example`**\n\n```js\ncentsToHz(1200) // 880\n```\n\n#### Parameters\n\n| Name | Type | Default value |\n| :------ | :------ | :------ |\n| `cents` | `number` | `undefined` |\n| `baseHz` | `number` | `A4` |\n\n#### Returns\n\n[`Hz`](#hz)\n\n#### Defined in\n\n[src/index.ts:320](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L320)\n\n___\n\n### centsToMidi\n\n▸ **centsToMidi**(`cents`, `roundingMethod?`): [`MIDINoteNumber`](#midinotenumber)\n\n**`Example`**\n\n```js\ncentsToMidi(0) // 69\ncentsToMidi(1200) // 81\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `cents` | `number` |\n| `roundingMethod?` | [`RoundingMethod`](#roundingmethod) |\n\n#### Returns\n\n[`MIDINoteNumber`](#midinotenumber)\n\n#### Defined in\n\n[src/index.ts:330](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L330)\n\n___\n\n### centsToNoteName\n\n▸ **centsToNoteName**(`cents`): `string`\n\n**`Example`**\n\n```js\ncentsToNoteName(0) // \"A\"\ncentsToNoteName(1200) // \"A\"\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `cents` | `number` |\n\n#### Returns\n\n`string`\n\n#### Defined in\n\n[src/index.ts:340](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L340)\n\n___\n\n### centsToNoteObject\n\n▸ **centsToNoteObject**(`cents`): [`NoteObject`](#noteobject)\n\n**`Example`**\n\n```js\ncentsToNoteObject(0) // {note: \"A\", octave: 4, hz: 440, detune: 0}\ncentsToNoteObject(1200) // {note: \"A\", octave: 5, hz: 880, detune: 0}\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `cents` | `number` |\n\n#### Returns\n\n[`NoteObject`](#noteobject)\n\n#### Defined in\n\n[src/index.ts:349](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L349)\n\n___\n\n### centsToRatio\n\n▸ **centsToRatio**(`cents`): [`Ratio`](#ratio)\n\n**`Example`**\n\n```js\ncentsToRatio(1200) // 2\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `cents` | `number` |\n\n#### Returns\n\n[`Ratio`](#ratio)\n\n#### Defined in\n\n[src/index.ts:312](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L312)\n\n___\n\n### centsToSemitones\n\n▸ **centsToSemitones**(`cents`): [`Semitones`](#semitones)\n\n**`Example`**\n\n```js\ncentsToSemitones(100) // +1\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `cents` | `number` |\n\n#### Returns\n\n[`Semitones`](#semitones)\n\n#### Defined in\n\n[src/index.ts:304](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L304)\n\n___\n\n### cleanNoteName\n\n▸ **cleanNoteName**(`dirtyNote`): `string`\n\nReplaces keyboard-accessible accidentals with their unicode equivalents and makes note name uppercase.\n\n**`Example`**\n\n```js\ncleanNoteName(\"C#4\") // \"C♯4\"\ncleanNoteName(\"bb4\") // \"B♭4\"\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `dirtyNote` | `string` | dirty note name, with name, optional accidental, and octave |\n\n#### Returns\n\n`string`\n\n#### Defined in\n\n[src/index.ts:176](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L176)\n\n___\n\n### formatHz\n\n▸ **formatHz**(`hz`, `precision?`, `alwaysIncludeSign?`): `string`\n\nFormats a number in Hz to a string with kilohertz support\nAssumes tabular numeral usage, and includes trailing zeros for alignment.\n\n**`Example`**\n\n```js\nformatHz(232.5) // \"232.50Hz\"\nformatHz(2325) // \"2.33kHz\"\nformatHz(2325, 2, true) // \"+2.33kHz\"\n```\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :------ | :------ | :------ | :------ |\n| `hz` | `number` | `undefined` | - |\n| `precision` | `number` | `2` | - |\n| `alwaysIncludeSign` | `boolean` | `false` | whether to include (+) signs |\n\n#### Returns\n\n`string`\n\n#### Defined in\n\n[src/index.ts:220](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L220)\n\n___\n\n### getNoteIndexInOctave\n\n▸ **getNoteIndexInOctave**(`note`): `number`\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `note` | `string` |\n\n#### Returns\n\n`number`\n\n#### Defined in\n\n[src/index.ts:159](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L159)\n\n___\n\n### getRoundingFunction\n\n▸ **getRoundingFunction**(`roundingMethod`): (`x`: `number`) =\u003e `number`\n\nSelects a Math.* rounding function based on RoundingMethod union type\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `roundingMethod` | [`RoundingMethod`](#roundingmethod) |\n\n#### Returns\n\n`fn`\n\n▸ (`x`): `number`\n\nReturns a supplied numeric expression rounded to the nearest integer.\n\n##### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `x` | `number` | The value to be rounded to the nearest integer. |\n\n##### Returns\n\n`number`\n\n#### Defined in\n\n[src/index.ts:149](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L149)\n\n___\n\n### hzToCents\n\n▸ **hzToCents**(`targetHz`, `baseHz?`): [`Cents`](#cents)\n\nWhen a baseHz is provided, returns the difference in cents\n\n**`Example`**\n\n```js\nhzToCents(880, 440) // +1200\n```\n\n#### Parameters\n\n| Name | Type | Default value |\n| :------ | :------ | :------ |\n| `targetHz` | `number` | `undefined` |\n| `baseHz` | `number` | `A4` |\n\n#### Returns\n\n[`Cents`](#cents)\n\n#### Defined in\n\n[src/index.ts:638](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L638)\n\n___\n\n### hzToMidi\n\n▸ **hzToMidi**(`hz`, `roundingMethod?`): [`MIDINoteNumber`](#midinotenumber)\n\n**`Example`**\n\n```js\nhzToMidi(440) // 69\nhzToMidi(880) // 81\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `hz` | `number` |\n| `roundingMethod?` | [`RoundingMethod`](#roundingmethod) |\n\n#### Returns\n\n[`MIDINoteNumber`](#midinotenumber)\n\n#### Defined in\n\n[src/index.ts:650](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L650)\n\n___\n\n### hzToNoteName\n\n▸ **hzToNoteName**(`hz`, `roundingMethod?`): `string`\n\n**`Example`**\n\n```js\nhzToNoteName(260) // C\nhzToNoteName(260, Math.floor) // B\nhzToNoteName(263) // C\nhzToNoteName(263, Math.ceil) // C♯\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `hz` | `number` | frequency of note in hertz |\n| `roundingMethod?` | [`RoundingMethod`](#roundingmethod) | whether to round up, down, or naturally |\n\n#### Returns\n\n`string`\n\n#### Defined in\n\n[src/index.ts:566](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L566)\n\n___\n\n### hzToNoteObject\n\n▸ **hzToNoteObject**(`hz`): [`NoteObject`](#noteobject)\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `hz` | `number` | frequency of note in hertz |\n\n#### Returns\n\n[`NoteObject`](#noteobject)\n\n#### Defined in\n\n[src/index.ts:580](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L580)\n\n___\n\n### hzToRatio\n\n▸ **hzToRatio**(`targetHz`, `baseHz?`): [`Ratio`](#ratio)\n\n**`Example`**\n\n```js\nhzToRatio(880) // 2\nhzToRatio(440, 880) // 0.5\n```\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :------ | :------ | :------ | :------ |\n| `targetHz` | `number` | `undefined` | target frequency in hertz |\n| `baseHz` | `number` | `A4` | base frequency in hertz |\n\n#### Returns\n\n[`Ratio`](#ratio)\n\n#### Defined in\n\n[src/index.ts:604](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L604)\n\n___\n\n### hzToSemitones\n\n▸ **hzToSemitones**(`targetHz`, `baseHz?`): [`Semitones`](#semitones)\n\nWhen a baseHz is provided, returns the difference in semitones\n\n**`Example`**\n\n```js\nhzToSemitones(880, 440) // +12\n```\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :------ | :------ | :------ | :------ |\n| `targetHz` | `number` | `undefined` | target frequency in hertz |\n| `baseHz` | `number` | `A4` | base frequency in hertz |\n\n#### Returns\n\n[`Semitones`](#semitones)\n\n#### Defined in\n\n[src/index.ts:621](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L621)\n\n___\n\n### isNoteBlackOnPiano\n\n▸ **isNoteBlackOnPiano**(`note`): `boolean`\n\n**`Example`**\n\n```js\nisNoteBlackOnPiano(\"Cb4\") // false\nisNoteBlackOnPiano(\"A♯3\") // true\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `note` | `string` |\n\n#### Returns\n\n`boolean`\n\n#### Defined in\n\n[src/index.ts:440](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L440)\n\n___\n\n### isNoteWhiteOnPiano\n\n▸ **isNoteWhiteOnPiano**(`note`): `boolean`\n\n**`Example`**\n\n```js\nisNoteWhiteOnPiano(\"C4\") // true\nisNoteWhiteOnPiano(\"A♯3\") // false\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `note` | `string` |\n\n#### Returns\n\n`boolean`\n\n#### Defined in\n\n[src/index.ts:431](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L431)\n\n___\n\n### midiToCents\n\n▸ **midiToCents**(`midi`): [`Cents`](#cents)\n\n**`Example`**\n\n```js\nmidiToCents(69) // 0\nmidiToCents(81) // 1200\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `midi` | `number` |\n\n#### Returns\n\n[`Cents`](#cents)\n\n#### Defined in\n\n[src/index.ts:533](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L533)\n\n___\n\n### midiToHz\n\n▸ **midiToHz**(`midi`): [`Hz`](#hz)\n\n**`Example`**\n\n```js\nmidiToHz(69) // 440\nmidiToHz(60) // 261.62...\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `midi` | `number` |\n\n#### Returns\n\n[`Hz`](#hz)\n\n#### Defined in\n\n[src/index.ts:524](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L524)\n\n___\n\n### midiToNoteName\n\n▸ **midiToNoteName**(`midi`, `roundingMethod?`): `string`\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `midi` | `number` |\n| `roundingMethod?` | [`RoundingMethod`](#roundingmethod) |\n\n#### Returns\n\n`string`\n\n#### Defined in\n\n[src/index.ts:545](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L545)\n\n___\n\n### midiToNoteObject\n\n▸ **midiToNoteObject**(`midi`): [`NoteObject`](#noteobject)\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `midi` | `number` |\n\n#### Returns\n\n[`NoteObject`](#noteobject)\n\n#### Defined in\n\n[src/index.ts:551](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L551)\n\n___\n\n### midiToRatio\n\n▸ **midiToRatio**(`midi`): [`Ratio`](#ratio)\n\n**`Example`**\n\n```js\nmidiToRatio(81) // 2\nmidiToRatio(69) // 1\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `midi` | `number` |\n\n#### Returns\n\n[`Ratio`](#ratio)\n\n#### Defined in\n\n[src/index.ts:542](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L542)\n\n___\n\n### midiToSemitones\n\n▸ **midiToSemitones**(`midi`): [`Semitones`](#semitones)\n\n**`Example`**\n\n```js\nmidiToSemitones(69) // 0\nmidiToSemitones(81) // +12\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `midi` | `number` |\n\n#### Returns\n\n[`Semitones`](#semitones)\n\n#### Defined in\n\n[src/index.ts:515](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L515)\n\n___\n\n### namedNoteToCents\n\n▸ **namedNoteToCents**(`note`): [`Cents`](#cents)\n\n**`Example`**\n\n```js\nnamedNoteToCents(\"C4\") // -900\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `note` | `string` | note name, e.g. C4, A♯3, F♯5 |\n\n#### Returns\n\n[`Cents`](#cents)\n\n#### Defined in\n\n[src/index.ts:391](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L391)\n\n___\n\n### namedNoteToHz\n\n▸ **namedNoteToHz**(`note`): [`Hz`](#hz)\n\n**`Example`**\n\n```js\nnamedNoteToHz(\"C4\") // 261.6256\nnamedNoteToHz(\"A♯3\") // 233.0819\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `note` | `string` | note name, e.g. C4, A♯3, F♯5 |\n\n#### Returns\n\n[`Hz`](#hz)\n\n#### Defined in\n\n[src/index.ts:404](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L404)\n\n___\n\n### namedNoteToMidi\n\n▸ **namedNoteToMidi**(`note`): [`MIDINoteNumber`](#midinotenumber)\n\n**`Example`**\n\n```js\nnamedNoteToMidi(\"A4\") // 69\nnamedNoteToMidi(\"C4\") // 60\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `note` | `string` |\n\n#### Returns\n\n[`MIDINoteNumber`](#midinotenumber)\n\n#### Defined in\n\n[src/index.ts:417](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L417)\n\n___\n\n### namedNoteToNoteObject\n\n▸ **namedNoteToNoteObject**(`note`): [`NoteObject`](#noteobject)\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `note` | `string` |\n\n#### Returns\n\n[`NoteObject`](#noteobject)\n\n#### Defined in\n\n[src/index.ts:421](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L421)\n\n___\n\n### namedNoteToRatio\n\n▸ **namedNoteToRatio**(`note`, `baseNote?`): [`Ratio`](#ratio)\n\n**`Example`**\n\n```js\nnamedNoteToRatio(\"A4\") // 1\nnamedNoteToRatio(\"A♯3\") // 0.5\n```\n\n#### Parameters\n\n| Name | Type | Default value |\n| :------ | :------ | :------ |\n| `note` | `string` | `undefined` |\n| `baseNote` | `string` | `\"A4\"` |\n\n#### Returns\n\n[`Ratio`](#ratio)\n\n#### Defined in\n\n[src/index.ts:380](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L380)\n\n___\n\n### namedNoteToSemitones\n\n▸ **namedNoteToSemitones**(`note`): [`Semitones`](#semitones)\n\n**`Example`**\n\n```js\nnamedNoteToSemitones(\"C4\") // +3\nnamedNoteToSemitones(\"A♯3\") // -11\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `note` | `string` |\n\n#### Returns\n\n[`Semitones`](#semitones)\n\n#### Defined in\n\n[src/index.ts:362](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L362)\n\n___\n\n### quantizeHz\n\n▸ **quantizeHz**(`hz`, `roundingMethod?`): [`Hz`](#hz)\n\n**`Example`**\n\n```js\nquantizeHz(450) // 440\nquantizeHz(450, \"down\") // 440\nquantizeHz(450, \"up\") // ~466.17\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `hz` | `number` |\n| `roundingMethod?` | [`RoundingMethod`](#roundingmethod) |\n\n#### Returns\n\n[`Hz`](#hz)\n\n#### Defined in\n\n[src/index.ts:662](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L662)\n\n___\n\n### ratioToCents\n\n▸ **ratioToCents**(`ratio`): [`Cents`](#cents)\n\n**`Example`**\n\n```js\nratioToCents(2) // 1200\nratioToCents(3) // 1902\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `ratio` | `number` | decimal or fractional ratio |\n\n#### Returns\n\n[`Cents`](#cents)\n\n#### Defined in\n\n[src/index.ts:481](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L481)\n\n___\n\n### ratioToHz\n\n▸ **ratioToHz**(`ratio`, `baseHz?`): [`Hz`](#hz)\n\n**`Example`**\n\n```js\nratioToHz(2) // 880\nratioToHz(3) // 1320\n```\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :------ | :------ | :------ | :------ |\n| `ratio` | `number` | `undefined` | decimal or fractional ratio |\n| `baseHz` | `number` | `A4` | optional base note |\n\n#### Returns\n\n[`Hz`](#hz)\n\n#### Defined in\n\n[src/index.ts:465](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L465)\n\n___\n\n### ratioToMidi\n\n▸ **ratioToMidi**(`ratio`, `roundingMethod?`): [`MIDINoteNumber`](#midinotenumber)\n\n**`Example`**\n\n```js\nratioToMidi(1) // 69\nratioToMidi(2) // 81\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `ratio` | `number` |\n| `roundingMethod?` | [`RoundingMethod`](#roundingmethod) |\n\n#### Returns\n\n[`MIDINoteNumber`](#midinotenumber)\n\n#### Defined in\n\n[src/index.ts:501](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L501)\n\n___\n\n### ratioToNoteName\n\n▸ **ratioToNoteName**(`ratio`): `string`\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `ratio` | `number` |\n\n#### Returns\n\n`string`\n\n#### Defined in\n\n[src/index.ts:488](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L488)\n\n___\n\n### ratioToNoteObject\n\n▸ **ratioToNoteObject**(`ratio`): [`NoteObject`](#noteobject)\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `ratio` | `number` |\n\n#### Returns\n\n[`NoteObject`](#noteobject)\n\n#### Defined in\n\n[src/index.ts:491](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L491)\n\n___\n\n### ratioToSemitones\n\n▸ **ratioToSemitones**(`ratio`): [`Semitones`](#semitones)\n\n**`Example`**\n\n```js\nratioToSemitones(2) // 12\nratioToSemitones(3) // ~19.02\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `ratio` | `number` | decimal or fractional ratio |\n\n#### Returns\n\n[`Semitones`](#semitones)\n\n#### Defined in\n\n[src/index.ts:452](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L452)\n\n___\n\n### semitonesToCents\n\n▸ **semitonesToCents**(`semitones`): [`Cents`](#cents)\n\n**`Example`**\n\n```js\nsemitonesToCents(-12) // -1200\nsemitonesToCents(0.5) // 50\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `semitones` | `number` | semitone offset |\n\n#### Returns\n\n[`Cents`](#cents)\n\n#### Defined in\n\n[src/index.ts:259](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L259)\n\n___\n\n### semitonesToHz\n\n▸ **semitonesToHz**(`semitones`, `baseHz?`): [`Hz`](#hz)\n\n**`Example`**\n\n```js\nsemitonesToHz(3) // 523.2511\nsemitonesToHz(-3, 523.2511) // 440\n```\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :------ | :------ | :------ | :------ |\n| `semitones` | `number` | `undefined` | semitone offset |\n| `baseHz` | `number` | `A4` | optional base note |\n\n#### Returns\n\n[`Hz`](#hz)\n\n#### Defined in\n\n[src/index.ts:244](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L244)\n\n___\n\n### semitonesToMidi\n\n▸ **semitonesToMidi**(`semitones`, `roundingMethod?`): [`MIDINoteNumber`](#midinotenumber)\n\nReturns a MIDI note number relative to A4 (69).\n\n**`Example`**\n\n```js\nsemitonesToMidi(0) // 69\nsemitonesToMidi(12) // 81\n```\n\n#### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `semitones` | `number` |\n| `roundingMethod?` | [`RoundingMethod`](#roundingmethod) |\n\n#### Returns\n\n[`MIDINoteNumber`](#midinotenumber)\n\n#### Defined in\n\n[src/index.ts:285](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L285)\n\n___\n\n### semitonesToNoteName\n\n▸ **semitonesToNoteName**(`semitones`, `baseHz?`): `string`\n\n#### Parameters\n\n| Name | Type | Default value |\n| :------ | :------ | :------ |\n| `semitones` | `number` | `undefined` |\n| `baseHz` | `number` | `A4` |\n\n#### Returns\n\n`string`\n\n#### Defined in\n\n[src/index.ts:289](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L289)\n\n___\n\n### semitonesToNoteObject\n\n▸ **semitonesToNoteObject**(`semitones`, `baseHz?`): [`NoteObject`](#noteobject)\n\n#### Parameters\n\n| Name | Type | Default value |\n| :------ | :------ | :------ |\n| `semitones` | `number` | `undefined` |\n| `baseHz` | `number` | `A4` |\n\n#### Returns\n\n[`NoteObject`](#noteobject)\n\n#### Defined in\n\n[src/index.ts:292](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L292)\n\n___\n\n### semitonesToRatio\n\n▸ **semitonesToRatio**(`semitones`): [`Ratio`](#ratio)\n\n**`Example`**\n\n```js\nsemitonesToRatio(12) // 2\nsemitonesToRatio(-12) // 0.5\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `semitones` | `number` | semitone offset |\n\n#### Returns\n\n[`Ratio`](#ratio)\n\n#### Defined in\n\n[src/index.ts:271](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L271)\n\n___\n\n### validateHz\n\n▸ **validateHz**(`hz`): asserts hz is number\n\nValidates that a frequency value is a positive, non-zero number.\nThrows an error if the value is zero, negative, or not a number.\n\n**`Example`**\n\n```js\nvalidateHz(440) // passes\nvalidateHz(0) // throws error\nvalidateHz(-220) // throws error\nvalidateHz(NaN) // throws error\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `hz` | `number` | The frequency in Hz to validate |\n\n#### Returns\n\nasserts hz is number\n\n#### Defined in\n\n[src/index.ts:205](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L205)\n\n\n# Classes\n\n\n\u003ca name=\"classespitchmd\"\u003e\u003c/a\u003e\n\n## Class: Pitch\n\n**`Example`**\n\n```js\nconst note = new Pitch(440)\nnote.noteObject.note // \"A4\"\nnote.modRatio(3/1)\nnote.noteObject.note // \"E6\"\n```\n\n### Constructors\n\n#### constructor\n\n• **new Pitch**(`frequency?`)\n\n##### Parameters\n\n| Name | Type | Default value | Description |\n| :------ | :------ | :------ | :------ |\n| `frequency` | `number` | `A4` | frequency of note in hertz |\n\n##### Defined in\n\n[src/index.ts:685](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L685)\n\n### Properties\n\n#### detune\n\n• **detune**: (`cents`: `number`) =\u003e [`Pitch`](#classespitchmd)\n\n##### Type declaration\n\n▸ (`cents`): [`Pitch`](#classespitchmd)\n\ndetunes the pitch by a number of cents\n\n###### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `cents` | `number` |\n\n###### Returns\n\n[`Pitch`](#classespitchmd)\n\n##### Defined in\n\n[src/index.ts:763](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L763)\n\n___\n\n#### frequency\n\n• **frequency**: `number` = `A4`\n\nfrequency of note in hertz\n\n##### Defined in\n\n[src/index.ts:687](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L687)\n\n___\n\n#### hz\n\n• **hz**: `number`\n\nbase value for calculations\n\n##### Defined in\n\n[src/index.ts:684](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L684)\n\n___\n\n#### transpose\n\n• **transpose**: (`semitones`: `number`) =\u003e [`Pitch`](#classespitchmd)\n\n##### Type declaration\n\n▸ (`semitones`): [`Pitch`](#classespitchmd)\n\ntransposes the current pitch by a number of semitones\n\n###### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `semitones` | `number` |\n\n###### Returns\n\n[`Pitch`](#classespitchmd)\n\n##### Defined in\n\n[src/index.ts:750](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L750)\n\n### Accessors\n\n#### closestNoteAbove\n\n• `get` **closestNoteAbove**(): [`NoteObject`](#noteobject)\n\nreturns the nearest note above\n\n##### Returns\n\n[`NoteObject`](#noteobject)\n\n##### Defined in\n\n[src/index.ts:733](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L733)\n\n___\n\n#### closestNoteBelow\n\n• `get` **closestNoteBelow**(): [`NoteObject`](#noteobject)\n\nreturns the nearest note below\n\n##### Returns\n\n[`NoteObject`](#noteobject)\n\n##### Defined in\n\n[src/index.ts:727](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L727)\n\n___\n\n#### midi\n\n• `get` **midi**(): `number`\n\n**`Example`**\n\n```ts\nfor A4, `69`\n```\n\n##### Returns\n\n`number`\n\n##### Defined in\n\n[src/index.ts:710](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L710)\n\n___\n\n#### noteName\n\n• `get` **noteName**(): `string`\n\n**`Example`**\n\n```ts\nfor A4, `\"A\"`\n```\n\n##### Returns\n\n`string`\n\n##### Defined in\n\n[src/index.ts:722](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L722)\n\n___\n\n#### noteObject\n\n• `get` **noteObject**(): [`NoteObject`](#noteobject)\n\n##### Returns\n\n[`NoteObject`](#noteobject)\n\n##### Defined in\n\n[src/index.ts:714](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L714)\n\n___\n\n#### octave\n\n• `get` **octave**(): `number`\n\n**`Example`**\n\n```ts\nfor A4, `4`\n```\n\n##### Returns\n\n`number`\n\n##### Defined in\n\n[src/index.ts:718](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L718)\n\n### Methods\n\n#### addCents\n\n▸ **addCents**(`cents`): [`Pitch`](#classespitchmd)\n\ndetunes the pitch by a number of cents\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `cents` | `number` |\n\n##### Returns\n\n[`Pitch`](#classespitchmd)\n\n##### Defined in\n\n[src/index.ts:759](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L759)\n\n___\n\n#### addSemitones\n\n▸ **addSemitones**(`semitones`): [`Pitch`](#classespitchmd)\n\ntransposes the current pitch by a number of semitones\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `semitones` | `number` |\n\n##### Returns\n\n[`Pitch`](#classespitchmd)\n\n##### Defined in\n\n[src/index.ts:746](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L746)\n\n___\n\n#### centsFrom\n\n▸ **centsFrom**(`other`): `number`\n\ncentsFrom, centsTo\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `other` | `number` \\| [`Pitch`](#classespitchmd) |\n\n##### Returns\n\n`number`\n\n##### Defined in\n\n[src/index.ts:781](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L781)\n\n___\n\n#### centsTo\n\n▸ **centsTo**(`other`): `number`\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `other` | `number` \\| [`Pitch`](#classespitchmd) |\n\n##### Returns\n\n`number`\n\n##### Defined in\n\n[src/index.ts:785](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L785)\n\n___\n\n#### modRatio\n\n▸ **modRatio**(`ratio`): [`Pitch`](#classespitchmd)\n\nmodulates the pitch by a ratio\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `ratio` | `number` |\n\n##### Returns\n\n[`Pitch`](#classespitchmd)\n\n##### Defined in\n\n[src/index.ts:766](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L766)\n\n___\n\n#### quantize\n\n▸ **quantize**(`roundingMethod?`): [`Pitch`](#classespitchmd)\n\nsnaps the pitch to the nearest semitone\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `roundingMethod?` | [`RoundingMethod`](#roundingmethod) |\n\n##### Returns\n\n[`Pitch`](#classespitchmd)\n\n##### Defined in\n\n[src/index.ts:740](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L740)\n\n___\n\n#### ratioFrom\n\n▸ **ratioFrom**(`other`): `number`\n\nratioFrom, ratioTo\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `other` | `number` \\| [`Pitch`](#classespitchmd) |\n\n##### Returns\n\n`number`\n\n##### Defined in\n\n[src/index.ts:790](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L790)\n\n___\n\n#### ratioTo\n\n▸ **ratioTo**(`other`): `number`\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `other` | `number` \\| [`Pitch`](#classespitchmd) |\n\n##### Returns\n\n`number`\n\n##### Defined in\n\n[src/index.ts:794](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L794)\n\n___\n\n#### semitonesFrom\n\n▸ **semitonesFrom**(`other`): `number`\n\nsemitonesFrom, semitonesTo\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `other` | `number` \\| [`Pitch`](#classespitchmd) |\n\n##### Returns\n\n`number`\n\n##### Defined in\n\n[src/index.ts:772](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L772)\n\n___\n\n#### semitonesTo\n\n▸ **semitonesTo**(`other`): `number`\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `other` | `number` \\| [`Pitch`](#classespitchmd) |\n\n##### Returns\n\n`number`\n\n##### Defined in\n\n[src/index.ts:776](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L776)\n\n___\n\n#### shift\n\n▸ **shift**(`hz`): [`Pitch`](#classespitchmd)\n\nshifts the pitch by a number of hertz\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `hz` | `number` |\n\n##### Returns\n\n[`Pitch`](#classespitchmd)\n\n##### Defined in\n\n[src/index.ts:753](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L753)\n\n___\n\n#### fromMidi\n\n▸ `Static` **fromMidi**(`midi`): [`Pitch`](#classespitchmd)\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `midi` | `number` |\n\n##### Returns\n\n[`Pitch`](#classespitchmd)\n\n##### Defined in\n\n[src/index.ts:703](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L703)\n\n___\n\n#### fromNamedNote\n\n▸ `Static` **fromNamedNote**(`note`): [`Pitch`](#classespitchmd)\n\ninitialize from NamedNote\n\n**`Example`**\n\n```js\nPitch.fromNamedNote(\"A3\").hz // 220\n```\n\n##### Parameters\n\n| Name | Type |\n| :------ | :------ |\n| `note` | `string` |\n\n##### Returns\n\n[`Pitch`](#classespitchmd)\n\n##### Defined in\n\n[src/index.ts:698](https://github.com/danielgamage/pitch-utils/blob/49fe7a5/src/index.ts#L698)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgamage%2Fpitch-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielgamage%2Fpitch-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgamage%2Fpitch-utils/lists"}