tonal-transpose

0.69.7 • Public • Published

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'

Package Sidebar

Install

npm i tonal-transpose

Weekly Downloads

3

Version

0.69.7

License

MIT

Last publish

Collaborators

  • danigb