Skip to main content

Module correlate

Module correlate 

Source
Expand description

How what a stream’s notes sound goes with the dynamics they sound under: music21’s analysis.correlate.

Functions§

pitch_to_dynamic
Each pitch of each note and chord of a stream flattened, with each dynamic it sounds under – the dynamic’s place in SHORT_NAMES, from pppppp at nought to ffffff – one pair for each: music21’s ActivityMatch.pitchToDynamic. A dynamic holds from its offset to the next dynamic’s, the last to the end of the stream, and a note starting just where one dynamic ends and the next begins sounds under both. music21 reads where a dynamic ends as its offset plus its length in Python’s arithmetic, which rounds a sum of an offset in quarters and a length in thirds, so a note on a third of a beat can fall just after the end and sound under the next dynamic alone; this reads them so too.
pitch_to_dynamic_counts
The same pairs, each once, with how many times it comes, in the order first met: music21’s pitchToDynamic(dataPoints=False).