/ simulated_instruments / woodblock
Sign in
simulated_instruments / woodblock
woodblock / matlab / woodblock_render.m
23 lines · 872 BCodeBlameHistory
c5866daReimplement the algorithm in MATLAB syntax, run it with numblJeremy Magland 1function [y, basis, dinfo] = woodblock_render(P)
2% WOODBLOCK_RENDER Full render: solve -> radiate -> output.
3% Convenience composition of the stage functions; the web app calls the
4% stages separately so it can cache intermediates.
6basis = woodblock_basis(P);
7fsHi = P.sample_rate * P.oversample;
8[Qdd, Xdd, force, helmholtzHz, contactMs, peakForceN, maxRealLam] = ...
9 woodblock_solve(P, basis, P.oversample);
10[p, spacingNeed, listenerInside] = ...
11 woodblock_radiate(P, basis, Qdd, Xdd, fsHi, P.radiating_elements);
12[y, peakPa] = woodblock_output(P, p, P.oversample);
14dinfo.helmholtzHz = helmholtzHz;
15dinfo.contactMs = contactMs;
16dinfo.peakForceN = peakForceN;
17dinfo.maxRealLam = maxRealLam;
18dinfo.peakPa = peakPa;
19dinfo.peakSplDb = 20 * log10(peakPa / 20e-6 + 1e-30);
20dinfo.spacingNeed = spacingNeed;
21dinfo.listenerInside = listenerInside;
22dinfo.force = force;
23end
↑↓ move↵openescclose