W3U Customer Support

Using audio files in your web pages

This tutorial exemplifies usage of .au, .wav, .ra, and .mp3 audio files 
and streaming audio in your web pages.

CONTENT
Streaming audio
Pseudo-streaming audio
Example of pseudo-streaming .ra (real audio) files
Example of pseudo-streaming .mp3 files
Serving .au, .wav, and .mid files
Using background sound
Download and Install Real Audio Player (get the free copy)
Precautions

Audio Streaming:  Audio streaming works by decoding and playing an audio file on the fly (or, the audio file is played while being downloaded rather than after it is completely downloaded).  In the truest sense, audio is streamed when the audio quality can be adjusted to accommodate the download speed of the audio file (lower speed modem connections means less information must be transmitted).  In effect, there are no pauses or breaks in the audio transmission.  True audio streaming utilizes Real Audio Technology and .ra files.  To effect Real Audio Streaming, your .ra files must be placed on a special server.  The cost for W3U Real Audio server space is $45 per month per 5 stream limit. If you are interested in this service, please contact our Sales Office toll-free at 1-800-845-2209.  For international callers, please use our standard line at 619 444 1986.

As an economical alternative to Real Audio Streaming (when the highest quality of audio content is not always required), pseudo-streaming can be equally effective and implemented as a standard W3U web hosting feature.

Top

Pseudo-Streaming Audio:  As with Real Audio streaming, pseudo-streaming audio is a technique that lets you listen to an audio file immediately without having to download the entire file.  In this respect it is similar to Real Audio.  However, there is no dynamic compensation in quality for variations in file download speed.  Hence, the term pseudo streaming.  The following examples illustrate pseudo-streaming of both .ra and .mp3 files.  Psuedo-streaming of both .ra and .mp3 files is accomplished with the use of 'locator files'.  The locator file contains only the http address (or URL) of the audio file. This special locator file directs a listener's player (as specified by the listener's web browser) to the audio files location and instructs the media player to play the audio stream as it is downloading.  For .mp3 files, the corresponding locator file extension is .m3u, and for .ra files, the corresponding locator file extension is .ram

To support pseudo-streaming of .mp3 files with some older web browsers, you may have to place a .htaccess file in the folder where your .m3u files reside.  The .htaccess should consist of a single line, as follows (i.e. this is a simple text file; no html code):
AddType audio/x-mpegurl  m3u

Because the appropriate plugin is required to play the .ra and .mp3 files, we highly recommend that you offer your web visitors an option to download and install the latest version of the Real Audio Player (get the free copy).  Real Audio Player will psuedo-stream both .ra and .mp3 files.

Top

MP3 pseudo-streaming example:  for instance if you wish to pseudo-stream an audio file called test.mp3, you would create a .m3u file, which in our example we'll call test.m3u.  

The hyperlink on your web page would point to the test.m3u file (for instance, if your test.m3u file was in the audio/mp3 directory, then the hyperlink would be http://www.yourdomainname/audio/mp3/test.m3u).  

The test.m3u file will contain a single line which would specify the path to the .mp3 file.  For instance, if the test.mp3 file was in the audio/mp3 directory, then the 'single line' in the .m3u file would read,
http://www.yourdomainname/audio/mp3/test.mp3

Top

RA (Real Audio) pseudo-streaming example:  for instance if you wish to pseudo-stream a Real Audio file called test.ra, you would create a .ram file, which in our example we'll call test.ram.  

The hyperlink on your web page would point to the test.ram file (for instance, if your test.ram file was in the audio/ra directory, then the hyperlink would be http://www.yourdomainname/audio/ra/test.ram).  

The test.ram file will contain a single line which would specify the path to the .ra file.  For instance, if the test.ra file was in the audio/ra directory, then the 'single line' in the .ram file would read,
http://www.yourdomainname/audio/ra/test.ra

Top

Serving .au, .wav, and .mid files:  Simply create hyperlinks within your web pages that point to the location of your .au, .wav, and .mid files.  The files will play after they are completely downloaded from the server.  Of course, the clients web browser must be configured with the appropriate audio plugin.

Using background sound:  The following code can be used to insert a sound file in the background of your web page.  The code can be placed either between the opening and closing <head> tag or immediately following the <body> tag.  Here's the code that will play the background sound for either an Internet Explorer or Netscape browser:
<embed src="pathtoaudiofile/filename" autostart=true hidden=true loop=-1>
<noembed><bgsound src="pathtoaudiofile/filename" loop=infinite></noembed>

You can use a variety of audio file formats for serving background sound.  Again, if you wish to use .mp3 or .ra files for background sound, you'll have use the appropriate .m3u or .ram file as described above.

You can view examples of background sound at, http://www.trjackson.com (this is a midi file, with the above code embedded in the <head> tag).  Also see, http://www.americanwarbird.com/mustang.html (this is a .wav file with the above code inserted after the <body> tag).

Precaution: Some sound files can take up a lot of disk space and hence long download time.  A large audio file can create a bottleneck in the download of your other web files.  Your web visitors will likely move on to another site, rather than sit around waiting.  Be efficient when serving up audio files.

Top

||  Back to FAQ's   ||  W3U's Home  ||

http://www.w3u.com/