-
Notifications
You must be signed in to change notification settings - Fork 32
/
normalize_amplitude.praat
33 lines (27 loc) · 900 Bytes
/
normalize_amplitude.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
# Amplitude Matcher
# Will Styler - 2008, 2015
#
# This Praat script will create amplitude normalized stimuli in WAV format and save to a new directory
form Normalize Amplitude in sound files
comment Sound file extension:
optionmenu file_type: 2
option .aiff
option .wav
comment What amplitude do you want to set to?
positive amplitude 70
endform
directory$ = chooseDirectory$ ("Choose the directory containing sound files and textgrids")
directory$ = "'directory$'" + "/"
Create Strings as file list... list 'directory$'*'file_type$'
number_files = Get number of strings
for ifile to number_files
select Strings list
sound$ = Get string... ifile
Read from file... 'directory$''sound$'
objectname$ = selected$ ("Sound", 1)
Scale intensity... 'amplitude'
Write to WAV file... 'directory$''objectname$'_'amplitude'dB.wav
Remove
endfor
select Strings list
Remove