showensemble

来自「speech signal process tools」· 代码 · 共 524 行 · 第 1/2 页

TXT
524
字号
     #--------------------------------------------------------------------     #  Start the process of displaying the ensemble $BASENAME.     #     #  Check that the file $SPEECH exists and is readable.     #  If it is readable, display $SPEECH and try to display the other     #  components of the ensemble: $F0 and $SPECT.     #  If it doesn't exist or isn't readable, don't try to display it or      #  the other components of the ensemble.      #--------------------------------------------------------------------     if test -f $SPEECH      then          #---------------------------------------------------------------          #  Display the speech waveform file $SPEECH.          #---------------------------------------------------------------          echo "     "          echo "     Displaying ensemble \"$BASENAME\"."          echo "     Displaying speech waveform file \"$SPEECH\"."          send_xwaves make name $BASENAME file $SPEECH \	                   loc_x $SPEECH_X loc_y $SPEECH_Y \                           height $SPEECH_HEIGHT width $SPEECH_WIDTH            #---------------------------------------------------------------          #  Display the label files $BASENAME.words and $BASENAME.phones.          #          #  The labeller xlabel and its label files are linked to the           #  first loaded signal file, in this case $SPEECH.          #---------------------------------------------------------------          #  This sets up two label files.  If you want to have more than          #  two label files, add them here.            #  Note:  The most recently loaded label files are displayed          #  at the top of the xlabel window.          #  I.e., $BASENAME.phones is above $BASENAME.words           #  in the xlabel window.          send_xwaves send function xlabel op xlabel make name $BASENAME \                           signal $SPEECH file $BASENAME.words \                           color $LABEL_COLOR menufile $WORDSMENU           send_xwaves send function xlabel op xlabel make name $BASENAME \	                   signal $SPEECH file $BASENAME.phones \                           color $LABEL_COLOR menufile $PHONESMENU           #---------------------------------------------------------------          #  Display the fundamental frequency signal file $F0 if the          #  file exists.  Otherwise compute it and then display it.          #          #  Also define which fields of the f0 file $F0 to display.            #  For f0 files computed with "get_f0", the field numbers are:          #  0 = f0, 1 = prob_voice, 2 = rms, 3 = ac_peak          #---------------------------------------------------------------          if test -f $F0          then               echo "     Displaying f0 file \"$F0\"."          else               echo "     "               echo "     WARNING:"               echo "     The f0 file \"$F0\" was not found."               echo "     Computing it now with the command:"               echo "            get_f0 $SPEECH $F0"               get_f0 $SPEECH $F0          fi          send_xwaves make name $BASENAME file $F0 \                           loc_x $F0_X loc_y $F0_Y height $F0_HEIGHT           send_xwaves $BASENAME activate file $F0 op set numbers "0"           #---------------------------------------------------------------          #  Display the spectrogram file $SPECT if it exists.           #  Otherwise compute it and display the wideband spectrogram.           #---------------------------------------------------------------          if test -f $SPECT          then               echo "     Displaying spectrogram file \"$SPECT\"."               send_xwaves make name $BASENAME file $SPECT \                           loc_x $SPECT_X loc_y $SPECT_Y height $SPECT_HEIGHT               send_xwaves $BASENAME colormap threshold $SPECT_THRESHOLD \                           range $SPECT_RANGE          else               echo "     "               echo "     WARNING:"               echo "     The spectrogram file \"$SPECT\" was not found."               echo "     Computing and displaying it now.  Please wait."               send_xwaves $BASENAME spectrogram file $SPEECH \                           loc_x $SPECT_X loc_y $SPECT_Y height $SPECT_HEIGHT \                           threshold $SPECT_THRESHOLD range $SPECT_RANGE             fi          #---------------------------------------------------------------          #  Time align all displayed files with the waveform $SPEECH.          #---------------------------------------------------------------          echo "     Time aligning all windows in ensemble \"$BASENAME\"."          send_xwaves $BASENAME align file $SPEECH      # else of "if test -f $SPEECH"     else           echo "     "          echo "     WARNING:"          echo "     Speech waveform file \"$SPEECH\" was not found."          echo "     Can't display the ensemble \"$BASENAME\"."     # fi of "if test -f $SPEECH"     fi      #--------------------------------------------------------------------     #  The shell interaction to continue ('c') or quit ('q') the script.     #  after an ensemble $BASENAME from the list of arguments has been     #  displayed in its entirety.     #--------------------------------------------------------------------     echo "     "     echo "     Type continuation command ('c' or 'q' only)."     echo "     'c' to continue to next ensemble, or 'q' to quit: \c"     LOOKING_FOR_CONTINUE_COMMAND=true     read cont_command     while "$LOOKING_FOR_CONTINUE_COMMAND" = "true"     do        case $cont_command in             c) echo "     ";                echo "     Continuing to next display ensemble.";                LOOKING_FOR_CONTINUE_COMMAND=false;                export LOOKING_FOR_CONTINUE_COMMAND;                send_xwaves kill name $BASENAME;;             q) echo "     ";                echo "     Quitting from displaying ensembles.";                echo "     ";                #---------------------------------------------------------                #  To remove or not remove spectrogram files?                 #                #  (This is the same as the quitting section at the end,                #   but the indent formatting is somewhat violated here.)                #---------------------------------------------------------                if test -z "`send_xwaves get aname new_files | grep '.fspec'`"                then                     echo "     "                else                 echo "     Do you want to remove the following"                 echo "     spectrogram files created during this session?"                 echo "       `send_xwaves get aname new_files | grep '.fspec'`"                     echo "     Answer 'y' for yes, 'n' for no: \c"                     LOOKING_FOR_YES_NO_CHARACTER=true                     read yes_no_character                     while "$LOOKING_FOR_YES_NO_CHARACTER" = "true"                     do                        case $yes_no_character in                            y) LOOKING_FOR_YES_NO_CHARACTER=false;                               export LOOKING_FOR_YES_NO_CHARACTER;               echo "     Removing spectrogram file(s) created this session:";               echo "       `send_xwaves get aname new_files | grep '.fspec'`";               rm -f `send_xwaves get aname new_files | grep '.fspec'`;;                            n) LOOKING_FOR_YES_NO_CHARACTER=false;                               export LOOKING_FOR_YES_NO_CHARACTER;               echo "     Saving spectrogram file(s) created this session:";               echo "       `send_xwaves get aname new_files | grep '.fspec'`";;                            *) LOOKING_FOR_YES_NO_CHARACTER=true;                                export LOOKING_FOR_YES_NO_CHARACTER;                                echo "     ";               echo "     WARNING:  Command \"$yes_no_character\" unknown.";               echo "     Please try again.  Enter 'y' or 'n': \c";                               read yes_no_character;;                        esac                     done                fi                #---------------------------------------------------------                #  Started with xwaves running or not?                #---------------------------------------------------------                LOOKING_FOR_CONTINUE_COMMAND=false;                export LOOKING_FOR_CONTINUE_COMMAND;                if "$STARTED_WITH_XWAVES" = "true"                then                     echo "     Closing ensemble \"$BASENAME\"."                     echo "     "                     send_xwaves kill name $BASENAME                else                     echo "     Quitting xwaves."                     echo "     "                     send_xwaves quit                fi                exit 0;;             *) echo "     ";                echo "     WARNING:  Command \"$cont_command\" unknown.";                echo "     Please try again.  Enter 'c' or 'q': \c";                LOOKING_FOR_CONTINUE_COMMAND=true;                export LOOKING_FOR_CONTINUE_COMMAND;                read cont_command;;        esac     #done of "while "$LOOKING_FOR_CONTINUE_COMMAND" = "true""     done # done of "for BASENAME in $*"done#-------------------------------------------------------------------------#  No more arguments of script left so:#     1.  Remove spectrograms created during this session.#     2.  Quit xwaves if script was used to start up xwaves.  #         If xwaves was already running before the script was #         started then don't quit xwaves.#-------------------------------------------------------------------------echo "     "echo "     No more ensembles to display."echo "     "if test -z "`send_xwaves get aname new_files | grep '.fspec'`"then     echo "     "else     echo "     Do you want to remove the following"     echo "     spectrogram files created during this session?"     echo "       `send_xwaves get aname new_files | grep '.fspec'`"     echo "     Answer 'y' for yes, 'n' for no: \c"     LOOKING_FOR_YES_NO_CHARACTER=true     read yes_no_character     while "$LOOKING_FOR_YES_NO_CHARACTER" = "true"     do        case $yes_no_character in            y) LOOKING_FOR_YES_NO_CHARACTER=false;               export LOOKING_FOR_YES_NO_CHARACTER;               echo "     Removing spectrogram file(s) created this session:";               echo "       `send_xwaves get aname new_files | grep '.fspec'`";               rm -f `send_xwaves get aname new_files | grep '.fspec'`;;            n) LOOKING_FOR_YES_NO_CHARACTER=false;               export LOOKING_FOR_YES_NO_CHARACTER;               echo "     Saving spectrogram file(s) created this session:";               echo "       `send_xwaves get aname new_files | grep '.fspec'`";;            *) LOOKING_FOR_YES_NO_CHARACTER=true;               export LOOKING_FOR_YES_NO_CHARACTER;               echo "     ";               echo "     WARNING:  Command \"$yes_no_character\" unknown.";               echo "     Please try again.  Enter 'y' or 'n': \c";               read yes_no_character;;        esac     donefiif "$STARTED_WITH_XWAVES" = "true"then     echo "     "else     echo "     Quitting xwaves."     echo "     "     send_xwaves quitfiexit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?