#!/bin/sh # # USAGE: seq2script textgridDIR audioDIR audioextension CASE # # From STDIN: # lines of the form # FILE STARTTIME ENDTIME # # This version does not use "long sound file" stuff # if [ "$#" -ne 4 ]; then echo -e "USAGE: seq2script textgridDIR audioDIR audioEXT CASEID" echo -e "\tFrom STDIN -- lines of the form\n\t\tFILEBASE STARTTIME ENDTIME" exit 1 fi # DIR=`pwd` CASE=$4 gawk -v notes="$CASE".praatnotes -v TGDIR=$1 -v AUDIR=$2 -v AUEXT=$3 ' BEGIN { FILE="nil" # used to be collar=0.1 collar = 0.25 counter=1 } { # start of line loop NEWFILE=$1 if(NEWFILE != FILE){ if(FILE != "nil"){ printf("removeObject: sound\n") printf("Write to short text file: \"%s/%s_a.TextGrid\"\n", TGDIR,FILE) printf("removeObject: textgrid\n") } FILE=NEWFILE printf("sound = Read from file: \"%s/%s.%s\"\n", AUDIR,FILE,AUEXT) printf("textgrid = Read from file: \"%s/%s.TextGrid\"\n", TGDIR, FILE) printf("selectObject: sound, textgrid\nView & Edit\n") # or maybe "editor: " here? Fuck Praat... } printf("editor: \"TextGrid %s\"\n", FILE) START1 = $2; END1 = $3; DURATION= END1-START1 starttime = START1 + 0.0125 - collar # maybe not 0.0125 to allow for aligner frame size? endtime = END1 + 0.0125 + collar printf("Zoom: %g, %g\n",starttime, endtime) printf("endeditor\npauseScript: \"(%d) Click to continue\"\n", counter) printf("%d %s %.3f %.3f \n", counter, FILE, starttime, endtime) > notes counter++ } # end of line loop END { printf("removeObject: sound\n") # printf("Write to short text file: \"%s_a.TextGrid\"\n", FILE) printf("removeObject: textgrid\n") }' >"$CASE".praat # echo "script in " $CASE.praat " -- you can add notes to " $CASE.praatnotes #