Debian Codegraph @

test/fon/resamplingDepth.praat

raw
1 # resamplingDepth.praat
2 # Paul Boersma, 28 October 2024
3
4 sound50k = Read from file: "examples/sounds/aaaa02.wav"
5 sound4k = Resample: 4000, 700
6 ;Play
7 duration = Get total duration
8
9 depths# = { 700, 50, 20, 10, 6, 3, 2, 1 }
10
11 Erase all
12 Times
13 12
14
15 for idepth to size (depths#)
16 depth = depths# [idepth]
17 select sound4k
18 stopwatch
19 sound44k = Resample: 44100, depth
20 speed$ = fixed$ (stopwatch / duration * 100, 3)
21 ;Play
22 To Spectrum: "no"
23 leak = Get band energy difference: 0, 2000, 2000, 22050
24 Remove
25 select sound44k
26 To Spectrogram: 0.030, 10000, 0.002, 20.0, "Gaussian"
27 col = (idepth - 1) div 4 + 1
28 row = (idepth - 1) mod 4 + 1
29 Select outer viewport: 6 * (col - 1), 6 * col, 3 * (row - 1), 3 * row
30 Paint: 0, 0, 0, 0, 100.0, "yes", 100.0, 6.0, 0.0, "yes"
31 Text top: "no", "depth " + string$ (depth) + ": " + speed$ + "\% , " + fixed$ (leak, 3) + " dB"
32 Red
33 Draw line: 0, 2000, duration, 2000
34 Remove
35 removeObject: sound44k
36 endfor
37 removeObject: sound4k, sound50k
38 Select outer viewport: 0, 12, 0, 12