Skip to main content

Module volume

Module volume 

Source
Expand description

How loud a note is: music21’s volume.Volume.

A volume is one number held two ways — a MIDI velocity from 0 to 127 and the same value as a scalar from 0 to 1 — plus the rule for reading it against the dynamic marks around it. A volume does not know the note it belongs to, so Volume::realized_with takes the dynamic scalar and the articulation shift as arguments; the marks themselves are found in a stream by dynamic_context, dynamics_in_force and realize_volume.

Structs§

Volume
How loud a note is: music21’s volume.Volume.

Enums§

DynamicContext
Where realize_volume looks for the dynamic a note sounds under: music21’s useDynamicContext, which is True, False or a Dynamic.

Functions§

dynamic_context
The dynamic a note’s volume is read against: music21’s getDynamicContext, which asks the note for the nearest dynamic at or before it.
dynamics_in_force
The dynamic each element of a stream stands under: for every element Stream::leaves lists, the position in that list of the dynamic in force where it stands, or None where no dynamic is.
realize_volume
Sets how loud every note and chord of a stream sounds, from the dynamics in force: music21’s realizeVolume with setAbsoluteVelocity.
rounded_str
A loudness written out the way Python writes str(round(value, 2)): to two places, with the trailing zeros dropped but never the point.