/ simulated_instruments / cymbal2
Sign in
simulated_instruments / cymbal2
cymbal2 / matlab / cymbal2_demo.m
32 lines · 1.6 KBCodeBlameHistory
1793cecTime-domain nonlinear shell cymbal after Samejima (2021)Jeremy Magland 1% Render a cymbal crash with default parameters and print diagnostics.
2% Set P.strike_velocity = 0.5 for a tap on the same instrument, or
3% P.support_clamped = 1 to hear the rigid center clamp of the earlier
4% literature instead of the washer. P.strike_count = 4 plays a repeated
5% figure; the hand retracts between strokes, which the paper's
6% constant-acceleration hand cannot do.
7% Run with: numbl run cymbal2_demo.m
9P = cymbal2_defaults();
10tic;
11[y, dinfo] = cymbal2_render(P);
12elapsed = toc;
14fprintf('grid : %d radial x %d azimuthal, %.1f kHz simulation rate\n', ...
15 P.n_radial, P.n_theta, dinfo.simRate / 1000);
16fprintf('shell : a = %.0f cm, rise %.0f mm -> Rs = %.2f m, washer at %.1f cm\n', ...
17 P.radius_m * 100, P.rise_m * 1000, dinfo.RsM, P.washer_radius_m * 100);
18f0 = cymbal2_modes(P, 0); f0 = f0(f0 > 1);
19f1 = cymbal2_modes(P, 1); f1 = f1(f1 > 1);
20f2 = cymbal2_modes(P, 2); f2 = f2(f2 > 1);
21fprintf('low modes : %.1f Hz (m=1 tilt), %.1f Hz (m=2), %.1f Hz (m=0 bounce)\n', ...
22 f1(1), f2(1), f0(1));
23fprintf('stroke : hand %.1f m/s -> tip %.2f m/s at contact\n', ...
24 dinfo.meanV, abs(dinfo.contactVel(1)));
25fprintf('contact : %.0f N peak, %.2f mm compression, %.1f ms over %d event(s)\n', ...
26 dinfo.peakForceN, dinfo.peakXiMm, dinfo.contactMs, dinfo.contactEvents);
27fprintf('shell peak : %.2f mm displacement = %.1f thicknesses\n', ...
28 dinfo.peakDispM * 1000, dinfo.peakDispThickness);
29fprintf('pickup : %.2e m/s^2 peak acceleration at r = %.1f cm\n', ...
30 dinfo.peakAccel, dinfo.pickupRadiusM * 100);
31fprintf('length : %.2f s @ %d Hz\n', dinfo.lengthS, P.sample_rate);
32fprintf('render time: %.1f s\n', elapsed);
↑↓ move↵openescclose