function [noteIdx, tOn, spanS, ninfo] = recorder_notes(P) % RECORDER_NOTES The gesture: one to three tongued notes. % % Each note starts note_dur_s + gap_ms after the previous one and is rendered % over its own span: the sounding length plus enough ring for the release and % the resonator decay (the last note gets the full tail_s). Notes are % rendered independently and summed; the bore state does not carry across a % note change, which is right for tongued (detached) articulation and is the % model's stated limitation for legato. % % Returns row vectors: noteIdx (fingering chart rows), tOn (onset times, s), % spanS (rendered span of each note, s), and ninfo with the total duration. K = min(3, max(1, round(P.note_count))); notes = [P.note1, P.note2, P.note3]; gap = max(0, P.gap_ms) * 1e-3; noteIdx = zeros(1, K); tOn = zeros(1, K); spanS = zeros(1, K); for i = 1:K noteIdx(i) = min(max(1, round(notes(i))), 14); tOn(i) = (i - 1) * (P.note_dur_s + gap); if i < K ring = min(P.tail_s, 0.30); else ring = P.tail_s; end spanS(i) = P.note_dur_s + ring; end ninfo.count = K; ninfo.durationS = tOn(K) + P.note_dur_s + P.tail_s; end