Page 1 of 2

Positional audio and ambient sounds.

Posted: Sat Dec 01, 2007 12:34 pm
by zeep
Over half a year ago i asked the dev for options regarding positional audio and ambient sounds. Positional audio means that when a ship passed you on the left side, and it emits some engine sound, you will also hear it passing on your left. Basically positional audio is the most important and from it can come ambient sounds.

I don't know what this community's view is on adding more sound too Oolite, but being a sound engineer i see a lot of possibilities. Stations produce ambient sounds, your ship etc. (Hum, metal screech, computer sound, ships internal and external views).

Ahruman said this on the subject:
Ahruman wrote:
.. the sound code is custom. I started on support for positional audio, but the problem lies in making the rest of the game tell the sound code where sounds are supposed to be played… this is a heavy rearchitecting thing, regardless of the underlying sound code..
He doesn't say, "No it's impossible!". ;)

Maybe with 1.70 the possibilities are nearer?

Posted: Sat Dec 01, 2007 2:48 pm
by JensAyton
No.

Posted: Sat Dec 01, 2007 3:15 pm
by Svengali
Hello zeep,

there is already a way to play specific sounds. playSound. I don't know if it's working on Macs or Linux, but for Windows it is working (Version 1.65 and 1.69.1-test / wav + ogg). I've used it for my own OXP, but it seems that there is no kind of method to control if a specific sound is running (by the way: what means isPlaying? Is it implemeted and how does it work?) and no way to stop or fade something. I've tried playCustomSound but it doesn't work. And missionMusic does not work on Windows.

I would like to see something like a radiostation while STATUS_IN_FLIGHT that chooses songs randomly, but I don't know if there is any chance to control it. Maybe there are other restrictions like memory usage,... And think about that there are a lot of players running Oolite on somewhat slow computers - so all sound files have to be small.

And last but not least the ambience thing. I think it is a good idea using some ambience effects (maybe for the spacer bar and for Equipment-GUIs), but without any control method it will clash with other sounds (mission screens,...).

EDIT: And a library of free music would be cool.

Posted: Sat Dec 01, 2007 5:00 pm
by zeep
If Ahruman (or 3rd party) ever programs more abilities for sound emitting in Oolite, i would be glad to help out adding sounds. I'm positive Oolite will have so much more immersive effect on players when there's a audible sense of life to go with the rest of this sublime game.

I'm on the pc myself so if we're missing out on more sound abilities here i feel bad about that..

For what it's worth i'm doing a soundpack for now. Just some sparse sounds to replace most of the basic sounds. It's not much work but when i feel good about it i'll release it.

Posted: Sat Dec 01, 2007 10:42 pm
by nijineko
even if advanced sound support would be a little much at this time without major restructuring, what about adding support for code-activated sounds which can be targeted at specific sound channels?

Posted: Sun Dec 02, 2007 12:59 pm
by Svengali
So lets make a test. Download this OXP <removed>, install it, launch from station and press F7 (SYSTEM_DATA_SCREEN). Can you hear it? Please don't forget to post what kind of OS you are using.
Maybe we can find a method that will work for all OS.

EDIT: I've disabled this link. If you need a test take a look in the hyperradio.oxp http://wiki.alioth.net/index.php/Hyperradio_js_OXP or https://bb.oolite.space/viewtopic.php?t=4067

Posted: Sun Dec 02, 2007 4:18 pm
by zeep
Works here! Winxp pro sp2.

So playing a music fike is possible for menu's. Is it also possible to stop it when i.e. another theme starts playing? I did see something mentioned in your code so i guess it works that way too.

Looping sounds is unsupported though afaik, so that option will have to be added or any ambient sound will have to be a long file which is a bad route to take.

Can two sounds play together if you'd were to make another tune play for i.e. menu 6? Will different sound cancel eachother out? So how many sounds can play at the same time?

I have to learn this scripting fast!

Posted: Sun Dec 02, 2007 5:54 pm
by TGHC
I'm really liking this, I wish you well in your endeavours.

Posted: Sun Dec 02, 2007 6:04 pm
by zeep
I'm already mixing sounds for different states in the game! Here's hoping for more possibilities..

Posted: Mon Dec 03, 2007 12:24 am
by Svengali
Sorry for hijacking this thread.
TGHC wrote:
I'm really liking this, I wish you well in your endeavours.
Thanks for your answer . But what does it exactly mean? Is it working on your computer and what kind of OS is it? As you can see I'm very interested in finding a solution for that.

zeep wrote:
So playing a music fike is possible for menu's.
Not only for menu's. Take a look in my OXP (localhero thread). There it is used as commsMessage, too.
Is it also possible to stop it when i.e. another theme starts playing? I did see something mentioned in your code so i guess it works that way too.
That is just a prevention. If the player stays on the SYSTEM_DATA_SCREEN (for more than a few secs) he would here more than one song (if there is a definition in descriptions.plist) at the same time. So I've implemented a 'counter' (clock_mins_number doesn't work). And if the same song is started again, that is no problem. The running theme stops and will be restarted. But stopping a running theme? I don't know. There are a lot of routines in the SDL-thing, but I'm no progger at all, so maybe this will end in trial and error :evil: .

But I'm willing to do this :shock: (Must be a maso)

Posted: Mon Dec 03, 2007 6:15 am
by Commander McLane
Svengali wrote:
So I've implemented a 'counter' (clock_mins_number doesn't work).
Works from 1.70 onwards. But the relevant time counter is clock_number anyway, which always worked.

*****

Generally for ambient sound: May I just throw in a quick reminder here, that there is no transmission of soundwaves in vacuum, so, contrary to what we are used to from SF-movies, space is quiet? :oops: (Myself I actually play most of the time with sound completely off, but admittedly for other reasons than realism. Has more to do with not waking up wife etc. :wink:)

Posted: Mon Dec 03, 2007 6:51 am
by zeep
With regards to possible music; I'm thinking lush / easy listening. Fitting the theme, not setting the tone. But ofcourse, different people have different taste so the end user can always disable stuff, even if it's as simple as just deleting some files. Or with a custom(izable) install package. But i'm ahead of myself, first things first, we'll see how everything goes.

Posted: Mon Dec 03, 2007 7:19 am
by JensAyton
I should probably mention that 1.71 is intended to have JavaScript classes for dealing with one-shot sounds and music. But not positionally.

Posted: Mon Dec 03, 2007 12:32 pm
by Disembodied
Commander McLane wrote:
Generally for ambient sound: May I just throw in a quick reminder here, that there is no transmission of soundwaves in vacuum, so, contrary to what we are used to from SF-movies, space is quiet? :oops: (Myself I actually play most of the time with sound completely off, but admittedly for other reasons than realism. Has more to do with not waking up wife etc. :wink:)
True, but I think we can assume we're dealing with highly sophisticated command consoles here, which can use all sorts of gizmos to expand our perceptions (e.g. enabling us to see laser beams, for a start...). If you want to rationalise Star Wars-esque "zhhwhooo" noises as ships fly past, you could imagine a system which was cunningly designed to feed information about the surrounding environment through a variety of sensory channels. Youc cabin could be fitted out with Doolby surround-sound speakers, giving you simulated audible as well as visual information. Maybe even, depending on the species, chemical cues too: if you're an insectoid, a pheromonal squirt onto your antennae from the upper-rear-left, signalling a hostile presence there, might enable you to react far more quickly than visual information only.

Posted: Mon Dec 03, 2007 5:04 pm
by nijineko
and there's a perfect canidate for the 'your-ad-here' oxp! =D