Advanced 3D sound effects (doppler, reverb...) ala OpenAL?

General discussion around Urho3D.

Advanced 3D sound effects (doppler, reverb...) ala OpenAL?

PostPosted by TheSHEEEP » 19 Oct 2016, 05:58

Hey again,

today I was looking into the audio sources and it seems SDL is used for audio playback, too.
However, what I couldn't find out is if/how advanced audio effects like underwater, cave echo, etc. would be done.

A while ago, I built my own sound integration using OpenAL Soft in a different project, and the effects that come with it to achieve environmental effects in 3D did wonders.
I consider them a must-have for immersion purposes for some projects (the alternative would be recording each sound X times in some audio software, blowing up the asset sizes, and that wouldn't even have the same effect).

So, can such an effect be done with the Urho sound integration or would I have to roll my own?
If I'd have to roll my own, what method would you suggest? A custom component?
User avatar
TheSHEEEP
Have some posts
Have some posts
 
Posts: 27
Joined: 21 Jul 2016, 09:07
Location: Finland

Re: Advanced 3D sound effects (doppler, reverb...) ala OpenA

PostPosted by cadaver » 19 Oct 2016, 14:32

You would have to add your own implementation into the sound subsystem. You would have to expand it quite substantially, as presently there's no effects at all. Note that contributing such work as a PR would be very welcome, if you're up to it.

Ideally Urho should be using OpenAL. However there doesn't exist a nice permissive software implementation (OpenAL-Soft exists, but is LGPL which we can't include without getting into potential grey areas with linking) and using the implementation tied into the OS would require repeating the linking work per platform, and would miss features on some platforms, such as Web. So using SDL audio we get problem-free linking and feature parity, with the downside that there isn't any features to speak of :(
User avatar
cadaver
Urho3D author
Urho3D author
 
Posts: 1802
Joined: 16 Jan 2014, 14:52
Location: Finland

Re: Advanced 3D sound effects (doppler, reverb...) ala OpenA

PostPosted by TheSHEEEP » 21 Oct 2016, 05:55

I'm not sure I get the LGPL problem.
The usual way to handle that is to link dynamically, put the license in your project and you're done.
You're not hiding the fact you are using it, you provided the license and you didn't change the code.

Of course, what I'm not sure about is how this works with Urho3D's way of coming with its own "custom" dependencies... Maybe you mean that could be an issue?

I remember from having implemented OpenAL soft that it is indeed quite some work and you indeed have to kind of base your sound approach on the idea of "environments".
You don't set audio effects on a single audio source, but more on the audio "world".
It wasn't a nice thing to implement, and I'm afraid as long as my project doesn't need it (and at least the first won't), its more logical for me to not attempt this.

Too bad SDL is limited that way :(
User avatar
TheSHEEEP
Have some posts
Have some posts
 
Posts: 27
Joined: 21 Jul 2016, 09:07
Location: Finland

Re: Advanced 3D sound effects (doppler, reverb...) ala OpenA

PostPosted by cadaver » 21 Oct 2016, 10:49

Replacing a LGPL library on Android / iOS packaged application would be troublesome. So an example of an acceptable solution would be to use the OS's inbuilt version of OpenAL on those, and dynamic linked OpenAL-soft on desktop.
User avatar
cadaver
Urho3D author
Urho3D author
 
Posts: 1802
Joined: 16 Jan 2014, 14:52
Location: Finland

Re: Advanced 3D sound effects (doppler, reverb...) ala OpenA

PostPosted by boberfly » 23 Oct 2016, 01:00

Yeah I made a port long ago for OpenAL for my Pugsy app, it worked out better for the iOS platform at the time which comes with its own OpenAL implementation (for performance reasons and less stutters), especially since I needed capture support for a certain feature. Android just used the normal Urho3D audio.

There's also this library:
http://sol.gfxile.net/soloud/

Which looks promising and implements a lot of OpenAL features but with a more permissive license. The backend can use SDL2 exactly like the current sound implementation uses as well.
User avatar
boberfly
Active user
Active user
 
Posts: 107
Joined: 27 Mar 2014, 01:14
Location: Australia

Re: Advanced 3D sound effects (doppler, reverb...) ala OpenA

PostPosted by yushli » 23 Oct 2016, 01:35

SoLoud looks like quite interesting. Do you have workable sample code to show how to integrate it into Urho3D?
User avatar
yushli
Some active
Some active
 
Posts: 94
Joined: 18 Oct 2014, 05:42

Re: Advanced 3D sound effects (doppler, reverb...) ala OpenA

PostPosted by cadaver » 23 Oct 2016, 10:22

That looks rather cool, thanks!
User avatar
cadaver
Urho3D author
Urho3D author
 
Posts: 1802
Joined: 16 Jan 2014, 14:52
Location: Finland

Re: Advanced 3D sound effects (doppler, reverb...) ala OpenA

PostPosted by boberfly » 23 Oct 2016, 17:48

yushli wrote:SoLoud looks like quite interesting. Do you have workable sample code to show how to integrate it into Urho3D?

Sadly not, but the API looks quite simple to map to the current audio backend of Urho3D and component if you were to use it instead. The component would just need more setters/getters to apply the audio effects and 3D spacial stuff, pretty trivial.

Edit: SoLoud already uses STB Vorbis, no need to do anything custom there either for streaming, you could even load in Vorbis without streaming if it's a short sample.
http://sol.gfxile.net/soloud/wavstream.html
User avatar
boberfly
Active user
Active user
 
Posts: 107
Joined: 27 Mar 2014, 01:14
Location: Australia

Re: Advanced 3D sound effects (doppler, reverb...) ala OpenA

PostPosted by TheSHEEEP » 24 Oct 2016, 07:56

That looks interesting indeed.
So far I only came up with libCricket or irrKlang for an easier (though not permittive license) alternative to OpenAL for my own project.
User avatar
TheSHEEEP
Have some posts
Have some posts
 
Posts: 27
Joined: 21 Jul 2016, 09:07
Location: Finland


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron