1% Render a cymbal crash with default parameters and print diagnostics.
2% Set P.strike_count = 8 for a repeated ride figure, or P.cascade_gain = 0
3% to hear the same plate as an exactly linear resonator.
4% Run with: numbl run cymbal_demo.m
6P = cymbal_defaults();
7tic;
8[y, basis, dinfo] = cymbal_render(P);
9elapsed = toc;
11fprintf('modes kept : %d up to n = %d nodal diameters (%.0f Hz to %.0f Hz)\n', ...
12 dinfo.modesKept, dinfo.maxN, basis.f(1), basis.f(end));
13fprintf('lowest : ');
14fprintf('%.0f ', basis.f(1:min(10, basis.n)));
15fprintf('Hz\n');
16fprintf('strikes : %d at %.1f Hz (mean v %.2f m/s, mean contact %.0f us, peak force %.0f N)\n', ...
17 dinfo.strikeCount, P.strike_rate_hz, dinfo.meanV, dinfo.meanTauUs, dinfo.peakForceN);
18fprintf('cascade : peak w_rms %.1f um = %.2f thicknesses, %.1f%% of the injected energy left the top\n', ...
19 dinfo.peakWrmsUm, sqrt(dinfo.peakStrength), 100 * dinfo.cascadeLostJ / max(1e-30, dinfo.injectedJ));
20fprintf('peak press.: %.4f Pa (%.1f dB SPL) at %.0f cm\n', ...
21 dinfo.peakPa, dinfo.peakSplDb, dinfo.listenerDistM * 100);
22fprintf('length : %.2f s @ %d Hz\n', length(y) / P.sample_rate, P.sample_rate);
23fprintf('render time: %.2f s\n', elapsed);
24if dinfo.listenerInside
25 fprintf('WARNING : listener is at or inside the plate\n');
26end