Debian Codegraph @

test/LPC/Sound_to_LPC.praat

raw
1 writeInfoLine: "Sound_to_LPC:"
2
3 sound = Read from file: "../fon/logicalVersusPhysical.Sound"
4 lpc = noprogress To LPC (burg): 16, 0.025, 0.005, 50.0
5 numberOfFrames = Get number of frames
6 assert numberOfFrames = 190 or numberOfFrames = 191 ; 'numberOfFrames'
7 removeObject: sound, lpc
8
9 numberOfFailures = 0
10 for i to 30
11 duration = randomUniform (0.002, 0.020)
12 windowDuration = randomUniform (0.001, 0.010)
13 appendInfo: i, " ", duration, " ", windowDuration
14 samplingFrequency = randomUniform (16000, 96000)
15 sound = Create Sound from formula: "test", 1, 0, duration, samplingFrequency, ~ 1/2 * sin(2*pi*377*x) + randomGauss(0,0.1)
16 if duration < 2 * windowDuration
17 asserterror Your sound is shorter than two window lengths. Either your sound is too short or your window is too long.
18 noprogress To LPC (burg): 16, windowDuration, 0.005, 50
19 numberOfFailures += 1
20 appendInfoLine: " failure"
21 else
22 noprogress To LPC (burg): 16, windowDuration, 0.005, 50
23 appendInfoLine: " success"
24 Remove
25 endif
26 removeObject: sound
27 endfor
28 appendInfoLine: numberOfFailures, " failures"
29
30 appendInfoLine: "OK"