-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathSave_Channel_Sound_Files.Praat
37 lines (34 loc) · 1.14 KB
/
Save_Channel_Sound_Files.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
# This Praat script will select one channel of two seperat channels' sound files in a given directory
# and save files to another directory.
# (See the Praat manual for details on Channels.)
#
# This script is distributed under the GNU General Public License.
# Copyright 2020.08.20 feelins[[email protected]]
form ReSample sound files
comment Directory path of input files:
text input_directory wavs_2_channels/
comment Directory path of output files:
text output_directory wavs_1_channel/
endform
if (praatVersion < 6001)
printline Requires Praat version 6.0 or higher. Please upgrade your Praat version
exit
endif
createDirectory: output_directory$
Create Strings as file list: "fileList", input_directory$ + "*.wav"
numberOfFiles = Get number of strings
for ifile from 1 to numberOfFiles
selectObject: "Strings fileList"
fileName$ = Get string: ifile
Read from file: input_directory$ + fileName$
objectName$ = selected$("Sound", 1)
View & Edit
Convert to mono
Save as WAV file: output_directory$ + objectName$ + ".wav"
Remove
selectObject: "Sound " + objectName$
Remove
endfor
selectObject: "Strings fileList"
Remove
exit Done!