You can put a sound in a webpage using the embed
tag, as demonstrated
in this page. Also, once the sound is in the page, you can control it from javascript
with functions like Play()
and Stop()
. Combine those with
some clever setTimeout
's and you've got a 'synthesizer'.
Ok, I know as a synthesizer this isn't exactly full featured, but it gets the point across.
Hint #1: Sounds should be in the wav, mp3 or midi file formats. Wav seems to be the best bet in terms of portability (Firefox doesn't like playing mp3s for some reason) but they are HUGE files in comparison to mp3. Midi is more for full lenth music type stuff than audio recordings, but it's really up to you which format you use. (I've used mp3 to cut down on file size).
Hint: Sounds should be longer than the longest duration you wish to play them for, since there is an ugly clicking noise when the sound is completed and wraps around to loop. For example, the longest we play sounds in this page is 10 seconds, and all the sounds are recorded at 15 seconds long.
Play for A for one second