test_LineSpectralFrequencies.praat 955 B

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