| 1 |
# test_LineSpectralFrequencies.praat |
| 2 |
# djmw 20160511 |
| 3 |
|
| 4 |
appendInfoLine: "test_LineSpectralFrequencies" |
| 5 |
samplingFrequency = 8000 |
| 6 |
eps = 1e-5 |
| 7 |
for i to 9 |
| 8 |
s = Create Sound as tone complex: "toneComplex", 0, 0.5, samplingFrequency, "Cosine", 100, 0, 0, 0 |
| 9 |
appendInfoLine: tab$, "sampling frequency = ", samplingFrequency |
| 10 |
for nc from 8 to 20 |
| 11 |
appendInfoLine: tab$, tab$, "lpc order = ", nc |
| 12 |
selectObject: s |
| 13 |
lpc1 = To LPC (autocorrelation): nc, 0.025, 0.005, 50 |
| 14 |
f1 = To Formant |
| 15 |
selectObject: lpc1 |
| 16 |
lsf = To LineSpectralFrequencies: 0.0 |
| 17 |
lpc2 = To LPC |
| 18 |
f2 = To Formant |
| 19 |
for iformant to nc/2 |
| 20 |
selectObject: f1 |
| 21 |
fi1 = Get value at time: iformant, 0.25, "Hertz", "Linear" |
| 22 |
selectObject: f2 |
| 23 |
fi2 = Get value at time: iformant, 0.25, "Hertz", "Linear" |
| 24 |
assert abs (fi1 - fi2) < eps * fi1 |
| 25 |
endfor |
| 26 |
removeObject: lpc1, f1, lsf, lpc2, f2 |
| 27 |
endfor |
| 28 |
removeObject: s |
| 29 |
samplingFrequency += 2000 |
| 30 |
endfor |
| 31 |
|
| 32 |
appendInfoLine: "test_LineSpectralFrequencies OK" |