pub fn split_at_attacks(notes: &NoteList, levels: &StemLevels<'_>) -> NoteListExpand description
Splits each note where the stem has an attack of its own inside it.
The decoder can read a low repeat with a short gap as part of one long
note, so no later step sees two notes. A frame inside a note marks a
dip when it is no louder than the frame before it, quieter than the
frame after it, and ATTACK_DIP or more below the loudest frame in
the ATTACK_AFTER after it. The split falls on the last envelope
reading at or below the first share of RISE_SPAN of the loudest
reading in that span, before the first reading at the second share
after the quietest of the dip frame’s readings, and the note’s
fundamental must dip by FUNDAMENTAL_DIP across it. It holds when the piece from
there has an attack of its own after the piece before it, by the rule
of the split join, which then keeps the two apart. Each piece keeps the
note’s key, octave flag and velocity.
A last piece of at most twice ATTACK_AFTER that runs into the
decoder’s next note of its key, within SPLIT_GAP, starts that note
instead, unless that note has an attack of its own after the piece.
The decoder can start a note 58 ms after its attack, which leaves such
a piece. A repeat after a gap of 20 ms or less can show no attack by
the rule of the split join, so the limit keeps a longer piece before
one a note of its own. A gated repeat of 60 to 90 ms after such a gap
still loses its onset to the piece before it.