Skip to content

Instantly share code, notes, and snippets.

@psibre
Created March 22, 2017 15:16
Show Gist options
  • Save psibre/db6d869063487c407dfaec60cf195b41 to your computer and use it in GitHub Desktop.
Save psibre/db6d869063487c407dfaec60cf195b41 to your computer and use it in GitHub Desktop.
align TIMIT prompts and TextGrid with beeps
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