Skip to content

Instantly share code, notes, and snippets.

@erzk
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erzk/b3a88b9322d2a33458ab to your computer and use it in GitHub Desktop.
Save erzk/b3a88b9322d2a33458ab to your computer and use it in GitHub Desktop.
Annotates and splits a continuous wav file using Speech Filing System
REM define the working directory
set location=%cd%
REM define the participant
set participant=NAME
REM define the trial
set trial=01
REM define the condition
set condition=FAF-Up
REM define the file name, e.g. 01-NAME-FAF-Up.wav
set filename=%trial%-%participant%-%condition%
REM transform wav files into sfs
cnv2sfs -i 1 %filename%.wav %filename%.sfs
REM define the number of annotations
set number_annotations=65
REM label the stem for annotations
set stem=aaa
REM create annotations http://www.phon.ucl.ac.uk/resource/sfs/help/man/npoint.htm
npoint -n %number_annotations% -l %stem%-%participant%-%trial%-%condition% %filename%.sfs
REM export annotations to a csv file
anlist %filename%.sfs -C > %filename%.csv
REM split the continuous wav file into short wav files based on the delimiters created by npoint
wordchop -d %location%\%trial%\ %filename%.sfs
REM transform all split sfs files in the specified folder into wav files and delete sfs files
FOR /R %location%\%trial%\ %%A IN (*.sfs) DO (
sfs2wav "%%A"
del "%%A")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment