Hi Muties! I made this soundscape manager and thought I would share it. The download link is at the bottom of the post.
What is it for?Soundscape Manager will generate layered, randomised ambient sound enviromnents (soundscapes) on the fly. For example, lets say you have a cave scene. You can use a soundscape to play randomly placed dripping sounds and rock noises. Other uses could be crowd scenes, cities with traffic, wind, forest sounds, etc.. Use it instead of creating a single looped ambient sound track and it will be less repetitive, more realistic and reduce file size.
What does it do?The soundscape manager is an entity that you load from your
game.script. The soundscapes themselves are defined by text files called
something.soundscape. There are 3 channels. Each channel can be either randomised or looped. Randomised channels can have up to 5 sound files. The volume, pan and delay between each channel is randomised based on the values in the text file. You start a soundscape by calling a method from your
scene_init.script (or wherever your like). The soundscape will continue playing across scenes (without a gap) until you stop it or change to a different soundscape.
How do I use it?Copy the contents of the zip into your project folder. You'll now have a
soundscapes folder. In there you will find an example soundscape called
cave.soundscape and a
template.soundscape to help you with making your own. Into this folder goes your sound files such as drips, wind bursts, birds tweeting etc.. There is also a subfolder that contains the Soundscape Manager entity and script.
To load the Soundscape Manager, add this to your
game.script:
global SoundscapeMgr =
Game.
LoadEntity("soundscapes\soundscapeMgr\soundscapeMgr.entity");
To start a soundscape or change to a different one, call this method:
global SoundscapeMgr;
SoundscapeMgr.ChangeSoundscape("cave");
Where
cave is the name of the soundscape file (e.g.
cave.soundscape).
What goes in the something.soundscape text file?Compare the example and the template files. The
template.soundscape file looks like this:
fade_in_time (ms: time for whole soundscape to fade in when started)
fade_out_time (ms: time for whole soundscape to fade out when stopped/changed)
////////////////////
type (bool: 0=random sounds, 1=single looping sound)
channel_0_sound (filename without path or ext, or "null")
channel_0_sound (filename without path or ext, or "null")
channel_0_sound (filename without path or ext, or "null")
channel_0_sound (filename without path or ext, or "null")
channel_0_sound (filename without path or ext, or "null")
channel_0_min_volume (%: minimum random volume)
channel_0_max_volume (%: maximum random volume)
channel_0_min_delay (ms: minimum length of the random time between sounds)
channel_0_max_delay (ms: maximum length of the random time between sounds)
channel_0_random_pan (bool: 0=centred, 1=randomly panned)
////////////////////
type (bool: 0=random sounds, 1=single looping sound)
channel_1_sound (filename without path or ext, or "null")
channel_1_sound (filename without path or ext, or "null")
channel_1_sound (filename without path or ext, or "null")
channel_1_sound (filename without path or ext, or "null")
channel_1_sound (filename without path or ext, or "null")
channel_1_min_volume (%: minimum random volume)
channel_1_max_volume (%: maximum random volume)
channel_1_min_delay (ms: minimum length of the random time between sounds)
channel_1_max_delay (ms: maximum length of the random time between sounds)
channel_1_random_pan (bool: 0=centred, 1=randomly panned)
////////////////////
type (bool: 0=random sounds, 1=single looping sound)
channel_2_sound (filename without path or ext, or "null")
channel_2_sound (filename without path or ext, or "null")
channel_2_sound (filename without path or ext, or "null")
channel_2_sound (filename without path or ext, or "null")
channel_2_sound (filename without path or ext, or "null")
channel_2_min_volume (%: minimum random volume)
channel_2_max_volume (%: maximum random volume)
channel_2_min_delay (ms: minimum length of the random time between sounds)
channel_2_max_delay (ms: maximum length of the random time between sounds)
channel_2_random_pan (bool: 0=centred, 1=randomly panned)
To make a new soundscape, just edit the template and you should end with something that looks like the "cave.soundscapes" file:
2000
2000
////////////////////
0
drip1
drip2
drip3
null
null
10
100
3000
6000
1
////////////////////
0
rockfall1
rockfall2
null
null
null
50
100
5000
15000
1
////////////////////
1
cave_ambience
null
null
null
null
100
100
0
0
0
This soundscape takes 2000ms to fade in or out. In channel 0 there are 3 drip sounds which play at a volume between 10-100% with a random gap of 3000-6000ms between each play. The channel is randomly panned, so each play will be at a different left-right position. Channel 1 is similar. In channel 2 there is a single looped sound that plays continuously at full volume and does not pan.
Notes- For the filenames (the sounds and the something.soundscape files) you only need to give the name of the file, not the path or the extension. Just make sure everything is in the soundscapes folder and named correctly.
- The script looks for OGG FILES, so make sure your sound files are .ogg format. (If you really want to use .wav files, you can edit lines 224-292 of soundscapeMgr.script.)
- The soundscript files are read line-by-line, so don't mess with the layout.
- The 3 lines with the slashes are just for spacing (i.e., lines 3,15 and 27). You can't put comments anywhere else, but anything in these lines will be ignored.
- Remember to use "null" for a file listing that is not used (as in cave.soundscript above).
- You can use a random volume and pan for the looping sounds if you want to, but they will pick a volume a pan when they first start to play an then not change.
- You can't change the soundscape if another change is already in progress (i.e., it's currently fading in or out).
Here's the half-baked pseudo license note from the script:
Originally developed for Black Aether by Behemotronic Games. This code is distributed free for non-commercial use. Please feel free to use it in your own projects as long as you let me know so that I can check out what you've done with it. Please don't plagiarise or use it in commercial projects. This is provided "as-is" and has only had minimal testing. I take no responsibility blah blah blah.
Finally, here's the download link: https://www.dropbox.com/s/p8f77eqqh2skc12/soundscapeMgr.zip
And if you just want to try it out, here's a simple test project of Molly in a cave: https://www.dropbox.com/s/k3tf4q1nn4be5kv/SoundscapeMgrTest.zipObviously, you can do a lot more with this than just make cave sounds. Thanks and have fun! Any questions, just ask.