Saturday, June 25, 2011

Soundscaping tips for OpenSim and SL

After visiting many regions on SL and different OpenSim grids, one thing really caught my attention: the lack of sounds. I found myself walking in 'The Great Silence'.
So many regions look really fabulous with great buildings and fantastic landscapes but where are the sounds? Where are the birds, wind, mumbling people, a churchbell far away, sounds I normally hear when I am outside? It all looks real but it still does not sound real. Time to get started with some soundscaping.

How can I have environmental sounds playing?
The easiest way to play a sound on a particular spot on your land is creating a single prim object which contains a soundfile and a script.  Current OpenSim sound format that can be used is PCM WAVE (.wav) 16-bit/44.1KHz/mono or stereo with a maximum length of 10.00 seconds. Some sound can be found as freebies on some grids, but if you want a special sound you have to make it yourself and upload it via your viewer.
After uploading you can create a single prim and place the soundfile (search for it in the inventory) in it. You also have to create a script in the prim that will play the soundfile in a loop. A script that works fine looks something like this:

default
{
    state_entry()
    {
        string sound = llGetInventoryName( INVENTORY_SOUND, 0);
        llLoopSound( sound , 1);
    }
    changed(integer change) 
    {
        if (change & CHANGED_INVENTORY) 
        {
            llResetScript();
        }
    }
}

If you place the object (filled with the sound and the script) somewhere on you region, you will hear it somewhere in the stereo spectrum of your speakers with a certain volume. When you walk away from it the volume of that sound will be less. When you walk towards it the volume increases. When you turn your avatar around, you will notice that the sound will change speakers.
So every part of your sim or land can have several environmental sounds playing. Which will make it a lot more realistic.You can place as many as you like and test it for yourself. You can even place the sounds and script in object that allready exist on you land. A church can have a churchbell ringing every now and then. A tree can have birds singing in it. And how about waves at the beach?

Can't I play environmental sounds via Parcel Audio?
Play button
Yes, it is also possible to play a sound (or music) via the Parcel Audio settings. This sound will be heard all over the parcel in stereo. So wherever you walk within the parcel, the sound will be heard on the same level and location. But it will only be played when you hit the PLAY button on the bottom of your screen and it only plays once, there is no loop. So if you want to use this option you have to make a very long file. One advantage is that it can be a mp3 file, so it won't be that big. Once you created the file, put it on a webserver and copy the URL of the file into the 'About Land - Audio' Music URL.
You can even play a sound using the Media settings, even with a loop, but it is better to use this option to show video and webcontent. Which can be interactive with the latest Imprudence 1.4.0 viewer. More info about interactivity and Web On A Prim can be found in one of my blogs called: Flash and streaming video on a prim

Where can I get sounds?
There are some wonderfull sites that have free sounds, I have listed them below. The only problem is that you have to edit most of the sounds to create a soundclip that is a .wav file and not longer than 10 seconds, most viewers can not upload longer files.
(UPDATE AUG 2016 - The latest Firestorm viewer 4.7.9 now can handle audio files of maximum 60 seconds.)
It is best to use a mono sound when you place it in a prim.
When you use sounds playing through the media channel of the land settings it is better to have it stereo.
Free sounds can be found at:

How can I edit the sound?

You can edit the sounds with any audio editor you have on your computer. Maybe you recieved one with your video editing or you cd burning software. If you haven't got any editor I can suggest a good audio editing program for this purpose, the Audacity editor (freeware) which can be found at: audacity.sourceforge.net/

Any more scripts can I use?
If you want to create a script playing sounds 'the way you want it to happen' you can also use the 'Script Me!' pages. You can find them here: www.3greeneggs.com/autoscript
Any other scripts you can find at:

Have fun, and if you have any questions or suggestions? Post a comment!

Monday, June 20, 2011

Scratch4Opensim - Scripting in OpenSim made easy

Scratch4Opensim
Scratch4Opensim is a great tool for creating easy scripts in OpenSim. It has been around for a few years now but everyone I talked to so far (in Holland) had never heard of Scratch. For simple tasks Scratch is perfect, it is fast and easy. And educators (like me) can use Scratch as a perfect tool to learn children and teens how to script.

To get an idea of what Scratch4Opensim can do there is this nice tutorial on Youtube to watch. In 9 minutes Avasari Buninyong shows the possibilities of Scratch4Opensim on a simple way.

New edition?Now you might think this is old news, but this summer (2011) some clever guys will work on a new version called Scratch3D. I think this will be an online version, made in Flash, where the old Scatch4Opensim version will be integrated. More info about this can be found at http://roots.greenbush.us/3/wordpress/?p=1368 

Any more scripting sites?
Try it for yourself and have fun this summer. Looking forward to see the new Scratch3D made in Flash!