Using sounds in your page
Using sounds in your page
This is a very brief introduction to the use of sounds in Web pages. Only sound files that can be played by modern browsers, without helper applications, are covered here.
Sound file formats
See the Wikipedia for an overview of the various sound file formats, and this comprehensive list of audio file formats. The impact of MP3 on the Internet cannot be ignored. You can also read more about audio resources on the Web Resources for Web Workers. We are only concerned in this tutorial with three types of file formats:
- Riff waveform - .wav files used by Microsoft Windows.
- SGI/Apple sound - .aiff or .aif
- MPEG-1 Audio Layer 3 - .mp3
Both are supported by internal sound players in Firefox and Internet Explorer.
This tutorial will also not cover how to acquire existing sound files to use in your Web page. For sources in this topic and a collection of sound files in the Web go to the Sites with audio clips. You can use Switch basic free edition to convert between various sound formats.
Windows
Recording sounds
Your system needs to have a sound card for you to be able to record sounds, in addition to a microphone, in the case of voice sounds. See an example clicking in the button.
Recording sounds with a microphone is simple. Open the sound recorder application that comes with Windows, click on the microphone button and record the sound.
Including sound files in HTML
Including your sound file in HTML is like including any other link. For example, this HTML code:
<a href="homer.mp3">homer</a> will play the homer.mp3 sound file (converted from wav in Windows) when you click on the word homer, as shown here: homer.
This method is called pseudo-streaming, because your player start playing the sound file as it is downloaded. But actual sound or video streaming can only be obtained by installing a Streaming Server, such as the Real Helix Server.
This page is maintained by Al Bento
who can be reached at abento@ubalt.edu. This page was last updated on February 22, 2010. Although we will attempt to keep this information accurate, we can not guarantee the accuracy of the information provided.