Skip to main content

band_onset

Function band_onset 

Source
pub fn band_onset(
    line: &SubBandLine,
    from: Seconds,
    to: Seconds,
) -> Option<Seconds>
Expand description

The onset of a strike inside from..to, from the band envelope.

The envelope is averaged over a centred ONSET_SMOOTHING. The onset is the first sample after the lowest point of the span where the average reaches DROP_ONSET_SHARE of the peak that follows. None when the span is empty or its lowest point already stands above that share, so no attack lies inside it.

The average keeps a held note from reading as a strike: several partials of a saw share the band and beat, so its raw envelope dips at every period. A centred average leaves the midpoint of a step in place.