#visualise_tokens.praat
#this script could be usefull if you want to inspect particular tokens (e.g. outliers)
#export the tokens you want to inspect to a 2 column csv file. col.1 header must be "sound_file" ; col.2 header must be "time_marker"
#the script will loop through each wavefile found in col.1 and will move the cursor to the desired time marker found in col.2
#note that the script can be easily improved by :
#1) allowing you to choose whatever col header you want (so that you don't have to name them sound_file and time_marker)
#2) doing some IMPORTANT checks!!! Right now it assumes your wavefiles and associated textgrids DO exist and are placed in the same directory
#3) allowing you to save the changes you would like to your textgrids
#4) predicting the jackpot for the next Big Wednesday lottery (man, how cool would that be?)
#THIS IS JUST A QUICK AND DIRTY SCRIPT, IT IS PROVIDED FOR VISUALISATION PURPOSES ONLY
form Arguments
comment Give the directory of the sound files:
sentence Directory /home/romain/Doctorat/experiences/transfer_of_position/expe_2011/french/data/
comment Give the name of the input csv file:
word InputFile /home/romain/Desktop/all/outliers.csv
endform
Read Table from comma-separated file... 'InputFile$'
Rename... table
select Table table
numF=Get number of rows
for i from 1 to 'numF'
select Table table
fileName$=Get value... i sound_file
target=Get value... i time_marker
utt$=fileName$-".wav"
Read from file... 'directory$''fileName$'
pathTG$=directory$+utt$+".TextGrid"
Read from file... 'pathTG$'
Rename... 'utt$'
utt$ = replace$(utt$, " ", "_", 0)
select Sound 'utt$'
plus TextGrid 'utt$'
Edit
editor TextGrid 'utt$'
Move cursor to... 'target'
endeditor
pause Click [Continue] to move on to the next soundfile or [Stop] to stop the script
select Sound 'utt$'
plus TextGrid 'utt$'
Remove
endfor
select Table table
I use this blog as a sort of memo or notes to myself. It's mainly code that I have been using during my PhD thesis and that I hope other people could find useful as well. I gathered and borrowed pieces of code from various sources to answer what seemed simple and trivial problems at first, and which turned out to be a pain! So here are a few tips and tricks.
Monday, 25 June 2012
a PRAAT script
You probably have your own routines to check the outliers coming from PRAAT textgrids. I didn't have one so far, so here is a very quick and dirty hack that does the job for me, in case someone would find it useful :
Subscribe to:
Comments (Atom)