Playing Music

1. Playing Music

    Use the command: 
        Play "mysong.wav"

    To stop it:
        Play empty

    If you want it to play over and over:
        Play "mySong.wav" looping

If the sound playback could not be started, the command will return "could not play sound" in the result.
        Play "song.wav"
        put the result into x
        if x is not empty then
            answer x
        end if

Play the song automatically as the stack as opened and the program starts:
        on openStack
            play "mysong.wav"
        end openStack

Play 2 songs, one after the other
        play "song1.wav"
        wait until the sound is done
        play "song2.wav"

 2. How to add Music and Sound Effects using the "Play" command
        note: not all "wav" or "mp3" files will play - some of them are not made correctly

       Add your voice
            There is a free program called Audacity that you can download and use to record and alter your voice. Make a "wav" file and use it here

            find and import a sound effect ("File", "Import as Control", "Audio File")   -  It has to be a "wav" or "mp3" file 
            add a button and put the following code in it"
                on mouseUp
                        play "firecracker.wav"
                end mouseUp

       Add a sound effect
            find and import a sound effect ("File", "Import as Control", "Audio File")   -  It has to be a "wav" or "mp3" file 
            add a button and put the following code in it"
                on mouseUp
                        play "firecracker.wav"
                end mouseUp

       Add background music to keep playing
            find and import a music file ("File", "Import as Control", "Audio File")   -  It has to be a "wav" or "mp3" file
            add a button and put the following code in it"
                on mouseUp
                        play "ballad.wav" looping
                end mouseUp

       Add a button to stop the music
             add a button "Stop" and put the following code in it"
                on mouseUp
                        play empty
                end mouseUp

   
       Add background music to keep playing
            find and import a music file ("File", "Import as Control", "Audio File")   -  It has to be a "wav" or "mp3" file
            add a button and put the following code in it"

                on mouseUp
                        play "ballad.wav" looping
                end mouseUp


Comments