"Fossies" - the Fresh Open Source Software Archive

Member "speech_tools/testsuite/lpc.sh" (19 Oct 2017, 3689 Bytes) of package /linux/misc/speech_tools-2.5.0-release.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "lpc.sh": 2.4-release_vs_2.5.0-release.

    1 #!/bin/sh
    2 ###########################################################################
    3 ##                                                                       ##
    4 ##                Centre for Speech Technology Research                  ##
    5 ##                     University of Edinburgh, UK                       ##
    6 ##                         Copyright (c) 1999                            ##
    7 ##                        All Rights Reserved.                           ##
    8 ##                                                                       ##
    9 ##  Permission is hereby granted, free of charge, to use and distribute  ##
   10 ##  this software and its documentation without restriction, including   ##
   11 ##  without limitation the rights to use, copy, modify, merge, publish,  ##
   12 ##  distribute, sublicense, and/or sell copies of this work, and to      ##
   13 ##  permit persons to whom this work is furnished to do so, subject to   ##
   14 ##  the following conditions:                                            ##
   15 ##   1. The code must retain the above copyright notice, this list of    ##
   16 ##      conditions and the following disclaimer.                         ##
   17 ##   2. Any modifications must be clearly marked as such.                ##
   18 ##   3. Original authors' names are not deleted.                         ##
   19 ##   4. The authors' names are not used to endorse or promote products   ##
   20 ##      derived from this software without specific prior written        ##
   21 ##      permission.                                                      ##
   22 ##                                                                       ##
   23 ##  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK        ##
   24 ##  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      ##
   25 ##  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   ##
   26 ##  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE     ##
   27 ##  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    ##
   28 ##  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   ##
   29 ##  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          ##
   30 ##  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       ##
   31 ##  THIS SOFTWARE.                                                       ##
   32 ##                                                                       ##
   33 ###########################################################################
   34 SIG2FV=$TOP/bin/sig2fv
   35 SIGFILTER=$TOP/bin/sigfilter
   36 CH_TRACK=$TOP/bin/ch_track
   37 CH_WAVE=$TOP/bin/ch_wave
   38 
   39 DATA=$TOP/lib/example_data
   40 
   41 lpc_test () {
   42 
   43     /bin/rm -f tmp/kdt_001.lpc
   44     /bin/rm -f tmp/kdt_001.res
   45 
   46     echo "LPC params" >&2
   47     echo "LPC params"
   48     $SIG2FV  "$DATA/kdt_001.wav" -o tmp/kdt_001.lpc -otype est -lpc_order 16 -coefs "lpc" -pm "$DATA/kdt_001.pm" -preemph 0.95 -factor 3 -window_type hamming 
   49     $SIGFILTER "$DATA/kdt_001.wav" -o tmp/kdt_001.res -otype nist -lpcfilter tmp/kdt_001.lpc -inv_filter
   50     $CH_TRACK -info tmp/kdt_001.lpc
   51     $CH_WAVE -info tmp/kdt_001.res
   52     # Should not be any of these unless there is an error
   53     grep " 0 " tmp/kdt_001.lpc
   54     grep "NaN" tmp/kdt_001.lpc
   55     grep -i "Infinity" tmp/kdt_001.lpc
   56     
   57 }
   58 
   59 mfcc_test () {
   60 
   61     /bin/rm -f tmp/kdt_001.mfcc
   62 
   63     echo "MFCC params" >&2
   64     echo "MFCC params"
   65     $SIG2FV  -coefs melcep  -delta melcep -melcep_order 12 -fbank_order 24 -shift 0.005 -factor 5.0 -preemph 0.97 -otype est "$DATA/kdt_001.wav" -o tmp/kdt_001.mfcc
   66     $CH_TRACK -info tmp/kdt_001.mfcc
   67         echo "expect one line containing 0s (first delta params)"
   68     numzeros=`grep " 0 " tmp/kdt_001.mfcc | wc -l`
   69     echo "Number of vectors with 0s is " $numzeros
   70 }
   71 
   72 echo >$OUTPUT
   73 
   74 lpc_test 2>&1 >> $OUTPUT
   75 mfcc_test 2>&1 >> $OUTPUT
   76 
   77 exit 0