luciasoftware / lucia

An audio game engine written in python
GNU Lesser General Public License v3.0
33 stars 15 forks source link

Switching to a single audio backend (library) #43

Open JessicaTegner opened 4 years ago

JessicaTegner commented 4 years ago

Hi. This is a suggestion to switch to one (1) single audio backend. While having multiple audio backends sounded good in alpha development (on paper) it is simply not viable and is too huge a cost to maintain.

The backend we switch to as the single (permanent) audio backend should live up to these criteria:

My thoughts:

OpenAL (or OpenAL Soft which we would be using) is LGPL-licensed and cross platform. Some users have reported strange behaviour when using OpenAL. In addition 3d seams to work kinda strange on some machines. From the OpenAL soft website:

OpenAL provides capabilities for playing audio in a virtual 3D environment. Distance attenuation, doppler shift, and directional sound emitters are among the features handled by the API. More advanced effects, including air absorption, occlusion, and environmental reverb, are available through the EFX extension. It also facilitates streaming audio, multi-channel buffers, and audio capture.

Bass: Bass have support for wave and ogg, both from the filesystem and from streaming from a byte buffer, in addition to a lot of other formats out of the box. Bass also have amazing 3d support with included effects. Bass, however is only free to use for non-commercial use and if one wishes to use it in a commercial title, they would need to buy a license (which is kite expensive). In addition, some developers had problems getting bass up and running on MacOS (myself included).

FMod: FMod, like bass, fulfill all of our requirements except the ability to use it in a commercial title for free.

Soloud: Soloud is a kite interesting one. Soloud fulfill our requirements about licensing and about being able to use it in a commercial title. Soloud supports wave and ogg (and other formats). Something I'm not sure about, is if it supports playing from a byte stream / buffer, like the one given by a resource file. And to what the developers of Soloud had to say about a catch:

SoLoud quite probably doesn't have all the features you'd find in a commercial library like FMOD or WWISE. There's no artist tools, and only limited engine integration.

Don't know if that's a problem or not. In addition I don't know how their 3d support are, and if it's cross platform.

Conclusion

I would say our choice are between OpenAL and Soloud. If someone could get back with some answers about the uncertainty about Soloud's support for 3d, cross platform and playing from byte streams, that would be amazing.

brightening-eyes commented 4 years ago

my suggestion is SoLoud (it has support for playing from byte streams). also thee artistic tools that the author says is related to apps like fmod studio (which fmod has) or some kind of library for playing stuff like interactive music

Timtam commented 4 years ago

Why not decide for one solution, but support multiple backends indirectly by providing the ability to further extend Lucia and support the already existing backends in external repositories? That would allow Lucia to be extended by other individuals if needed and even to add in support for other libraries from scratch where required. BTW: BASS is not that expensive, compared to other libraries.

Amerikranian commented 4 years ago

I am mixed. While I like bass, I am aware of the limits on the commercial use. I heard of FMOD but have never managed to use it in Python (all the wrappers for it are now dead). Open AL's 3d positioning just sounds funky. It's not quite right... the sound never panned to the center on my machine, and it took for ever and a half for the volume of the sound to fade, even when increasing the rolloff factor. Here is how I would proceed: Give us two examples of each library. No code is required, just a recording featuring the libraries effects (reverb, filtering, etc) and one recording where we can hear it in use in a 3d environment. Then follow the user preferences on what sounded most natural to them

JessicaTegner commented 4 years ago

I agree fully with @Amerikranian and his approach with recording samples of it. While I'm aware that Bass's commercial licensing isn't that expensive, it's something the end developer would have to pay, which if you're a single dev, you would be inclined not to do.

Timtam commented 4 years ago

