Master Zap Message Board - Master Zap YOUTUBE Master Zap BLOG Master Zap mental ray BLOG Welcome to "100% Zap", HÃ¥kan "Master Zap" Anderssons website - hosted by LYSATOR ACS Please use "my" URL http://www.Master-Zap.com when linking! |
||||||||||||||||||||||
The page was initially written some years ago when the main focus was RealAudio and Netscape browsers and their behaviour. It has since been updated to talk about MP3 streaming. However, with newer browsers things stream automatically when you click an audio file anyway, making this tutotial partially obsolete
When do you need a server? Well, with a RealAudio server, you can do many things that you can't with this approach:
But for us small-time users, the standard http-server is sufficient. And that is what this document will talk about.
And this is the same, if you use a compressed RealAudio or MP3 file. Only it's click . . . wait . . . "hello there" instead! Only the wait is shorter (beacuse the file is shorter!)
What we want is streaming audio - the file should be heard as it is being downloaded. This is something RealAudio has always been very good at - but before version 3.0, this required special server software!
Note: | You must make sure that your Web-server has the correct RealAudio "mime types" defined. Information on "mime types", what they are e.t.c. is available here. But if your audio stuff seems to work fine when you run it at home, but doesn't work after you upload it to your Web server (the files appear as garbage on-screen, instead of being played), then the "mime types" are not configured right, and you must contact your webmaster |
First of all, you must get some audio to compress. Sample it with your soundcard into a .WAV file. Use the RealProducer or your favourite MP3 encoder to compress it to a .ra or .mp3 file.
The RealProducer has several different options on how to encode the files, and to what bandwidth. In this first example, just encode it as a "28.8 mono, full response". Let's name the output file melody.ra, which is a 120k file (1/44:th the size). Or we can encode it as an mp3 with your favourite tool and call it melody.mp3
<a href="melody.ra">Click to hear my melody!</a> or <a href="melody.mp3">Click to hear my melody!</a>
Sure, this would work, but we would have gained little; when the user clicks the link, the browser (e.g. Netscape Navigator) first downloads the entire 200k file, and only after this launches the helper application (in this case, the RealAudio player).
Okay, we only had to wait for 200k instead of 5.3megs, but it wasn't streaming!!
So how do we solve it? The answer is with a stub file!
With RealAudio, the stub files have the extension .ram (There's also .rpm for the plugin variant, which works the same way, but is beyond the scope of this document) and for MP3 files it's called .m3u
What you do, is that you create a simple textfile in your favourite text editor. In Windows, Notepad is the ideal choice. This simple text file should contain only one line of text, namely, the full URL of the actual sound (.ra or .mp3) file!
So, create a file called melody.ram or melody.m3u that contains the following:
http://www.your.server.com/~your/directory/melody.ra or http://www.your.server.com/~your/directory/melody.mp3
Now change your HTML page to read:
<a href="melody.ram">Click to hear my melody!</a> or <a href="melody.m3u">Click to hear my melody!</a>
Please note the use of .ram / .m3u instead of .ra / .mp3.
This method, with variations, is used by almost all the network products that use streaming;
Geocities is a free web page provider. Adresses on Geocities has a certain form, i.e. something like http://www.geocities.com/HollywoodHills/Garage/1234. However, since many users forget to write the uppercase characters in "HollywoodHills" and write "hollywoodhills", although in reality the paths are case-sensitive, Geocities has implemented a feature where it redirects the URL to the correct, upper-case variant. That has led most Geocities people to believe case is not significant. IT IS!. "HollywoodHills" is not the same as "hollywoodhills".
To make this worse, the RealPlayer does not support redirection! So it gives a cryptic error, instead of playing the audio.
The fix is simple - provide the exact and correct path in the .ram stub file - with the correct case. Use the Open Location trick mentioned above to test, and you will get nice streaming RealAudio on Geocities too!
The easiest way is to simply provide several versions of your song. If you purchase RealAudio Server all this is handled automatically.
But when you are using a standard WWW-server, you will have to do this "manually", by adding several entries to your HTML code.
To make the largest possible population happy, you should do the following:
(The convention to name the files 0, 1 and 2 is just the way I do it. If you want to call the files melody_28.ra, melody_64.ra and melody_128.ra, or chocolate.ra, vanilla.ra and strawberry.ra, that's your choice)
Now write HTML similar to this:
Which will look like this (using one of my songs, "Dream State" as example file):
Bye now. Surf safely.
- Troubleshooting
The Netscape "about:" trick
To check mime-types of things, use the Netscape "about:" URL feature, i.e. type into the URL something like:
about:http://www.foo.com/myfile/myfile.ram
If the type comes out as "Unknown", just type the adress only once (without "about:") and let Netscape load it, then try the "about:" trick again.Use your Players 'Open Location' as a test device
Before you even make the .ram stub file, test that your adress is actually working by using "Open Location..." on the your players "File" menu. When it works in Open Location, then copy that exact text into your .ram or .m3u file. Remember, upper/lower case is important!!The infamous Geocities Stub File problem
I've been asked this so often, that I've given it a special section in the file :-)Good luck!
Advanced topics
Several versions for different bandwidths
You want your audio to be heard as well as possible, with the best possible quality. But you still have to cater to the lowest common denominator - the 28.8 modem. How?
And finally, if you wanna be really nice:
With our example of melody.wav, this could be realized as follows:
<B>My cool song "...."</B> Hear it with RealAudio (3.0 or newer)
<UL>
<LI> In 28.8 <a href="melody0.ram">streaming</a>/<a href="melody0.ra">download</a>
<LI> In 64k <a href="melody1.ram">streaming</a>/<a href="melody1.ra">download</a>
<LI> In 128k <a href="melody2.ram">streaming</a>/<a href="melody2.ra">download</a>
</UL>
My Cool Song "DreamState" Hear it with RealAudio (3.0 or newer)
Technical details
It is in no way necessary to have the .ram and .ra file in the same directory (or even on the same server!), or to give them the same name. It's just convinient. But it's fully possible to let a file called http://www.northpole.cold/index.html refer to the file http://www.southpole.cold/junk/spiffy.ram that in turn points to http://www.equator.warm/nifty/songs/daisy.ra. It's all up to you.Reference sites
Hope you liked it!