distance library

npm version tonal

Transpose notes by intervals and find distances between notes

@example // es6 import * as Distance from "tonal-distance" Distance.interval("C3", "C4") // => "1P"

@example // es6 import selected functions import { interval, semitones, transpose } from "tonal-distance"

semitones("C" ,"D") // => 2 interval("C4", "G4") // => "5P" transpose("C4", "P5") // => "G4"

@example // included in tonal facade const Tonal = require("tonal"); Tonal.Distance.transpose("C4", "P5") Tonal.Distance.transposeBy("P5", "C4")

Distance

Properties

decode Map<String, dynamic> Function(dynamic f, [dynamic o, dynamic dir])
final
decodeIvl Map<String, dynamic> Function(dynamic i)
final
encode List Function(dynamic map)
final
encodeIvl → dynamic Function([dynamic str])
final
encodeNote → dynamic Function([dynamic str])
final
encoder → dynamic Function([dynamic str]) Function(dynamic props)
final
FIFTH_OCTS List
final
FIFTHS List<int>
final
fOcts → dynamic Function(dynamic f)
final
isDescending → dynamic Function(dynamic e)
final
memo → dynamic Function([dynamic str]) Function([dynamic fn, Map cache])
final
STEPS List<int>
final

Functions

add(dynamic ivl1, [dynamic ivl2]) → dynamic
Add two intervals
addIntervals(dynamic ivl1, dynamic ivl2, dynamic dir) → dynamic
fifths(dynamic from, dynamic to) → dynamic
Get the distance in fifths between pitch classes
interval(dynamic from, [dynamic to]) → dynamic
Find the interval between two pitches. It works with pitch classes (both must be pitch classes and the interval is always ascending)
semitones(dynamic from, [dynamic to]) → dynamic
Get the distance between two notes in semitones
subtract(dynamic ivl1, dynamic ivl2) → dynamic
Subtract two intervals
transpose(dynamic _note, [dynamic interval]) → dynamic
Transpose a note by an interval. The note can be a pitch class.
transposeBy(dynamic interval, [dynamic note]) → dynamic
The same as transpose with the arguments inverted.
trFifths(dynamic _note, [dynamic fifths]) → dynamic
Transpose a pitch class by a number of perfect fifths.
unaltered(dynamic f) → dynamic