HTML and CSS Reference
reverse, etc. After editing a sound, you export it to the sound format you would like to
create. In our case, that would be .ogg , .wav , and .mp3 .
We don't have the space here to fully describe how to use an audio tool
like Audacity, but we do need to give you one caveat: the distributed
version of Audacity does not support the export of audio in the .mp3
format. To export .mp3 audio, you will need to download the
open source project.
Figure 7-2. Editing an audio file in Audacity
Example: Using All Three Formats
In Example 7-2 , we are going to embed a 40-second song, song1 , in an HTML5 page
and play it. To make sure song1 can play in as many browsers as possible, we are going
to embed it with three different sources. For this example, we are also going to set the
autoplay , loop , and controls properties so the song will start automatically, replay
when it reaches the end, and display the default browser audio controls. Here is the
code to embed song1 :