tonal-transpose

Music note transposition

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
tonal-transpose
0.69.76 years ago7 years agoMinified + gzip package size for tonal-transpose in KB

Readme

tonal-transpose npm version
tonal
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.

tr()

An alias for transpose

trFifths(tonic, number)String | Pitch

Transpose a tonic a number of perfect fifths. It can be partially applied.


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'