Make your own free website on Tripod.com
cONTROLLING sOUND
What we'll do out here is use Javascript to control sound. LiveAudio exposes a number of functions which one can use to control sound. Listed below r a few examples showing how u could do that. Well for starters lets play the sound.

Play the sound now!

Ok...it's a stupid little doorbell playing.. Now stop it!!!

Stop the sound now!

Increase the volume.

Increment the Volume!

Decrease the volume

Decrement the Volume!

Well cool isn't it....:-) Right on. Now lets see how this is possible.
This is the code to play the sound...

<A HREF="javascript:playsound()">Play the sound now!</A>

Ok! What we have here is a plain old link which calls a Javascript function called playsound(). and the playsound function is ....

 function playsound1()
                {
                document.firstsound.play(false);
                }

all it does is calls the play() function which plays the sound associated with the "firstsound" object.
Well about the other links....
Here they are i.e their source....

Now stop it!!!

<A HREF="javascript:stopsound()">Stop the sound now!</A>

Increase the volume.

<A HREF="javascript:volup()">Increment the Volume!</A>

Decrease the volume

<A HREF="javascript:voldown()">Decrement the Volume!</A>

To increase or decrease the volume we use the setvol() function. Which allows u to increase or decrease the volume of sound being played.
e.g. document.firstsound.setvol(10)
This value must be a number between 0 and 100 to represent 0 to 100 percent.
To stop sound we use the stop() function.
e.g. document.firstsound.stop()
That's all.
Here are 2 links which u should find useful
1.refrence to live audio.
2.sample scripts.



This page is maintained by Sanjay Shetty.
Send mail to sanjay@dbsindia.com.

U R visitor no .