-
Notifications
You must be signed in to change notification settings - Fork 0
/
1) ProPerMSA_pre-preparation.praat
86 lines (80 loc) · 3.22 KB
/
1) ProPerMSA_pre-preparation.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# TITLE: ProPer pre-preparation (I): Acoustics-to-Praat
# Extract acoustic data from Praat for further analysis with R
# (see following files in workflow).
# INPUT: Audio files (preferably at least 44.1kHz sample-rate and 16bit PCM).
# OUTPUT: Pitch objects, pitch tiers and intensity tiers.
# NOTES: This script creates the corresponding Praat objects (see "output") for
# files in the audio directory ("input"). The extracted parameters in
# pitch objects and intensity tiers are used in the R code to yield
# periodic energy curves. The pitch tier object is used for standard
# F0 information, which can be tweaked in fields of this script's form,
# and can be manually corrected when the "inspect" option is switched on.
# IMPORTANT: Before running the script, make sure to replace the 'xxx' in the
# directories with your relevant directory string (either in the script
# or in the prompted form). Also, make sure that your audio files are in
# the "Audio" directory.
# AUTHORS: Aviad Albert and Francesco Cangemi {a.albert / fcangemi} @uni-koeln.de
#
####### Input form
form Input parameters
comment Replace "xxx" with your diretories info. Note your platform's syntax:
comment PC directories are often "C:\...\"; Mac directories are often "/Users/.../".
# comment Do not forget the final slash!
sentence InDirAudio xxx/audio/
sentence OutDirPitchObject xxx/praat_data/pitch_objects/
sentence OutDirPitchTier xxx/praat_data/pitch_tiers/
sentence OutDirIntensityTier xxx/praat_data/intensity_tiers/
comment Manually inspect F0 for corrections?
boolean inspect 1
comment F0 path finder settings (adjustable).
real silenceThr 0.03
real voicingThr 0.2
real octave 0.1
real octavejump 0.8
real voiceunvoiced 0.14
integer pitchmax 600
comment F0 smoothing bandwidth (Hz).
integer smooth 10
endform
Erase all
####### Settings
## list files
Create Strings as file list: "soundFileObj", "'InDirAudio$'*.wav"
number_of_files = Get number of strings
for i from 1 to number_of_files
selectObject: "Strings soundFileObj"
current_file$ = Get string: 'i'
name_prefix$ = current_file$ - ".wav"
## create intensity tiers
Read from file: "'InDirAudio$''current_file$'"
To Intensity: 40, 0.001, "yes"
Down to IntensityTier
Save as short text file: "'OutDirIntensityTier$''name_prefix$'.IntensityTier"
Remove
selectObject: "Intensity 'name_prefix$'"
Remove
## create pitch object and tier (manually inspect files if selected)
if inspect = 1
selectObject: "Sound 'name_prefix$'"
View & Edit
To Pitch (ac): 0.001, 40, 15, "yes", silenceThr,
...voicingThr, octave, octavejump, voiceunvoiced, pitchmax
View & Edit
pause Confirm
elsif inspect = 0
selectObject: "Sound 'name_prefix$'"
To Pitch (ac): 0.001, 40, 15, "yes", silenceThr,
...voicingThr, octave, octavejump, voiceunvoiced, pitchmax
endif
Save as short text file: "'OutDirPitchObject$''name_prefix$'.Pitch"
Smooth: smooth
Down to PitchTier
Save as short text file: "'OutDirPitchTier$''name_prefix$'.PitchTier"
Remove
## finish and clear
select all
minusObject: "Strings soundFileObj"
Remove
endfor
select all
Remove