4. Códigos Scripts (wav2lpc, wav2lpcc, wav2mfcc) (2016)

Pràctica Español
Universidad Universidad Politécnica de Cataluña (UPC)
Grado Ingeniería de Sistemas Audiovisuales - 3º curso
Asignatura Procesado de Audio y Voz
Año del apunte 2016
Páginas 4
Fecha de subida 27/04/2016
Descargas 3
Subido por

Vista previa del texto

Práctica 4: Reconocimiento y Detección del Hablante – Scripts Javier de la Rica wav2lpc.sh #!/bin/bash if [[ $# != 3 ]]; then echo "$0 lpc_order input.wav output.mcp" exit 1 fi # TODO # This is a very trivial feature extraction.
# Please, read sptk documentation and some papers, # and apply a better front end to represent the speech signal lpc_order=$1 inputfile=$2 outputfile=$3 base=/tmp/wav2lpcc$$ # temporal file sox $inputfile $base.raw x2x +sf < $base.raw | frame -l 400 -p 80 | window -l 400 -L 512 |\ lpc -l 400 -m $lpc_order > $base.lp # Our array files need a header with number or cols and number of rows: ncol=$((lpc_order+1)) # lpc p => (gain a1 a2 ... ap) nrow=`x2x +fa < $base.lp | wc -l | perl -ne 'print $_/'$ncol', "\n";'` echo $nrow $ncol | x2x +aI > $outputfile # $4 output file cat $base.lp >> $outputfile \rm -f $base.raw $base.lp Exit Práctica 4: Reconocimiento y Detección del Hablante – Scripts Javier de la Rica wav2lpcc.sh #!/bin/bash if [[ $# != 4 ]]; then echo "$0 lpc_order ncoef input.wav output.mcp" exit 1 fi # TODO # This is a very trivial feature extraction.
# Please, read sptk documentation and some papers, # and apply a better front end to represent the speech signal lpc_order=$1 nceps=$2 inputfile=$3 outputfile=$4 base=/tmp/wav2lpcc$$ # temporal file sox $inputfile $base.raw # $3 => 3rd argument, input.wav x2x +sf < $base.raw | frame -l 400 -p 80 | window -l 400 -L 512 |\ lpc -l 400 -m $lpc_order | lpc2c -m $lpc_order -M $nceps > $base.cep # Our array files need a header with number or cols and number of rows: ncol=$((nceps+1)) nrow=`x2x +fa < $base.cep | wc -l | perl -ne 'print $_/'$ncol', "\n";'` echo $nrow $ncol | x2x +aI > $outputfile cat $base.cep >> $outputfile \rm -f $base.raw $base.cep Exit Práctica 4: Reconocimiento y Detección del Hablante – Scripts Javier de la Rica Wav2mfcc.sh #!/bin/bash if [[ $# != 3 ]]; then echo "$0 mfcc_order input.wav output.mcp" exit 1 fi # TODO # This is a very trivial feature extraction.
# Please, read sptk documentation and some papers, # and apply a better front end to represent the speech signal mfcc_order=$1 inputfile=$2 outputfile=$3 base=/tmp/wav2mfcc$$ # temporal file sox $inputfile $base.raw # $2 => 2rd argument, input.wav sf=$(sox --i $inputfile | grep "Sample Rate" | grep -Po "\d+") sf=$((sf/1000)) x2x +sf < $base.raw | frame -l 400 -p 80 |\ mfcc -l 400 -m $mfcc_order -s $sf > $base.cep #mfcc -l 400 -m $mfcc_order -s $sf - E > $base.cep # Our array files need a header with number or cols and number of rows: ncol=$((mfcc_order)) #ncol=$((mfcc_order+1)) nrow=`x2x +fa < $base.cep | wc -l | perl -ne 'print $_/'$ncol', "\n";'` echo $nrow $ncol | x2x +aI > $outputfile cat $base.cep >> $outputfile \rm -f $base.raw $base.cep exit Práctica 4: Reconocimiento y Detección del Hablante – Scripts Javier de la Rica run_spkid.sh # TODO # Set the proper value to variables: w, db w=/home/labtv/Desktop/Lab4/p4-sr/Work; db=/home/labtv/Desktop/Lab4/p4-sr/speecon; # TODO: select (or change) different features, options compute_mcp() { for line in $(cat $w/lists/all.train) $(cat $w/lists/all.test); do mkdir -p `dirname $w/mcp/$line.mcp` echo "wav2mfcc 24 16 $db/$line.wav" "$w/mcp/$line.mcp" #wav2lpcc 4 8 "$db/$line.wav" "$w/mcp/$line.mcp" || wav2mfcc 24 "$db/$line.wav" "$w/mcp/$line.mcp" || exit 1 done } # TODO gmm_verfy --> put std output in $w/spk_verify.log, ej gmm_verify .... > $w/spk_verify.log or gmm_verify ... | tee $w/spk_verify.log gmm_verify -d $w/mcp -e mcp -D $w/gmm/mcp -E gmm $w/lists/gmm.list $w/lists_verify/all.test $w/lists_verify/all.test.candidates | tee $w ...