/ simulated_instruments / cymbal
Sign in
simulated_instruments / cymbal
cymbal / matlab / d_now.m
21 lines · 946 BCodeBlameHistory
3a32a66Default the turbulent fluctuation offJeremy Magland 1P = cymbal_defaults(); Q = P; Q.normalize = 0; Q.full_scale_pa = 1;
2fs = P.sample_rate; win = 4096;
3for turb = [0 0.9]
4 R = Q; R.turbulence = turb;
5 [y, b, d] = cymbal_render(R);
6 fprintf('turbulence %.1f peak %6.2f Pa flat@ ', turb, d.peakPa);
7 for tt = [0.01 0.10 0.40 1.00 2.00]
8 i0 = round(tt*fs)+1;
9 x = y(i0:i0+win-1) .* (0.5*(1-cos(2*pi*(0:win-1)/(win-1))));
10 Y = abs(fft(x)).^2; Y = Y(1:win/2); fq = (0:win/2-1)*fs/win;
11 Ys = Y(fq>=1000 & fq<8000) + 1e-24;
12 fprintf('%.3f ', exp(mean(log(Ys)))/mean(Ys));
13 end
14 i0 = round(1.0*fs)+1;
15 x = y(i0:i0+win-1) .* (0.5*(1-cos(2*pi*(0:win-1)/(win-1))));
16 Y = abs(fft(x)).^2; Y = Y(1:win/2); fq = (0:win/2-1)*fs/win;
17 fprintf(' | 1s low-vs-high %.0f dB\n', 10*log10(sum(Y(fq<600))+1e-30) - 10*log10(sum(Y(fq>=1500&fq<8000))+1e-30));
18end
19P2 = cymbal_defaults();
20[y2, b2, d2] = cymbal_render(P2);
21fprintf('\npinned: peakPa %.6f f1 %.6f n %d\n', d2.peakPa, b2.f(1), b2.n);
↑↓ move↵openescclose