Debian Codegraph @

test/fon/PitchTier.praat

raw
1 # PitchTier.praat
2 # Paul Boersma 2015-12-21
3
4 writeInfoLine: "PitchTier test"
5
6 tier = Create PitchTier: "tier", -1.0, 1.8
7 Add point: 0.5, 150.0
8 Add point: 0.6, 178.0
9 Add point: 0.6, 180.0 ; shouldn't do anything
10 Add point: 0.3, 200.0 ; should be inserted as the first point
11
12 #
13 # Check time domain.
14 #
15 tmin = Get starting time
16 assert tmin = -1.0
17 tmax = Get end time
18 assert tmax = 1.8
19 duration = Get duration
20 assert duration = 2.8
21
22 n = Get number of points
23 assert n = 3
24
25 #
26 # Check values and sorting.
27 #
28 for i to n
29 time [i] = Get time from index: i
30 pitch [i] = Get value at index: i
31 endfor
32 assert time [1] = 0.3
33 assert time [2] = 0.5
34 assert time [3] = 0.6
35 assert pitch [1] = 200.0
36 assert pitch [2] = 150.0
37 assert pitch [3] = 178.0
38
39 removeObject: tier
40 appendInfoLine: "OK"