Created
March 22, 2017 15:16
-
-
Save psibre/db6d869063487c407dfaec60cf195b41 to your computer and use it in GitHub Desktop.
align TIMIT prompts and TextGrid with beeps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select all | |
nocheck Remove | |
clearinfo | |
# timit.txt contains all TIMIT prompts (without comments!) | |
# utterances.TextGrid contains all utterances, speech intervals must not be empty | |
timit = Read Strings from raw text file... timit.txt | |
tg = Read from file... utterances.TextGrid | |
snd = Open long sound file... group1.flac | |
plus tg | |
View & Edit | |
t = 0 | |
select tg | |
ni = Get number of intervals... 1 | |
for i to ni | |
label$ = Get label of interval... 1 i | |
if label$ != "" | |
t += 1 | |
select timit | |
prompt$ = Get string... t | |
code$ = replace_regex$(prompt$, ".+\((s.\d+)\)$", "\1", 1) | |
select tg | |
Set interval text... 1 i 'code$' | |
endif | |
endfor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment