Web Audio
On November 14th, I spoke at Vocaltech 98 about getting music on the web. Below are my notes from that presentation in html form (including an online audio format quality comparison). You can also download the notes in Microsoft Word for Macintosh format here.
The number of bits transmitted per second.
Transmitting audio data on the web is not trivial. For every second of CD-quality audio, the server, the internet, and the browser must handle:
- 44,100 samples/sec
- x 2 bytes/sample
- x 2 channels (for stereo)
- = 176,400 bytes/sec
- = 1,411,200 bits/sec , the bitrate
In order to get the bitrate of audio data down to workable levels, some web authors will lower the sample rate and/or convert stereo data to mono. This obviously affects sound quality.
In order to be transmitted efficiently, nearly all audio on the web is compressed in what's called a "lossy" audio format. This means that when the audio is eventually un-compressed in the browser, something is lost. It could be a little less clear, it could be missing the higher frequencies, or there could be more static.
Often compression is used in conjunction with some kind of downsampling.
Common types:
- AU
- 2:1. reduces every 16-bit sample to 8-bits
- very simple to process
- sounds horrible
- IMA
- 4:1, reduces every 16-bit sample to 4-bits
- simple to process
- sounds OK, adds noise
- Perceptual Encoding
- 2-40:1
- Much research was done on what we can hear and what we can't. High compression ratios are achieved by removing information that theoretically we won't hear when there are other, more dominant sounds in the mix as well.
- trademarks: MPEG, Dolby AC-3
Streaming audio formats allow you to hear the audio as it downloads. (You may have to wait a few seconds for it to start.)
If for some reason the data flow is interrupted or slowed down too much, the audio playback will hiccup and/or stop. (RealAudio and LiquidAudio have special server software to try to keep this from happening.)
The audio has to very compressed to work with modem connections. This means a bitrate of 16Kbits/sec for 28K modems, 32Kbits/sec for 56K modems. The audio quality is therefore rather compromised. It often sounds like a weird flanging effect (especially RealAudio).
This is the classic way of delivering audio on the web. You click on an audio link, then wait for the audio data to finish downloading until you can hear any of it.
The audio quality can vary from perfect (uncompressed) to horrible (downsampled, extremely compressed). It's up to the web author to decide the tradeoff between better sound quality and quicker download time.
Data that expresses the performance of a piece of music, rather than its actual sound.
- note-on
- note-off
- sound/patch change
- pitch bend
- controller
- etc...
Inherently very compact since audio data requires 1000s of bytes per second and a single note requires maybe 6 bytes.
Most common form is MIDI.
Before we can think about putting your music up on the web, we have to first get it into your computer as files on your hard disk.
from a CD
By far, the easiest way to get a song into a computer is to transfer its data directly off the disc. You'll need a program known as a CD-ripper.
- Start your CD-ripper program.
- Insert the disc into your computer's CD-ROM drive
- Open the disc with the program transfer the track(s) you want into new files on your hard disk.
A long list of CD-rippers can be found at MP3.COM
If you have a program called Toast on your Macintosh, it probably came with a program called Toast Audio Extractor. This is a very good CD ripper program.
from an audio source
This can get much more involved:
- You'll need to connect your audio source (cassette player, DAT player, turntable) to some sort of audio input on your computer. (The standard audio inputs will do, but the quality of the transfer probably won't be that great.)
- Then you need to run some sort of sound-editing program with audio input capabilities.
It's beyond the scope of this discussion to get further into this.
Shockwave audio (my favorite)
- Fairly good sound quality. At 32Kbits/sec (fine with 56K modem), it's quite good. - demonstration
- Somewhat more difficult to set up in web page than other formats.
- Browser requires Macromedia's Shockwave plug-in, which is quite widespread.
- At modem bitrates (16-32 Kbits/sec), music with snare drum and high hat sounds flangy and clipped in a strange way. - demonstration
- Browser requires the RealPlayer plug-in, which is quite widespread.
- Very good sound quality.
- Lyrics, credits, other info can be viewed while music is playing.
- Buy CD button on player panel that connects with ordering system in server software.
- Browser requires the Liquid Audio plug-in, which is not widespread.
- Server requires LiquidAudio's server software.
- Good security.
- Rather expensive.
- Very good compression and sound quality (especially layer-3)
- Browser requires an MPEG-3 player application, which is easy to find.
AIFF/AU/WAV
- Older audio formats that can employ compression, but don't most of the time. (They'll take forever to download and/or sound horrible if they don't.)
- Browsers can usually play without any other software. (This is these formats' only advantage.)
- Contains just performance data. No audio data.
- Composers are often horrified how their MIDI file plays on other people's browsers, since different MIDI-playing software use different instrument sounds.
- Browsers can usually play without any other software.
- Beatnik's format that combines MIDI and audio data. (Can also deliver just MIDI or just audio.)
- Ideal format for MIDI-based music with the occasional custom sample in the mix.
- Plays MIDI data with consistent set of instrument sounds.
- Browser requires the Beatnik Player plug-in, which is fairly widespread and is poised to become much more so.
- Also playable by Java (1.2 or later).
- Provides unique capabilities for interactively altering the music in response to user's actions on a web page.
- Good security.
MOD
- Contains performance data and all the audio data needed by the performance.
- Not as compact as MIDI since audio data included.
- Plays more-or-less consistently since audio data included.
- Difficult to author.
audio format quality comparison
using Nature Wins Again from Moe's Kitchen's new CD, Grooveprint
Shockwave 16Kbits/sec
Shockwave 24Kbits/sec
Shockwave 32Kbits/sec
RealAudio 16K/sec mediumband
RealAudio 16K/sec fullband
RealAudio 32K/sec mono
RealAudio 32K/sec stereo
MPEG 128K/sec stereo