tonal-transpose
v0.69.7
Published
Music note transposition
Downloads
2,324
Readme
tonal-transpose
tonal-transpose
is a collection of functions to transpose music notes using note names and interval names. It can be used to add intervals.
This is part of tonal music theory library.
You can install via npm: npm i --save tonal-transpose
API Reference
transpose(a, b) ⇒ String | Pitch
Transpose notes. Can be used to add intervals. At least one of the parameter is expected to be an interval. If not, it returns null.
Kind: global function
Returns: String | Pitch - the transposed pitch or null if not valid parameters
| Param | Type | Description | | --- | --- | --- | | a | String | Pitch | a note or interval | | b | String | Pitch | a note or interavl |
tr()
An alias for transpose
Kind: global function
trFifths(tonic, number) ⇒ String | Pitch
Transpose a tonic a number of perfect fifths. It can be partially applied.
Kind: global function
Returns: String | Pitch - the transposed note
| Param | Type | Description | | --- | --- | --- | | tonic | Pitch | String | | | number | Integer | the number of times |
Example
import { trFifths } from 'tonal-transpose'
[0, 1, 2, 3, 4].map(trFifths('C')) // => ['C', 'G', 'D', 'A', 'E']
// or using tonal
tonal.trFifths('G4', 1) // => 'D5'