Hello guys.
I know that libadiverse is a good library for sounds in Python. What if I don't want to create 3D audio in what I'm making. What if I want to load a click for menu sounds, or something of that nature? What if I want to load a sound for a player jumping and landing, obeying the rules of a timer? Can that library mentioned above do this in Python? What would be the right approach for making accessible games in Python? What are some good libraries that could help those of accessible_output2 and that sound library I mentioned above? Any responses would be greatly appreciated.

I love audio gaming!

Thumbs up


You might want to look at pygame. Allthough not the most advanced library, it can do things like basic graphics, keyboard presses, joysticks and sounds. Not anything fancy in the sound area, just pan, pitch and volume I beleave.

golfing in the kitchen

Thumbs up


Even though libraries like Libaudioverse and OpenAL are capable of 3D audio, you don't necessarily have to use them for 3D audio. Those libraries themselves are also exclusively used for audio output, other things like keyboard inputs, graphics, etc. would require separate libraries. Pygames already been mentioned, but there's also [Pyglet] which can handle inputs, along with basic and advanced graphics and audio.

-BrushTone v1.2.3: Accessible Paint Tool

Thumbs up


Pyglet does come with a sound library already or it uses pyal only? And the directx suport as been implemented on the current version?

Thumbs up


PyAL is a separate library using OpenAL and has no direct connection to Pyglet, even if they can be used together. Pyglet itself also has its own bindings for OpenAL, but also has bindings for DirectSound and PulseAudio, but dosen't have any advanced audio features like EFX, HRTF, or 3D positional audio implemented. I do however have some scripts available that adds these features for Pyglets OpenAL bindings.

[Pyglets Directsound] features only support up to DirectX 7, the reason I suspect is because MS dropped support for DirectSound and its advanced audio features starting with Vista in favor of their proprietary XAudio2 library.

-BrushTone v1.2.3: Accessible Paint Tool

Thumbs up


you already mentioned libaudioverse, which is totally able to play sounds without setting up a 3D environment at all. So, if you really want to build some game or something else in python, or generally in any language, it's probably the best to stick with one library as far as possible, since the migration or parallel usage of two or more libraries usually comes with some significant overheadd. So, if you're going to develope some game which requires both 3D and non-3D sounds, use libaudioverse only playback in it, since it would be totally dumb to use e.g. pygame for non-3D and libaudioverse for 3D playback, it just slows down the game engine and doesn't have any advantages at all. If it's just some example code you want for libaudioverse to playback some simple audio file, then say it and I will be glad to give you some example snippet from one of my projects.
Best Regards.

Thumbs up


@Hijacker actually such example code would be nice, as the only way I know how to play sounds in Libaudioverse is by connecting them to a source first.

Follow me on twitter: @savage_genius16

Thumbs up


As soon as you know how to use libaudioverse, which can be kind of difficult to understand if you don't know the node structure used in this library, you can sounds in 3D, as well as non-3D. You just have to connect nodes differently. Of course, if you want to play sounds 3D, you'll have to connect the node to a source which can then be positioned in space. But if you don't want this to happen, you can just connect the BufferNode directly to the audio server without further processing with a source and you'r good to go:

import libaudioverse
import multiprocessing # required to count the available cpu threads for best performance


AudioServer.threads = multiprocessing.cpu_count()

Buffer.load_from_file("path/to/my/audio/file") # or some other way of loading data, e.g. decode_from_array() if you're actually using some in-memory encryption
File.buffer = Buffer
File.connect(0, File.server)

Hope that helps.
The actually great thing with libaudioverse is that you can even use some strange or not widely known encoders, which actually fit your situation better than just ogg or mp3 or something, just by implementing a decoding algorithm (or wrapping an external decoder) and forwarding the decoded data (most likely in 32-bit floating-point data) into libaudioverse, either at once or just parts of it as they are requested. That's the only negative side of libaudioverse. It decodes first and stores all data internally as PCM uncompressed audio data, which blows the used memory up by gigabytes if you don't actually keep an eye on it. That's why I came up with the solution to just store small sounds internally and decode e.g. music and background sounds on the run while playing them back, which reduces my memory consumption to under 100 megabytes.
Best Regards.

Thumbs up