5623b11Recorder simulator: MATLAB jet-drive model and interactive web appJeremy Magland 1function [noteIdx, tOn, spanS, ninfo] = recorder_notes(P)
2% RECORDER_NOTES The gesture: one to three tongued notes.
3%
4% Each note starts note_dur_s + gap_ms after the previous one and is rendered
5% over its own span: the sounding length plus enough ring for the release and
6% the resonator decay (the last note gets the full tail_s). Notes are
7% rendered independently and summed; the bore state does not carry across a
8% note change, which is right for tongued (detached) articulation and is the
9% model's stated limitation for legato.
10%
11% Returns row vectors: noteIdx (fingering chart rows), tOn (onset times, s),
12% spanS (rendered span of each note, s), and ninfo with the total duration.
14K = min(3, max(1, round(P.note_count)));
15notes = [P.note1, P.note2, P.note3];
16gap = max(0, P.gap_ms) * 1e-3;
18noteIdx = zeros(1, K);
19tOn = zeros(1, K);
20spanS = zeros(1, K);
21for i = 1:K
22 noteIdx(i) = min(max(1, round(notes(i))), 14);
23 tOn(i) = (i - 1) * (P.note_dur_s + gap);
24 if i < K
25 ring = min(P.tail_s, 0.30);
26 else
27 ring = P.tail_s;
28 end
29 spanS(i) = P.note_dur_s + ring;
30end
32ninfo.count = K;
33ninfo.durationS = tOn(K) + P.note_dur_s + P.tail_s;
34end