Thats not true, even not in the audio games community, as previous experience with BGT shows. It was paid when it came out, and it got quite a few people who bought it, even the more than $100 to develop commercial games. And to be honest, when producing a game that costs like $20+, paying $250 to $300 once would mean that you've got all the money back as soon as 10 to 15 people purchase it, which isn't even unrealistical in the VI community. Creating recordings however isn't a realistical comparison approach when comparing multiple totally different audio libraries. Reverbation algorithms might differ completely, the parameter scales might be different and the results totally incomparable even when using exactly the same parameters (if they even match in those). You cannot compare systems which almost have nothing in common. There are also extensions which might improve that alot. Example: BASS got BASS_FX which, when used, can create quite cool FX on top of BASS, BASS alone might not sound cool enough, but its deffinitely more extensible than FMOD, soloud or whatever. I even managed to combine it with SteamAudio to get HRTF-based 3D audio working with BASS which works quite nicely, I'm not sure if one could achieve the same using soloud. As I said, stick with e.g. openAL and soloud for example. Its free to use, so no problem using it here, but allow other developers to create backend alternatives too which can be used freely, so everyone can use what he/she wants. Your project is still rather small, creating an audio backend is currently a job of maybe an hour of work for experienced developers, if even.

ashleygrobler04 commented 4 years ago

Hi there, i'd say that we listen to what each audio lib has to offer, and then go appon the prefs of the users.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

JessicaTegner commented 4 years ago

@Timtam would love to see your implementation with the combination of Steam Audio and bass.

Timtam commented 4 years ago

Its still in closed state, since its part of a paper that needs to be approved first, but I will make it open-source as soon as that is done. Its however a rather simple C/C++ shared library and can be implemented in Python as well, either natively by using ctypes or by using tools like Cython. It is however also possible to simply link the library into whatever project you like, as soon as bindings are available for Python of course. I think I will make it available via my Bass4Py project as soon as it comes out too.

SeanTolstoyevski commented 3 years ago

Hi all,

I wrote a wrapper for Openal-soft with Cython.

I have provided a human friendly API. Many operations are handled in the background by C, python and Cython. You can play almost any audio except licensed formats such as mp3.

There is also HRTF support.

What opinion do you have about this?

The project is still private.

There are a few things that never end. And I'm trying to write the documents.

If there are those who want to review, they can reach it from my e-mail. I can add it to the project.

I added Nicklas. I think he is one of the leaders of this project. I don't know if he used my project. If he used it, he can say his opinion.

ivansoto0 commented 3 years ago

Would sound great to look at

SeanTolstoyevski commented 3 years ago

Great, I can release it after 1/2 week.

Then you can browse what might come in handy for this project.

Healthily.

JessicaTegner commented 3 years ago

I have seen it, and it looks really good.

Khalil220 commented 3 years ago

may I suggest Synthizer? If your unsure what Synthizer is. Then check https://forum.audiogames.net/topic/34205/the-synthizer-thread/

JessicaTegner commented 3 years ago

hi @Khalil220 Yes, I have looked at Synthizer, but it is still in it's infancy. It has come a long way, but key elements are missing, such as cross platform support, which I have talked with the developer about, you can find that issue here.

Thanks for the suggestion in any case, and thanks for showing interest in Lucia.

emperor-limitless commented 1 year ago

@Timtam Sorry to revive this but I'm looking into using bass with steam-audio and ran across this, Is this thing still ready? I even just need a little example of the usage and that would be enough.

Timtam commented 1 year ago

Yeah, didn't yet find the time to publish the source, have had quite a bit to do those last years. I packed a zip with the source however. Keep in mind that the code is fairly old, it built against a SteamAudio version that is kinda old nowadays and thus it might not be compatible anymore. The build was realized via SCons, dunno if something changed on that end. Oh and you'll need to ask the BASS developer for the add-on header file, I'm not sure about the license so I won't be sharing that publicly, just in case. Feel free to check the code out and see what you can get of it, its really just a simple "load up BASS and SteamAudio and provide some DLL functions" wrapper kind of thing, nothing special about it. basshrtf.zip