Making Music Objects in SL

The shortcomings of music and sound in SL are massive. There are various ways to do sound:

External feeds use the embedded Quicktime player to render web media. The media can be an asynchronous file download or a (relatively) synchronous stream. The latter is how live music is done. In either case you have to set the source URL in the parcel media settings, available only to the parcel owner or via an object owned by the parcel owner and set to allow others to use.

When there is a media URL set, the viewer’s media player controls will show play/stop buttons.  (This information applies generally to both audio and video media, which are separate, but operate similarly.) You can set your viewer to automatically play media when you enter a parcel, but most people don’t do that because it can be a bit jarring to cross a parcel boundary and go from a classical harp solo to a death metal band without warning.  So if it’s important for people to hear what’s playing on your parcel, you generally have to let them know that.

Another option is the new so-called “shared media” which allows anyone with build permissions on a parcel to create a prim with a web player on any or all surfaces.  There are so many complications with that (not the least of which is that it requires the largely reviled Viewer 2.x), that I have only played with it a little and have not yet found it worth bothering with. I’m sure it will be much more widely used when it’s incorporated into third party viewers that are actually usable.

Aside from external media feeds, there are sound emitting objects. The most common of these are ambient sound generators with birds and crickets or whales and seagulls or whatever. These operate by looping short WAV files. An object can only play one file at a time. The files are monaural, but are spatial, i.e., you can locate the sound emitter by stereo location and volume.

The problem with sound emitting objects is that WAV files tend to be large files that are slow to load. Creating sound emitting musical instruments is primitive at best. I built a carillon that’s kind of impressive. It’s about 2 octaves, chromatic. You touch a key and it moves and the clapper on an associated bell also moves. The bell is for visual effect only. The sound actually comes from the key. (I considered changing that so it’s more spatially accurate, but the size of the thing results in a fairly dramatic difference in volume between the closer and further bells.) With something like 30 keys, I had to create and upload individual WAV files for each. The script plays whatever sound file is in it, so I was able to clone the keys and just drop the appropriate pitch in each. Playing it requires the causes files to download in the viewer where they are cached. So you basically have to play all the notes and then wait a minute for them all to cache before you can actually play music without delays. That is also true for anyone listening. So if you’re playing and someone new arrives, what they hear will be disjointed and weird until the sounds have cached on their viewer. (There is a preload sound option, but it’s not efficient and can lag the sim while it scans for people and runs whether they want the sounds or not.)

The kicker is that no WAV file can exceed 10 seconds in length. And it costs 10 Lindens (a little over 4 cents) to upload each file. You can daisy chain files together to run in sequence, but each file still needs to load and cache. You can also loop a file to play a continuously repeating sound, but it’s nearly impossible to do this without an audible gap at the repeat. Best you can do is to use a sound that is sufficiently chaotic that the blip becomes inaudible.

There are a number of musical instruments that use this technology, first pioneered several years ago by Robbie Dingo, best known for his ubiquitous Elven Drums. The drums are very clever in that they are able to play any of several rhythm loops in sync with other instruments. There is very little active “playing” by the user. But with his “hyperflute” and “hypercello” you are given a HUD that resembles a keyboard that can be played with the mouse.

Other instruments are primarily for show. There are tons of pianos around that play music. Most play brief excerpts using chained files. In one extraordinary example, a rather lovely harpsichord plays the entire Bach Goldberg Variations. (You have to load and play each one separately. The music files are actually in the sheet music prims — a common means of making pianos with multiple tunes.) I calculated that this would required approximately 420 10-second WAV files, each uploaded at a cost of about 4 cents, or $16.80 US. The upload cost is negligible compared to the time and energy it must have taken to dice these tracks into 10 second files. I presume it was automated somehow.

There is hope that alternative means of live sound production may evolve. There are a lot of people interested in making music in virtual worlds. It is not sufficient to want it, of course. At some point it has to integrate with the viewer. As viewer development goes into high gear in the open source community, perhaps developments with emerge sooner.

Leave a Reply

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.