Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Oolite sound engine documentation --- pointers?

General discussion for players of Oolite.

Moderators: winston, another_commander

Post Reply
Sleeper Service
Poor
Poor
Posts: 6
Joined: Tue Apr 07, 2015 10:30 pm

Oolite sound engine documentation --- pointers?

Post by Sleeper Service »

Hello to everyone and a big thank you to the people that (re)created this rather nice game!

I seem to be unable to find much documentation on how sound is handled by Oolite. This is probably my own fault, but perhaps someone would be so nice as to point me in the right direction.

I did find the the wiki (http://wiki.alioth.net/index.php/Oolite ... nce:_Sound), but I wonder whether there is some way to access some lower level audio mixer. Or would it be possible to synchronise multiple audio tracks using javascript? (Sorry, haven't tried this yet.)

Context: The (very) long term goal would be a procedural, context sensitive music or score engine. I've no high hopes of actually doing this, though, but it seems a nice itch to scratch.

Thanks,

/ss
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Oolite sound engine documentation --- pointers?

Post by cim »

The Wiki is about all there is for documentation (there's not that much to the sound system, though)

The sound internals use the standard OpenAL library as a baseline. There are then 32 channels (one of which is reserved for the "music channel" which is nowadays mostly a compatibility thing - you can play music just fine on the other 31 as well).

You should be able to synchronise multiple tracks with JS if you want to do mixing - you can control all your sounds independently. Using a frame callback will let you make frame-by-frame adjustments to volume, playback, and source position.

SoundSource has all the interesting stuff - http://wiki.alioth.net/index.php/Oolite ... oundSource - use that rather than the "playMusic"/"stopMusic" methods on Sound itself. Oolite will automatically map SoundSources to the 32 output channels as needed.

Welcome to the forums!
Sleeper Service
Poor
Poor
Posts: 6
Joined: Tue Apr 07, 2015 10:30 pm

Re: Oolite sound engine documentation --- pointers?

Post by Sleeper Service »

Thanks!

That should give me some thing to look into... OpenAL.

And it is encouraging to note that good sync per .js should be possible. Time to experiment, then, and not write bb-messages.

Cheers,

/ss
Sleeper Service
Poor
Poor
Posts: 6
Joined: Tue Apr 07, 2015 10:30 pm

Re: Oolite sound engine --- first impressions

Post by Sleeper Service »

Sticking firmly to what's exposed to the .js side of things, I notice that there's no way to get my grubby little paws on any actual PCM data*, but the timing seems good enough to sequence some .ogg files and do some basic multitrack playback (on my system, anyway).

So that looks nice, though a bit limiting in scope - sequencing would have to be phrases and 'stem mixes', not individual notes.

OpenAL seems to support a bit of reverb. It that exposed to the .js api at all?

Cheers,

/ss.

----

* Which prevents me from trying to do FFT stuff in javascript, which is probably not a good idea anyway.
Post Reply