Debian Codegraph @

test/fon/SoundEditor_GUI_.praat

raw
1 sound = Create Sound from formula: "sineWithNoise", 1, 0, 1, 44100, "1/2 * sin(2*pi*377*x) + randomGauss(0,0.1)"
2 View & Edit
3 editor: sound
4
5 a$ = Editor info
6 writeInfoLine: a$
7 b$ = Sound info
8 appendInfoLine: b$
9 c$ = info$ ()
10 assert index (c$, "Editor type: SoundEditor" + newline$)
11 assert index (c$, "Editor name: ")
12 assert index (c$, ". Sound sineWithNoise" + newline$)
13 assert index (c$, "Editor end: 1 seconds" + newline$)
14 assert index (c$, "Selection start: 0.5 seconds" + newline$)
15 assert index (c$, "Selection end: 0.5 seconds" + newline$)
16 assert index (c$, "Pitch (raw autocorrelation) octave jump cost: ")
17 assert index (c$, " per octave" + newline$)
18 assert index (c$, "Number of channels: 1 (mono)" + newline$)
19 assert index (c$, "Time domain:" + newline$)
20 assert index (c$, "Object type: Sound" + newline$)
21 assert index (c$, "Object name: sineWithNoise" + newline$)
22 assert index (c$, " End time: 1 seconds" + newline$)
23 assert index (c$, " Number of samples: 44100" + newline$)
24 assert index (c$, " Joule/m²)" + newline$)
25 assert index (c$, " Watt/m² = ")
26
27 #
28 # FunctionEditor properties.
29 #
30 a = Get start of selection
31 assert a = 0.5
32 Move cursor to: 0.567
33 a = Get cursor
34 assert a = 0.567
35
36 #
37 # SoundAnalysisArea properties.
38 #
39
40 #
41 # Save old settings.
42 #
43 showSpectrogram = extractNumber (c$, "Spectrogram show: ")
44 showPitch = extractNumber (c$, "Pitch show: ")
45 showIntensity = extractNumber (c$, "Intensity show: ")
46 showFormants = extractNumber (c$, "Formant show: ")
47 showPulses = extractNumber (c$, "Pulses show: ")
48 longestAnalysis = extractNumber (c$, "Longest analysis: ")
49 assert longestAnalysis > 0.0
50 log1target$ = extractLine$ (c$, "Log 1 target: ")
51 log1file$ = extractLine$ (c$, "Log 1 file: ")
52 log1format$ = extractLine$ (c$, "Log 1 format: ")
53 log2target$ = extractLine$ (c$, "Log 2 target: ")
54 log2file$ = extractLine$ (c$, "Log 2 file: ")
55 log2format$ = extractLine$ (c$, "Log 2 format: ")
56 log3script$ = extractLine$ (c$, "Log 3 script: ")
57 log4script$ = extractLine$ (c$, "Log 4 script: ")
58
59 #
60 # Show everything.
61 #
62 Show analyses: "yes", "yes", "yes", "yes", "yes", 10.0
63 #
64 # Query spectral properties.
65 #
66 Spectrogram settings: 0.0, 5000.0, 0.005, 70.0 ; default
67 Spectrogram colour settings: "Grey", "no", "yes" ; default
68 Advanced spectrogram settings: 1000, 250, "Fourier", "Gaussian", "yes", 100.0, 6.0, 0.0 ; default
69 a = Get frequency at frequency cursor
70 a = Get spectral power at cursor cross
71 #
72 # Query pitch properties.
73 #
74 asserterror The command "Pitch listing" returns a string; not assigned to the numeric variable "a".
75 a = Pitch listing
76 a = Get pitch
77 asserterror Make a selection first.
78 a = Get minimum pitch
79 asserterror Make a selection first.
80 a = Get maximum pitch
81 #
82 # Query intensity properties.
83 #
84 asserterror The command "Intensity listing" returns a string; not assigned to the numeric variable "a".
85 a = Intensity listing
86 a = Get intensity
87 asserterror Make a selection first.
88 a = Get minimum intensity
89 asserterror Make a selection first.
90 a = Get maximum intensity
91 #
92 # Query pulses properties.
93 #
94 asserterror Make a selection first.
95 report$ = Voice report
96 Select: 0.5, 0.567
97 report$ = Voice report
98 writeInfoLine: "Voice report>>>", report$, "<<<Voice report"
99 assert index (report$, " Jitter (local): ")
100 listing$ = Pulse listing
101 assert index (listing$, "Time_s")
102 #
103 # Query formant properties.
104 #
105 f1 = Get first formant
106 assert f1 > 0.0
107 b4 = Get bandwidth: 4
108 assert b4 > 0.0
109 #
110 # Log
111 #
112 Log settings: "Info window only", log1file$, "Time 'time:6' seconds, pitch 'f0:2' Hz, 'editor$'", log2target$, log2file$, log2format$, log3script$, log4script$
113 Log 1
114 pitchLog$ = info$ ()
115 assert index (pitchLog$, ". Sound sineWithNoise")
116
117 #
118 # Restore old settings.
119 #
120 Show analyses: showSpectrogram, showPitch, showIntensity, showFormants, showPulses, longestAnalysis
121 Log settings: log1target$, log1file$, log1format$, log2target$, log2file$, log2format$, log3script$, log4script$
122
123 Close
124 endeditor
125 Remove