The single key that holds for most of a run of regions.
Callers that only want one key — a key signature to print, a scale to offer — need the one the piece spends the most time in, not the one it happens to start on.
The regions to weigh, as returned by the key-region entry points.
The longest-held key, or null when there are no regions.
import { keyTimelineFromNotes, prevailingKeyOf } from '@libraz/libcantus';const notes = [{ pitch: 60, startBeat: 0, durationBeat: 4 }];const key = prevailingKeyOf(keyTimelineFromNotes(notes)); Copy
import { keyTimelineFromNotes, prevailingKeyOf } from '@libraz/libcantus';const notes = [{ pitch: 60, startBeat: 0, durationBeat: 4 }];const key = prevailingKeyOf(keyTimelineFromNotes(notes));
The single key that holds for most of a run of regions.
Callers that only want one key — a key signature to print, a scale to offer — need the one the piece spends the most time in, not the one it happens to start on.