/ simulated_instruments / woodblock
Sign in
simulated_instruments / woodblock
woodblock / matlab / woodblock_demo.m
24 lines · 939 BCodeBlameHistory
c5866daReimplement the algorithm in MATLAB syntax, run it with numblJeremy Magland 1% Render a woodblock strike with default parameters and print diagnostics.
2% Run with: numbl run woodblock_demo.m
4P = woodblock_defaults();
5tic;
6[y, basis, dinfo] = woodblock_render(P);
7elapsed = toc;
9fprintf('modes kept : %d\n', basis.n);
10fprintf('partials Hz: ');
11fprintf('%.0f ', basis.f);
12fprintf('\nratios : ');
13fprintf('%.2f ', basis.f / basis.f(1));
14fprintf('\nhelmholtz : %.0f Hz\n', dinfo.helmholtzHz);
15fprintf('contact : %.3f ms, peak %.0f N\n', dinfo.contactMs, dinfo.peakForceN);
16fprintf('peak press.: %.3f Pa (%.1f dB SPL)\n', dinfo.peakPa, dinfo.peakSplDb);
17fprintf('length : %.3f s @ %d Hz\n', length(y) / P.sample_rate, P.sample_rate);
18fprintf('render time: %.2f s\n', elapsed);
19if dinfo.spacingNeed > 0
20 fprintf('WARNING : element spacing is coarse; consider %d radiating elements\n', dinfo.spacingNeed);
21end
22if dinfo.listenerInside
23 fprintf('WARNING : listener is inside the source region\n');
24end
↑↓ move↵openescclose