/ simulated_instruments / triangle
Sign in
simulated_instruments / triangle
triangle / matlab / triangle_demo.m
21 lines · 874 BCodeBlameHistory
96aec9cTriangle strike simulator: MATLAB model and interactive web appJeremy Magland 1% Render a triangle strike with default parameters and print diagnostics.
2% Run with: numbl run triangle_demo.m
4P = triangle_defaults();
5tic;
6[y, basis, dinfo] = triangle_render(P);
7elapsed = toc;
9fprintf('modes kept : %d (%d in-plane, %d out-of-plane)\n', basis.n, dinfo.modesIn, dinfo.modesOut);
10fprintf('mode freq : ');
11fprintf('%.0f ', basis.f);
12fprintf('Hz\n');
13fprintf('strikes : %d (mean v %.2f m/s, mean contact %.0f us, peak force %.0f N)\n', ...
14 dinfo.strikeCount, dinfo.meanV, dinfo.meanTauUs, dinfo.peakForceN);
15fprintf('peak press.: %.4f Pa (%.1f dB SPL) at %.0f cm\n', ...
16 dinfo.peakPa, dinfo.peakSplDb, dinfo.listenerDistM * 100);
17fprintf('length : %.2f s @ %d Hz\n', length(y) / P.sample_rate, P.sample_rate);
18fprintf('render time: %.2f s\n', elapsed);
19if dinfo.listenerInside
20 fprintf('WARNING : listener is at or inside the rod\n');
21end
↑↓ move↵openescclose