/ simulated_instruments / triangle
Sign in
simulated_instruments / triangle
triangle / export-src / triangle / render_note.m
19 lines · 565 BBlameHistoryRaw
1function y = render_note(note)
2% Unpitched: MIDI pitch is ignored, velocity drives the beater speed.
3% Fixed: a single strike, a fixed seed, normalize off so velocity
4% survives in pascals.
5P = triangle_defaults();
6P.sample_rate = note.sample_rate;
7P.strike_count = 1;
8P.seed = 1;
9P.pre_delay_ms = 0;
10P.normalize = 0;
11if note.preview ~= 0
12 P.oversample = 1;
13end
14P.strike_velocity = 0.1 + (6 - 0.1) * note.velocity;
15P.strike_pos = note.params.strike_pos;
16P.strike_angle_deg = note.params.strike_angle_deg;
17P.tail_s = note.params.tail_s;
18y = triangle_render(P);
19end
↑↓ move↵openescclose