Debian Codegraph @

dwtest/test_KlattGrid.praat

raw
1 # test_KlattGrid.praat
2 # djmw 20151020
3
4 printline test_KlattGrid.praat
5
6 t = Create Table with column names... t 25 tier min max nf
7 Set string value... 1 tier pitch
8 Set string value... 2 tier voicing amplitude
9 Set string value... 3 tier flutter
10 Set string value... 4 tier power1
11 Set string value... 5 tier power2
12 Set string value... 6 tier open phase
13 Set string value... 7 tier collision phase
14 Set string value... 8 tier double pulsing
15 Set string value... 9 tier spectral tilt
16 Set string value... 10 tier aspiration amplitude
17 Set string value... 11 tier breathiness amplitude
18 Set numeric value... 1 min 80
19 Set numeric value... 2 min 0
20 Set numeric value... 3 min 0
21 Set numeric value... 4 min 1
22 Set numeric value... 5 min 2
23 Set numeric value... 6 min 0
24 Set numeric value... 7 min 0
25 Set numeric value... 8 min 0
26 Set numeric value... 9 min 0
27 Set numeric value... 10 min 0
28 Set numeric value... 11 min 0
29 Set numeric value... 1 max 400
30 Set numeric value... 2 max 93
31 Set numeric value... 3 max 1
32 Set numeric value... 4 max 4
33 Set numeric value... 5 max 5
34 Set numeric value... 6 max 0.9
35 Set numeric value... 7 max 0.05
36 Set numeric value... 8 max 1
37 Set numeric value... 9 max 40
38 Set numeric value... 10 max 90
39 Set numeric value... 11 max 90
40
41 Set string value... 12 tier oral formant frequency
42 Set string value... 13 tier nasal formant frequency
43 Set string value... 14 tier nasal antiformant frequency
44 Set string value... 15 tier tracheal formant frequency
45 Set string value... 16 tier tracheal antiformant frequency
46 Set string value... 17 tier delta formant frequency
47 Set string value... 18 tier frication formant frequency
48
49 Set numeric value... 12 min 100
50 Set numeric value... 13 min 100
51 Set numeric value... 14 min 0
52 Set numeric value... 15 min 200
53 Set numeric value... 16 min 100
54 Set numeric value... 17 min 0
55 Set numeric value... 18 min 100
56
57 Set numeric value... 12 max 6000
58 Set numeric value... 13 max 6000
59 Set numeric value... 14 max 6000
60 Set numeric value... 15 max 2000
61 Set numeric value... 16 max 1000
62 Set numeric value... 17 max 1000
63 Set numeric value... 18 max 8000
64
65 Set string value... 19 tier oral formant bandwidth
66 Set string value... 20 tier nasal formant bandwidth
67 Set string value... 21 tier nasal antiformant bandwidth
68 Set string value... 22 tier tracheal formant bandwidth
69 Set string value... 23 tier tracheal antiformant bandwidth
70 Set string value... 24 tier delta formant bandwidth
71 Set string value... 25 tier frication formant bandwidth
72
73 nof = 8
74 nnf = 3
75 nnaf = 4
76 ntf = 4
77 ntaf = 2
78 ndf = 2
79 nff = 6
80
81 Set numeric value... 12 nf nof
82 Set numeric value... 13 nf nnf
83 Set numeric value... 14 nf nnaf
84 Set numeric value... 15 nf ntf
85 Set numeric value... 16 nf ntaf
86 Set numeric value... 17 nf ndf
87 Set numeric value... 18 nf nff
88
89 for i from 19 to 25
90 bwmin = Object_'t'[i-7, "min"]
91 bwmax = Object_'t'[i-7, "max"]
92 nf = Object_'t'[i-7, "nf"]
93 Set numeric value... i min bwmin/10
94 Set numeric value... i max bwmax/10
95 Set numeric value... i nf nf
96 endfor
97
98 nPhonationTiers = 11
99
100 tmin = 0
101 tmax = 1
102 kg = Create KlattGrid... kg tmin tmax nof nnf nnaf nff ntf ntaf ndf
103 ntimes = 5
104 dt = 0.0001
105
106 for i to nPhonationTiers
107 select kg
108 tier$ = Object_'t'$[i,"tier"]
109 vmin = Object_'t'[i,"min"]
110 vmax = Object_'t'[i,"max"]
111 for itime to ntimes
112 time[itime] = randomUniform (tmin, tmax)
113 val[itime] = randomUniform (vmin, vmax)
114 Add 'tier$' point... time[itime] val[itime]
115 endfor
116
117 for itime to ntimes
118 val = Get 'tier$' at time... time[itime]
119 assert val = val[itime]
120 endfor
121
122 Remove 'tier$' points... tmin tmax
123
124 tier = Extract 'tier$' tier
125 Remove
126 printline 'tab$'... 'tier$'
127 endfor
128
129 for i from nPhonationTiers+1 to 25
130 select kg
131 tier$ = Object_'t'$ [i, "tier"]
132 vmin = Object_'t' [i, "min"]
133 vmax = Object_'t' [i, "max"]
134 nf = Object_'t' [i, "nf"]
135 print 'tab$'... 'tier$'
136 for ifor from 1 to nf
137 select kg
138 for itime to ntimes
139 time[itime] = randomUniform (tmin, tmax)
140 val[itime] = randomUniform (vmin, vmax)
141 Add 'tier$' point... ifor time[itime] val[itime]
142 endfor
143
144 for itime to ntimes
145 val = Get 'tier$' at time... ifor time[itime]
146 assert val = val[itime]
147 endfor
148
149 Remove 'tier$' points... ifor tmin tmax
150 grid$ = replace$ (tier$, " frequency", "", 1)
151 grid$ = replace$ (grid$, " bandwidth", "", 1)
152 grid = Extract 'grid$' grid
153 print 'tab$''ifor'
154 Remove
155 endfor
156 print 'newline$'
157 endfor
158
159 removeObject: kg, t
160
161 printline test_KlattGrid.praat OK