1# Commands covered: sound formant
2#
3
4package require -exact snack 2.2
5
6if {[lsearch [namespace children] ::tcltest] == -1} {
7    package require tcltest
8    namespace import ::tcltest::*
9}
10
11test formant-1.1 {formant command} {
12  set s [snack::sound snd -load ex1.wav]
13  set tcl_precision 5
14  set res [lindex [$s formant -framelength 0.01 -preemphasis 0.7 -numformants 4  -lpcorder 12 -windowlength .049 -lpctype 0 -ds_freq 10000.0 -nom_f1_freq -10.0] end]
15  $s destroy
16  set res
17} {102.23 2077.6 2951.1 3818.2 734.88 480.1 532.49 588.74}
18
19test formant-1.2 {formant command} {
20  set s [snack::sound snd -load ex1.wav]
21  set tcl_precision 5
22  set res [lindex [$s formant] end]
23  $s destroy
24  set res
25} {102.23 2077.6 2951.1 3818.2 734.88 480.1 532.49 588.74}
26
27test formant-1.3 {formant command} {
28  set s [snack::sound snd -load ex1.wav]
29  set tcl_precision 5
30  set res [lindex [$s formant -windowtype 2] end]
31  $s destroy
32  set res
33} {102.23 2077.6 2951.1 3818.2 734.88 480.1 532.49 588.74}
34
35test formant-1.4 {formant command} {
36  set s [snack::sound snd -load ex1.wav]
37  set tcl_precision 5
38  set res [lindex [$s formant -windowtype cos^4] end]
39  $s destroy
40  set res
41} {102.23 2077.6 2951.1 3818.2 734.88 480.1 532.49 588.74}
42
43test formant-1.5 {formant command} {
44  set s [snack::sound snd -load ex1.wav]
45  set tcl_precision 5
46  set res [lindex [$s formant -windowtype 0] end]
47  $s destroy
48  set res
49} {151.71 1265.8 2097.1 2948.0 651.9 693.92 580.95 513.44}
50
51test formant-1.6 {formant command} {
52  set s [snack::sound snd -load ex1.wav]
53  set tcl_precision 5
54  set res [lindex [$s formant -windowtype rectangular] end]
55  $s destroy
56  set res
57} {151.71 1265.8 2097.1 2948.0 651.9 693.92 580.95 513.44}
58
59
60# cleanup
61::tcltest::cleanupTests
62return
63