Skip to main content

velocity_reaches_level

Function velocity_reaches_level 

Source
pub fn velocity_reaches_level(level_spread: Option<Decibels>) -> bool
Expand description

Whether velocity gets a path to the level: the level spread has a value, read over at least three pooled notes, and exceeds VELOCITY_SPREAD.

The writer of the final notes.mid reads this rule too: a velocity per note from its full-band level when it holds, one constant velocity otherwise. The spread itself is always low confidence, so the rule does not gate on its level.

use sound_to_patch::preset::mapper::pitch_envelope::velocity_reaches_level;
use sound_to_patch::units::Decibels;

assert!(velocity_reaches_level(Some(Decibels::new(4.0)?)));
assert!(!velocity_reaches_level(Some(Decibels::new(3.0)?)));
assert!(!velocity_reaches_level(None));