Debian Codegraph @

test/fon/endian.praat

raw
1 echo Endian...
2
3 keepFiles = 0
4
5 procedure do testCorrect
6 Read from file... test.wav
7 energyInAir = Get energy in air
8 assert "'energyInAir:11'" = "0.00008397361"
9
10 if testCorrect
11 Read from file... test.Sound
12 energyInAir2 = Get energy in air
13 Remove
14 select Sound test
15 assert energyInAir2 = energyInAir ; 'energyInAir2' 'energyInAir'
16
17 Write to WAV file... test2.wav
18 Remove
19 Read from file... test2.wav
20 energyInAir2 = Get energy in air
21 deleteFile ("test2.wav")
22 assert energyInAir2 = energyInAir
23
24 Write to AIFF file... test2.aiff
25 Remove
26 Read from file... test2.aiff
27 energyInAir2 = Get energy in air
28 deleteFile ("test2.aiff")
29 assert energyInAir2 = energyInAir
30
31 Write to FLAC file... test2.flac
32 Remove
33 Read from file... test2.flac
34 energyInAir2 = Get energy in air
35 deleteFile ("test2.flac")
36 assert energyInAir2 = energyInAir
37
38 Write to binary file... test2.bin
39 Remove
40 Read from file... test2.bin
41 energyInAir2 = Get energy in air
42 deleteFile ("test2.bin")
43 assert energyInAir2 = energyInAir
44
45 Write to Sesam file... test2.sdf
46 Remove
47 Read from file... test2.sdf
48 deleteFile ("test2.sdf")
49 energyInAir2 = Get energy in air
50 Write to Sesam file... test3.sdf
51 Remove
52 Read from file... test3.sdf
53 deleteFile ("test3.sdf")
54 energyInAir3 = Get energy in air
55 assert energyInAir3 = energyInAir2
56 endif
57
58 Remove
59
60 duration = 100
61 Create Sound: "test", 0, duration, 22050, ~ 0.1 * randomGauss (0, 1)
62 for i to 2
63 stopwatch
64 Save as WAV file: "kanweg.wav"
65 t1 = stopwatch
66 keepFiles or deleteFile: "kanweg.wav"
67 stopwatch
68 Save as AIFF file: "kanweg.aiff"
69 t2 = stopwatch
70 keepFiles or deleteFile: "kanweg.aiff"
71 stopwatch
72 Save as binary file: "kanweg.Sound"
73 t3 = stopwatch
74 keepFiles or deleteFile: "kanweg.Sound"
75 stopwatch
76 Save as FLAC file: "kanweg.flac"
77 t4 = stopwatch
78 keepFiles or deleteFile: "kanweg.flac"
79 printline 't1:3' 't2:3' 't3:3' 't4:3'
80 endfor
81 Remove
82
83 Create Sound... test 0 1 22050 exp(-x*1000)
84 Write to binary file... kanweg.Sound
85 Read from file... kanweg.Sound
86 Formula... (self = Sound_test []) - 1
87 energyInAir = Get energy in air
88 assert energyInAir = 0
89 plus Sound test
90 Remove
91
92 Create Sound... test 0 1 22050 exp(x*1000)
93 Write to binary file... kanweg.Sound
94 Read from file... kanweg.Sound
95 Formula... (self = Sound_test []) - 1
96 energyInAir = Get energy in air
97 assert energyInAir = 0
98 plus Sound test
99 Remove
100 deleteFile ("kanweg.Sound")
101
102 Create TableOfReal... test 1 22050
103 Formula... exp(-col/22.05)
104 Write to binary file... kanweg.TableOfReal
105 Read from file... kanweg.TableOfReal
106 Formula... (self = TableOfReal_test []) - 1
107 norm = Get table norm
108 assert norm = 0
109 plus TableOfReal test
110 Remove
111
112 Create TableOfReal... test 1 22050
113 Formula... exp(col/22.05)
114 Write to binary file... kanweg.TableOfReal
115 Read from file... kanweg.TableOfReal
116 Formula... (self = TableOfReal_test []) - 1
117 norm = Get table norm
118 assert norm = 0
119 plus TableOfReal test
120 Remove
121 deleteFile ("kanweg.TableOfReal")
122 endproc
123 printline Optimized:
124 Debug... no 0
125 call do 1
126 printline Portable:
127 Debug... no 18
128 call do 1
129 printline Native:
130 Debug... no 181
131 call do 0
132 Debug... no 0
133
134 printline OK