Audio in the Web 02: The Past and Forgotten

2012/05/28 – No Comments

Overview of all parts of the Audio in the Web series.

Throughout the history of the world wide web many techniques were conceived and used to add audio to a web site. Some of them only allowed web designers to embed static audio files into their sites, a very questionable practice if it’s used as a background track. Some of these techniques have practically already died out along with the infamous <marquee> and <blink> HTML tag.

 

<bgsound>

The archaic <bgsound> element works only on Internet Explorer (and Opera, as it seems) and I probably used it on every web site I made when I was 14 years old. With the src property you could specify an audio file in one of the standard audio formats such as WAV, AIFF,  Sun AU, MP3 and MIDI (maybe the worst kind of background music you can find on the web). You can use loop for telling the browser how often the audio file should be repeated (set it to infinite or -1 for maximum annoyance). Surprisingly enough you could also set volume  and balance, but on a rather strange integer scale. Volume ranges from -10000 to 0, with 0 being the loudest and balance ranging from -10000 to 10000, going from left to right with 0 at the center.

I won’t post any code example because as the W3C Wiki states: “No, really. Don’t use it!”

 

<embed> and <object>

The embed and object tag is still widely in use, as these are also used to include Flash files into a website. <object> was considered the better option as <embed> was deprecated in HTML 4 but revived in HTML 5.

With <embed> you can insert any kind of media (as long as there’s a media player installed that can handle it) into a website – even video. In contrast to <bgsound> you’re able to display controls, so the user can stop the media if he gets annoyed. You can set the volume with a property but in a different range then <bgsound>, ranging from 0 (silent) to 100 (loud).

<object> is more general – you could even embed another HTML page with it. Parameters  are set with <param> elements inside the <object> tag instead of as properties of the element.

Every major browser supports these tags, but as the browser doesn’t play the audio itself you have to rely on the installed media player (and that they behave well with your content). I really never used them for embedding audio and I wouldn’t recommend them for this job but here is a little example:

<embed src="http://www.cappel-nord.de/misc/batman-nmf.mp3" height="30" width="400" autoplay="false" />

Java Applets

It’s a bit unfair to call Java applets dead but they’re certainly out of fashion. Once proclaimed as the future of the web they failed in large parts because of their long load time, sluggish user experience, bad implementations of the browser plug-ins and security issues. There are a few good ones out there, but also many broken ones that give them a bad reputation. Most areas of application for Java applets are nowadays taken by Flash or HTML5.

One thing that Flash couldn’t deliver for a long time and Java applets could was dynamic audio processing and even audio synthesis in real-time. One of the major software libraries for this task that I’m aware of is JSyn.

JSyn is definitely not dead, even if the website looks kind of dated. The latest beta release isn’t a month old and it isn’t just a bugfix release. JSyn has a nice set of Unit Generators built in and I’m sure you can easily implement your own when you’re into Java. There are plenty of examples but some didn’t work for me and for some you have to install an extra plug-in.

So If you’re a Java nerd and want to make the web go “beep!” with an applet this might be a good point to start with. Because I kind of dislike the Java language (even though you could also use Clojure or other languages that compile into Java byte code) and also think that Java applets aren’t a very good option at the moment I’ll skip this platform and move on to the current king of rich internet applications: Flash.

Leave a Reply