Scripting Sound in Director Using Lingo TO ADD A SOUND TO FRAMES (A BACKGROUND SOUND) Put the sound in the sound channel of the frame(s) TO ADD A SOUND TO A BUTTON (OR ON AN EVENT OF SOME KIND) on mouseEnter puppetSound 1, "soundmembername" end This initiates the sound on the rollover and plays it in sound channel 1. In each of the examples, the number “1” stands for the Sound Channel. If you wished to have the sound play (or stop) in sound channel 2, then change this number to 2. TO STOP SOUNDS puppetSound 1, 0 or sound stop 1 TO FADE IN OR FADE OUT A SOUND sound fadeIn 1 sound fadeout 1 TO CHECK IF A SOUND IS CURRENTLY PLAYING BEFORE PLAYING A NEW SOUND if soundBusy(1) then go to the frame else puppetSound 1, "soundmembername"\ end if ANOTHER WAY TO PLAY A SOUND sound(1).play (member "soundmembername") TO PAUSE A SOUND sound(1).pause() TO CHANGE THE VOLUME OF A SOUND the volume of sound 1 = 130 Sound ranges in volume from 0 (mute) to 255 (highest). 130 would be a medium volume. TO PAN A SOUND FROM LEFT TO RIGHT OR SET A SOUND TO THE LEFT OR RIGHT SPEAKER Pan indicates the left/right balance of the sound playing in the sound channel. The range of values is from –100 to 100. -100 indicates only the left channel is heard. 100 indicate only the right channel is being heard. A value of 0 indicates even left/right balance, causing the sound source to appear to be centered. For mono sounds, pan affects which speaker (left or right) the sound plays through. repeat with x = -100 to 100 the pan of sound 1 = x end repeat The above example pans the sound from left to right. the pan of sound 1 = 100 This example sets the sound to only the right side. |