UNPKG

@temper.sh/pitch

Version:

Utilities for working with pitch in arbitrary equal temperament spaces

17 lines (12 loc) 362 B
import { interval } from '@/interval' import type { Chord, Interval } from '@/types' export const intervals = (chord: Chord): Array<Interval> => { if (chord.length < 2) { return [] } const intervals: Array<Interval> = [] for (let i = 0; i < chord.length - 1; i++) { intervals.push(interval(chord[i]!, chord[i + 1]!)) } return intervals }