| 1 |
# test_Ltas_reportSpectralTilt.praat |
| 2 |
# djmw 20130813, 2017 |
| 3 |
|
| 4 |
appendInfoLine: "test_Ltas_reportSpectralTilt" |
| 5 |
for k to 10 |
| 6 |
@ltas |
| 7 |
endfor |
| 8 |
procedure ltas |
| 9 |
.s [1] = Create Sound from formula: "sineWithNoise", 1, 0, 1, 44100, "randomGauss(0,0.1)" |
| 10 |
.s [2] = Filter (de-emphasis): 50 |
| 11 |
# some of the following values are rough guesses, if the assertion failes adapt the values somewhat |
| 12 |
.slope [1] = 0 ; dB/Hz (this value is exact) |
| 13 |
.slopemargin[1] = 0.5 ; approximate |
| 14 |
.slope [2] = -20 ; dB/decade (this value is exact) |
| 15 |
.slopemargin[2] = 1.5 ; approximate |
| 16 |
.offset [1] = 30.8 ; dB approximate |
| 17 |
.offsetmargin[1] = 3 ; approximate |
| 18 |
.offset [2] = 95 ; dB ; approximate |
| 19 |
.offsetmargin [2] = 4 ; approximate |
| 20 |
for .i to 2 |
| 21 |
selectObject: .s [.i] |
| 22 |
.ltas = To Ltas: 100 |
| 23 |
.info$ = Report spectral tilt: 100, 10000, "Logarithmic", "Robust" |
| 24 |
.slope = extractNumber (.info$, "Slope:") |
| 25 |
.offset = extractNumber (.info$, "Offset:") |
| 26 |
.slopediff = (.slope - .slope [.i]) |
| 27 |
.offsetdiffr = (.offset - .offset [.i]) / .offset |
| 28 |
appendInfoLine: tab$, "Slope difference = ", .slopediff, " (slope [", .i, "] = ", .slope [.i], ")" |
| 29 |
appendInfoLine: tab$, "Rel. offset diff = ", .offsetdiffr, " (Offset [", .i, "] = ", .offset [.i], ")" |
| 30 |
removeObject: .s [.i], .ltas |
| 31 |
endfor |
| 32 |
endproc |
| 33 |
appendInfoLine ("test_Ltas_reportSpectralTilt OK") |