-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2_prepareFilesForFA.praat
41 lines (30 loc) · 1.2 KB
/
2_prepareFilesForFA.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
#This script saves textgrids and wave files from the directories specifified.
#This step is done as a transition step when these files are created from R (rPraat) and
#are prepared for MFA alignment
#Author: simon gonzalez ([email protected])
#Run if the TextGrids are to be resaved
directory$ = "/Users/u1037706/Dropbox/TIG2018/languages/eibela/newFiles/alignment_20201707/tgs/"
# read files
Create Strings as file list... list 'directory$'/*.TextGrid
numberOfFiles = Get number of strings
for ifile to numberOfFiles
select Strings list
fileName$ = Get string... ifile
Read from file... 'directory$'/'fileName$'
Save as text file... 'directory$'/'fileName$'
Remove
endfor
#Run if the wavefiless are to be converted
directory$ = "/Users/u1037706/Dropbox/TIG2018/languages/eibela/newFiles/alignment_20201707/audios/"
# read files
Create Strings as file list... list 'directory$'/*.wav
numberOfFiles = Get number of strings
for ifile to numberOfFiles
select Strings list
fileName$ = Get string... ifile
Read from file... 'directory$'/'fileName$'
Convert to mono
Resample... 44100 50
Save as WAV file... 'directory$'/'fileName$'
Remove
endfor