| 1 |
Erase all |
| 2 |
Times |
| 3 |
12 |
| 4 |
depth = 200 |
| 5 |
|
| 6 |
sweep = Create Sound from formula: "sweep", 1, 0, 10, 11025, |
| 7 |
... ~ sin (2 * pi * 280 * x^2) |
| 8 |
To Spectrogram: 0.05, 10000, 0.002, 20, "Gaussian" |
| 9 |
Select outer viewport: 0, 6, 0, 3 |
| 10 |
Paint: 0, 0, 0, 10000, 100, "yes", 90, 0, 0, "yes" |
| 11 |
Remove |
| 12 |
selectObject: sweep |
| 13 |
sweep_8k = Resample: 8000, depth |
| 14 |
To Spectrogram: 0.05, 6000, 0.002, 20, "Gaussian" |
| 15 |
Select outer viewport: 0, 6, 3, 6 |
| 16 |
Paint: 0, 0, 0, 6000, 100, "yes", 90, 0, 0, "yes" |
| 17 |
Remove |
| 18 |
|
| 19 |
cutoff = 3800 |
| 20 |
|
| 21 |
for ifilter from 0 to 7 |
| 22 |
filter_mat [ifilter] = Create Matrix: "filter", -depth / 11025, depth / 11025, |
| 23 |
... depth*2, 1 / 11025, (-depth+0.5-3.5*0.375+0.375*ifilter) / 11025, |
| 24 |
... 1, 1, 1, 1, 1, ~ if x = 0 then 1 else sin (2*pi*x*cutoff) / (2*pi*x*cutoff) |
| 25 |
... * (0.5 + 0.5 * cos (pi * x*11025 / depth)) fi |
| 26 |
sum = Get sum |
| 27 |
Formula: ~ self / sum |
| 28 |
filter [ifilter] = To Sound |
| 29 |
plusObject: sweep |
| 30 |
sweep_low [ifilter] = Convolve: "sum", "zero" |
| 31 |
endfor |
| 32 |
|
| 33 |
mooi = Create Sound from formula: "mooi", 1, 0, 10, 11025/1.375, |
| 34 |
... ~ object [sweep_low [col mod 8], (col*11-3*(col mod 8)) / 8] |
| 35 |
To Spectrogram: 0.05, 6000, 0.002, 20, "Gaussian" |
| 36 |
Select outer viewport: 0, 6, 6, 9 |
| 37 |
Paint: 0, 0, 0, 6000, 100, "yes", 90, 0, 0, "yes" |
| 38 |
Remove |
| 39 |
|
| 40 |
;exit |
| 41 |
|
| 42 |
# |
| 43 |
# Write to Info window in base-0 C format. |
| 44 |
# |
| 45 |
writeInfoLine: "static double filter_11_8 [8] [", depth*2, "] = {" |
| 46 |
for ifilter from 0 to 7 |
| 47 |
appendInfo: tab$, "{ " |
| 48 |
for i to depth*2 |
| 49 |
value = object [filter [ifilter], i] |
| 50 |
appendInfo: if abs (value) < 1e-12 then 0 else fixed$ (value, 12) fi, ", " |
| 51 |
endfor |
| 52 |
appendInfoLine: "}," |
| 53 |
endfor |
| 54 |
appendInfoLine: "};" |
| 55 |
|
| 56 |
for ifilter from 0 to 7 |
| 57 |
removeObject: filter_mat [ifilter], filter [ifilter], sweep_low [ifilter] |
| 58 |
endfor |
| 59 |
removeObject: sweep, sweep_8k, mooi |