TIFFANY HOLMES>SOUND AND LINGO>SPRING04>HANDOUT 3

 

EVENTS>Examples of event handlers>You want to play a sound when the user clicks a button:

on mouseup

            puppetsound ÒlaserÓ

end

 

SOUND PROPERTIES>Examples>volume, loop, pan

 

NOTE: Sound channels are not sprite channels.  There are a total of 8 sound channels in DirectorÑonly two are visible to the eye.

 

Examples: Setting sound properties using dot syntax

sound(2).volume = 130  --255 is loudest, 0 is silent

sound(6).loop=true   --true means play the sound as a loop

sound(3).pan=100  --play sound only out of right speaker, 0 is even balance, and Ð100 is left speaker only

 

COMMANDS: puppetsound (best for internal sounds), playfile (best for linked sound files)

Examples: This statement plays the file named Thunder in channel 1:

sound playFile 1, "Thunder.wav"      OR              Puppetsound 1, ÒThunder.wavÓ

 

This statement stops the sound playing in channel 1:

sound(1).stop()              OR              puppetSound 1, 0

 

Example: This Lingo fades in sound channel 3 over a period of 3 seconds from the beginning of cast member introMusic2:

 

sound(3).play(member("introMusic2"))

sound(3).fadeIn(3000)

 

Example: The following statement changes the volume of sound channel 4 to 150 over a period of 2 seconds. It can be a fade up or a fade down, depending on the original volume of sound channel 4 when the fade begins.

 

sound(4).fadeTo(150, 2000)

 

Example: This Lingo pans the sound in sound channel 2 from the left channel to the right channel:

 

repeat with x = -100 to 100

   sound(2).pan = x

end repeat

 

CONDITIONALS>Basic structure

if Ðsomething is trueÑthen DO SOMETHINGÑexecute lingo command

 

Example: This statement checks whether a sound is playing in sound channel 1 and loops in the frame if it is. This allows the sound to finish before the playhead goes to another frame.

 

if soundBusy(1) then go to the frame

 

FUNCTIONS: A word or phrase that returns a specific number.  I.E: random(), soundbusy.

 

SoundBusy is a function that returns true or false, is a sound playing in a specific channel or not?  See example of its use under conditional statements.