Sound in HTML

There are many problems with trying to include sound with HTML. The biggest, as usual, is bandwidth. Sound files as sourced from CD audio are HUGE. Using 10 Meg/min for stereo waves sampled at 16 bit, 44.1 kHz. The approach to this problem has a huge financial value attached to it, and this has led to a proliferation of standards.

During the past two years standards and specifications have developed from the original 1 bit quality of TrueSpeech compression - clicking on the Unternet tab in the menu frame will play an example from the Unternet Busker using TrueSpeech compression. This quality was all that was available to the busker at the time. Using an old 386 SX25 Real Audio was unavailable, and the TrueSpeech system allowed the creation of compressed audio on a system that could not replay it. However, you will agree that this is VERY poor quality - really only designed for speech and not music. There is a major advantage with TrueSpeech - it is incorporated in Win95 and any PC user with audio will be guaranteed to hear the file. Other standards require software or CODEC (COmpression/DECompression) drivers to be installed. Apple users can download TrueSpeech players for their systems..

With the upgrade to Win95 the possibility of Real Audio was available - there are many examples of this format on busker.net - click the guitar tab and browse through the guitar lessons to check them out. You will agree that Real Audio is MUCH better, whilst file sizes remain VERY small. The compression used in Real Audio though is intrusive and cannot be ignored. Real Audio for modem downloads though is the best possible format for music that is over 2 minutes or more. See the other article in HotCode for Beginners for a tutorial on using Real Audio.

However, with shorter sample times another alternative is possible.

Current flavour of the month is mp3. Mp3 files can get VERY close to CD quality, with in some cases the mp3 file being BETTER quality than the source. Impossible you cry, not so, say I. Here's how it works. Mp3 files can be encoded(compressed) with a variable bit rate. Most, if not all music includes silence as part of the signal. Now, in a sample, that silence is usually not silence, it may, and usually does, consist of background noise. This silence when encoded in mp3 has its data rate reduced. Theoretically silence could be represented in a 16 bit signal with just one bit. So mp3, whilst being only 1/12th in size of a CD trak can represent silence better. A CD recording of three minutes would take up 30 Meg but the mp3 file could come out at only 2.5 Meg - with LESS noise on quiet parts of the recording. A quick browse around mp3.com reveals that they use both Real Audio and mp3 files - the Real Audio for a quick preview, and mp3 where quality is vital.

So, it seems that that solves that problem, but it is not the only solution, and there is another problem. If you are publishing files that the user clicks on to download, then the following answer does you well. You simply use the best format for the job and inform the reader of the format and what is required to play it. However, when it comes to playing sound in-line, as a background task, without the user involved, it is a different story. Here, HTML shows its age, and the web one of its weaknesses. Most of the current HTML which supports in-line playing is for wave or real audio files. A method to play mp3 files in-line is not so easy. It is possible to do this but there is a drawback - the user MUST have an mp3 codec installed on their system. If you click here -> and you have audio enabled and you hear the audio you have an mp3 codec on your system. If you do not have an mp3 codec then the busker suggests you download Winamp. This will handle ALL your audio files and mp3 admirably. Winamp is FREE.