-
Notifications
You must be signed in to change notification settings - Fork 24
/
draw_LPC_spectrum_from_selection.praat
48 lines (41 loc) · 1.56 KB
/
draw_LPC_spectrum_from_selection.praat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# This script will draw an LPC spectrum from a given window around the cursor in the editor window.
#
# 11.3.2002 Mietta Lennes
# Ask the user for some necessary information:
form Draw an LPC spectrum from a small window around the cursor
comment LPC options:
integer Prediction_order 20
positive Analysis_width_(seconds) 0.025
positive Time_step_(seconds) 0.005
positive Preemphasis_from_(Hz) 50.0
comment Options for drawing the spectrum from LPC:
integer Minimum_frequency_resolution_(Hz) 20
positive Bandwidth_reduction_(Hz) 0.1
positive Deemphasis_frequency_(Hz) 50.0
endform
# Make a temporary selection from the original sound:
cursor = Get cursor
start = cursor - analysis_width
end = cursor + analysis_width
Select... start end
# name the new Sound object according to the time point where the cursor was
milliseconds = round (cursor * 1000)
Extract windowed selection... LPC_'milliseconds'ms Kaiser2 2 no
# leave the Sound editor for a while to calculate and draw the spectrum
endeditor
# Make an LPC object from the new Sound
To LPC (burg)... prediction_order analysis_width time_step preemphasis_from
To Spectrum (slice)... analysis_width minimum_frequency_resolution bandwidth_reduction deemphasis_frequency
Edit
editor Spectrum LPC_'milliseconds'ms
# zoom the spectrum to a comfortable frequency view...
Zoom... 0 5000
endeditor
# select and remove the temporary Sound and LPC objects
select Sound LPC_'milliseconds'ms
Remove
select LPC LPC_'milliseconds'ms
Remove
# return to the Sound editor window and recall the original cursor position
editor
Move cursor to... cursor