欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

demosound

LastWave
字号:
############################################################################## Demo file for the sound package#############################################################################setproc DemoSound {} "{{{} {This is a demo that teaches you how to deal with sounds. \n\You should first run the 'DemoSignalDisp' demo. \n\WARNING FOR UNIX USERS ONLY : \IN ORDER TO RUN THIS DEMO YOU MUST FIRST CONFIGURE THE SOUND SYSTEM. TO LEARN HOW TO DO IT \JUST TYPE 'sound play'}}}" {  StartDemo DemoSound}setproc _DemoSound0 {} {  s = [new &signal]    # Reading a sound (aiff format)  global _scriptDirectory  _scriptDir = _scriptDirectory[0]  sound read s _scriptDir+'/sound/sounds/clara.aiff16'  # Display it  disp Clara s   import args 1 System    printf "ADVICE : if you have not run it, you should run the Demo 'DemoSignalDisp' first ...\n\n"  printf "\nIf you want to learn how these graphs were generated look at the procedure \'_DemoSound0' in the file 'scripts/sound/DemoSound'\n"}setproc _DemoSound1 {} {printf "You can try the different mouse cursor modes on the graphs of the signals \just hitting the 'c' key while the mouse pointer being in the graphs(there are 3 modes : none, cross-hair (follow the pointer), cross-hair1 (follow the curve))\n."}setproc _DemoSound2 {} {printf "You can zoom the signal : use the left and right buttons to zoom in and the middle one to zoom out. \You can change the zoom mode by hitting the 'z' key over any graph.  \n\There are 3 modes : default (just described above), rect (just use the left button and \do a drag and drop), the y-constrained rect mode (same as rect but the height of the rectangle \is constrained).\n"}setproc _DemoSound3 {} {printf "You can play the signal by just hitting 'shift+tab' while the mouse is being over the signal. \n\If it does not work it means that the 'shift+tab' key combination is redirected by your \window manager... so you cannot use it. You can then try the 'escape' key (both 'shift+tab' and \'escape' have been assigned to play a displayed signal). \n\If it still does not work you can assign this function to any other key, just look in the file \n\     'script/sound/sound.pkg' \n\and look for the line \n\     setbinding playSelectSignal GraphSignal keyDown {{shift tab}} _PlayAllGraphSignal \n\just change it (to assign it to the 'p' key for instance) to \n\     setbinding playSelectSignal GraphSignal keyDown {p} _PlayAllGraphSignal\n"}setproc _DemoSound4 {} {printf "Do you remember that to know what you can do interactively on a graphic object you can type 'b' ? \A help window should pop up. To delete it just hit 'b' again. \n\As explained in this help window .... \n\You can select a part of the signal and play it. For that purpose, select the portion you want to hear \by just dragging the mouse with the left button and the ctrl key down. \The selected region is shown as a grey rectangle (a graphic object of class RectSelect) \n\To play this portion just hit the 'tab' key. \n\Note that since the selection is a graphic object it will always be displayed even when you \zoom in or out the signal. The height of this object will automatically adapted to the \amplitude of the signal. \n\If you draw another selection the previous one will be erased.  \n\In order to erase the selection just click the left button while the 'ctrl' key is down. \n\In order to have several selections just use the right button instead of the left one. \n\If several selections are displayed, in order to indicate which one should be played \when hitting the 'tab' key, you must put the mouse inside one of them and just hit the 'tab' key.\n"}setproc _DemoSound5 {} {printf "When the mouse comes close to the border of a selection, it is 'activated' : the borders become thicker. \When a selection is activated, using the left mouse button along with the 'ctrl' key you can edit \the vertical borders (for that purpose you must put the mouse close to an horizontal border)  \or move the whole selection (for that purpose you must put the mouse close to \an horizontal border).\n"}setproc _DemoSound6 {} {printf "You can make an 'aiff' file of this sound or of a portion of this sound. Just zoom in till the part \of the sound you want to extract is displayed. Then use the 'sget' script command to extract this \portion into a signal : \n\        signal = [sget ..1] \n\(the '..1' is a reference to the graphic object that displays the signal). \n\After you have typed in this command the 'sig' signal contains the portion of the sound you want. \If you want to make an aiff file of it (using 16 bits) just type \n\        sound write sig file.aiff16 \n\(Let us note that the sampling frequency of the signal is given by the 'dx' field of the signal.) \n\The name of the format in the last command is given by the suffix 'aiff16'.  \n\To learn about all the other formats that are available just type \n\        sound format \n"}setproc _DemoSound7 {} {printf "Using the same command 'sound format', you can associate new names to these formats and use them as suffices for files. \This is particularly convenient for raw formats. For instance if you want the string 'mysnd' to refer \to a raw format using 16bits, little endian, sampling rate of 22050Hz and a single channel, you would type \(the best thing would be to put it in the startup file so that the new format is defined at each runtime) : \n\         sound format mysnd raw16_le_22050_1 \n\then to write a sound using this format you would simply type \n\         sound write sig file.mysnd \n\WARNING : this will not work unless the signal 'sig' has the right 'dx' corresponding to the sampling rate 22050. \You can set the 'dx' field by typing before the last command \         sig.dx = 1/22050\n\For reading this file, you do not need to specify anything (all the parameters are given by the '.mysnd' suffix) : \n\         sound read sig file.mysnd \n"}help DemoSoundsetproc DemoMPSound {} "{{{} {WARNING : YOU SHOULD FIRST RUN THE DEMO 'DemoSound' OF THE SOUND PACKAGE AND THE DEMOS 'DemoMPRegAlgo' \and 'DemoMPFastAlgo' OF THE MP PACKAGE \BEFORE RUNNING THIS DEMO. Demo command that performs the matching pursuit of a piano sound and that teaches you \the sound capabilities of the 'mp' package. This demo involves computation that can involve 2-3 minute computations. \This demo is also included in the 'mp' package. \Warning : This demo uses a lot of memory, thus, if you are running on a Macintosh, \you should allocate at least 20Mo to LastWave before running it.}}}" {  import args m  import args objCur## Set the current book (structure that stores the result of a# Matching Pursuit decomposition) to 'm'#  m    global _scriptDirectory  _scriptDir = _scriptDirectory[0]  sound read 0 _scriptDir+'/sound/sounds/piano.aiff16'  printf "Computing the first 300 atoms of the matching pursuit....\n"  printf "(It can take a few minutes .... be patient......)\n"  mpd 300 :: >  printf "Done!\n"    disp mp1 0m m -title "Matching Pursuit of a piano sound" -pos 20 238  -..2 -db 1 -expo 50 -..fv2 -title "Time Frequency Representation" -..fv1 -title "The piano sound"     echo   echo THESE ARE THINGS THAT YOU CAN DO :  global System  if (System == 'mac') {  echo   echo (NOTE : For mac users who are using a single button mouse, this button   echo corresponds to the left button. The middle (resp right) button is accessed   echo by holding down the option(or alt)  key (resp. cmd key ) while pressing   echo the mouse button.)  echo  }  echo  echo 0- Note that the matching pursuit allows to get very sharp details both in frequency and time !  echo  echo 1- You can play the piano sound by just hitting 'shift+tab' while the mouse being over the signal.   echo    (on this signal, you can of course perform whatever you were taught in the 'DemoSound' Demo  echo    of the 'sound' package).  echo  echo 2- You can zoom any matching pursuit representation : use the left button and drag and drop to zoom   echo    in and the middle one to zoom out.  echo    You can change the zoom mode by hitting the 'z' key over any graph.   echo    There are 2 modes : default (just described above),   echo    the y constrained-rect mode (the ordinate are constrained).  echo    echo 3- When an atom is circled (run other 'mp' demos to learn how to do so)   echo    you can hear this atom by hitting the '=' key. The '<' key allows to hear  echo    the reconstruction using all the atoms up to the one circled (included)  echo    and the '>' allows to hear the reconstruction using all the atoms from  echo    the one that is circled (excluded).  echo    You should play around listening to harmonic atoms or atoms of the attack of the sound   echo    or at the end (low frequency).  echo }help DemoMPSound

⌨️ 快捷键说明

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