% Render a recorder note with default parameters and print diagnostics. % Set P.note_count = 3 for a three-note figure; P.note1..note3 pick the % fingerings (1 = C5 ... 10 = D6, 11..14 = pinched E6, F6, G6, A6). % Run with: numbl run recorder_demo.m P = recorder_defaults(); tic; [y, basis, dinfo] = recorder_render(P); elapsed = toc; fprintf('bore modes : %d resonances, first at %.1f Hz (Q %.0f)\n', basis.n, basis.f(1), basis.Q(1)); fprintf('notes : %d\n', dinfo.noteCount); for i = 1:dinfo.noteCount fprintf(' note %d : fingering %d, played %.1f Hz (target %.1f, %+.1f cents)\n', ... i, dinfo.noteIdx(i), dinfo.fPlay(i), 523.25 * 2^((dz_semi(dinfo.noteIdx(i))) / 12), dinfo.cents(i)); end fprintf('peak press.: %.4f Pa (%.1f dB SPL) at %.0f cm\n', ... dinfo.peakPa, dinfo.peakSplDb, dinfo.listenerDistM * 100); fprintf('length : %.2f s @ %d Hz\n', length(y) / P.sample_rate, P.sample_rate); fprintf('render time: %.2f s\n', elapsed); if dinfo.listenerInside fprintf('WARNING : listener is at or inside the instrument\n'); end function s = dz_semi(note) semis = [0 2 4 5 7 9 11 12 13 14 16 17 19 21]; s = semis(note); end