Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Soundscape Manager  (Read 2997 times)

0 Members and 1 Guest are viewing this topic.

MrBehemoth

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 18
    • View Profile
Soundscape Manager
« on: January 05, 2014, 06:41:25 PM »

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:
Code: WME Script
  1. global SoundscapeMgr = Game.LoadEntity("soundscapes\soundscapeMgr\soundscapeMgr.entity");

To start a soundscape or change to a different one, call this method:
Code: WME Script
  1. global SoundscapeMgr;
  2. 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:
Code: [Select]
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:
Code: [Select]
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.zip


Obviously, you can do a lot more with this than just make cave sounds. Thanks and have fun! Any questions, just ask.

Myrm

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 3
    • View Profile
Re: Soundscape Manager
« Reply #1 on: January 06, 2014, 01:35:28 PM »

 Cool, sounds (huhu) useful, thanks!
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Soundscape Manager
« Reply #2 on: January 06, 2014, 07:01:53 PM »

Cool thing! I did something along these lines as well. You can watch my talk about it here:

http://www.youtube.com/watch?v=L3K2HkpJSeY
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

piere

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 299
  • Sorry for any bad english in my posts. Game on !
    • View Profile
Re: Soundscape Manager
« Reply #3 on: January 07, 2014, 03:41:12 AM »

Thanks for posting, very interesting script, but surly there should be a more simple way to achieve this? Having the sounds defined in a separate file seems a bit awkward.
Logged

MrBehemoth

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 18
    • View Profile
Re: Soundscape Manager
« Reply #4 on: January 07, 2014, 07:51:12 PM »

Thanks everyone for the comments!

@piagent - I see what you mean but I was thinking of re-usability (in multiple projects) and of readability. I originally made a simplified version of this for Bickadoodle, with the intention of re-using it in Black Aether (my "serious" project). The Bickadoodle version is all in one script with the soundscapes defined as properties of objects. That came to 700 lines. Black Aether could potentially have up to 40 different soundscapes, so that script would be a bit unwieldy.

@metamorphium - I will definitely have a look at that vid later, as I am also hoping to implement interactive music too.

MrBehemoth

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 18
    • View Profile
Update
« Reply #5 on: January 12, 2014, 03:07:43 PM »

12/01/14: Fixed a bug that was causing looped sounds to fade back in after the soundscape was changed, if 2 changes overlapped. Link above updated.


@Metamorphium - I watched your talk. Very interesting! I agree that interactive music is underrated. iMuse was a revolution that never happened - but maybe people are starting to catch on. I was already planning to do something similar to your ideas, but I'm not a musician, so your music objects, moods and pools is awesome but a bit beyond my abilities. :-[  What I did yesterday though is I made another entity, MusicMgr, similar to this one, that uses Spellbreaker's aMuse (http://forum.dead-code.org/index.php?topic=4768) and the Bass library to mix simple loops interactively. It's very basic, but for simple repetitive industrial-esque music (think Silent Hill) it works quite well, especially coupled with the soundscapes. (I kept music and soundscapes separate for simplicity's sake.) Is part 2 of your talk on it's way?
« Last Edit: January 12, 2014, 03:11:05 PM by MrBehemoth »
Logged

mihaipuiucernea

  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 25
  • Currently working on Colors on Canvas
    • View Profile
    • Dev Blog
Re: Soundscape Manager
« Reply #6 on: September 11, 2017, 06:04:12 PM »

Sorry to revive an old topic, but I would like to try the plugin. Anyone still hs it and is willing to upload it? Assuming the plugn creator is ok with it
 

Page created in 0.182 seconds with 17 queries.