Sound_lib is probably your best bet imho, i’ve used it a few times with no real issues.
You are not logged in. Please login or register.
AudioGames.net Forum → Developers room → Getting started with coding audiogames in Python?
Sound_lib is probably your best bet imho, i’ve used it a few times with no real issues.
it seems like i am to stupid to understand sound_lib. i tried and tried... any ways one day i will start figuring it out. if i am not wrong, it is almost like the system in BGT where you say sound.play() and sound.stop()..
Sound_lib has a problem that I've seen, as it stands it only allows file streams (sample support wasn't put in by the original developer). When operating in low latency environments (i.e. audiogames), sampling sounds from memory is important. For this, sound_lib would need to have a soundObject with a load function that uses an updated versoin of sound_lib with samples support to load sounds into memory, and let the load and stream functions use the loaded sound's memory address for faster loading and more eficient memory use.
This is a project I'm willing to work on, but maybe later.
sound_lib does support memory streams
from sound_lib import stream, output
from sound_lib import stream, output
import ctypes
with open('sound.ogg') as f:
sound= f.read()
array=ctypes.create_string_buffer(sound)
addr=ctypes.addressof(array)
o= output.Output()
handle=stream.FileStream(mem=True, file=addr, length=len(bla))
handle.looping=False
handle.play_blocking()
PS. Indent under the with statement. I did but it doesn't show it here on AG
Huh... wonder why pybass isn't up to date on Pip? I could probably make a C wrapper around it that has no Python bindings other than DLLs (Pybass is missing out on a lot of things: BASS Threaded Mixer, bass_adx, bass_aix, bass_fx, and so on), so I'm wondering if I should try and make my own version that wraps all of those?
You seriously have to mess with ctypes yourself when using sound_lib? Well then...
We should probably invest more time into getting one single working product instead of creating 5 several products, each working a little bit differently. Ctypes isn't that up-to-date with wrapping external code either, but you can probably send pull requests to more advanced wrappers like Bass4Py, since pybass seems to be long dead by now.
Best Regards.
Hijacker
We could always make our own custom version that has all the featurs we need for audio game development in Python and use that. That would give us the flexibility and open-source-ish feeling we'd need to actually develop audio games in Python.
Sure, but why start a totally new project if something doing the job totally fine but only requiring some more little tweaks already exists?
Enhancing this product will be of more use to everyone. Hence the main thought of open source development, many people working on one project in public, instead of everyone cooking their own in privacy.
Best Regards.
Hijacker
True.
I honestly think those are all really good ideas.
Which ones?
writing a more up to date wrapper for bass and trying to work on some audio games like system.
i just wish that we can have some thing that can handle keyboard input reelly well. i am fine with the audio...
Most graphics libraries also have functions for handling keyboard input, Pyglet, Pygame, wxPython, etc.
SDL2 in general is extremely low-level. At least in the C interface I found it extremely hard to figure out and use.
Pygame has OK keyboard handling, not sure about the delay or not because I haven't tried yet, but you can do events like pygame_keydown, etc
so it's good if you want to write a high level wrapper around pygame which lets you do if keyPressed functions, events, etc.
A lot of work is needed, imo.
Well yeah, a lot of work will be needed no matter what you work with. A game framework isn't gonna give you all you need on a silver platter. That's not the point of a game framework or a game engine.
like pygame, pysdl2 has those events, even with support for force feedback (which i don't know if pygame has it).
pysdl2 is a wrapper to sdl2 which is available on here
just do pip install pysdl2 and you will be good to go (without any pygame*.pyd/dll), just sdl2.dll
Well, pygame and pysdl2 almost do the same, since pygame is a wrapper to sdl2 as well. there also is pysfml which uses the sfml library, which is a bit different but almost does the same, but in a little different way.
Best Regards.
Hijacker
i don't like pygame, because first it uses sdl1, and it's code is under gpl (sdl1 was under gpl as well while sdl2 is under zlib).
pysdl2 is a ctypes wrapper around sdl2 which is currently being developed
@visualstudio, how do you know it uses SDL1? It could use SDL2 -- its possible to have a wrapper licensed under the GPL while having the underlying library licensed under something else. SDL2 is a pain. Seriously. Have you ever used its C interface? Its an absolute bitch to use properly. SFML is far easier; the problem with PySFML is that its [still] on Python 3.5, not 3.7 and up. And I'm not going to downgrade to Python 3.5 just to use PySFML. Plus, I just tried pysdl2 and it doesn't work, even when PYSDL2_DLL_PATH is set properly, and even when the SDL2.dll dll is in the directory my code is in. So unless I'm missing something, that's fucked.
@97, first, the cdrom interface was available on sdl1, which as sdl2 is written from scratch, it doesn't have this
second, i've used it, and i didn't have any problem with it.
third, i don't know about pysfml (i've used sfml before, but in terms of keyboard input, text handling etc) sdl2 is really really better.
Not really, no... SFML is better in every way to SDL2. Considering that SDL2 has two different keyboard types (scancodes and keycodes), and not all of the functions have samples on how exactly to use them, and the examples are quite sparce.... yeah, the fact that I'd have to go digging around for examples on how to use it, whereas with SFML, I have experience with (and would rate it highly above SDL2)....
AudioGames.net Forum → Developers room → Getting started with coding audiogames in Python?
Generated in 0.027 seconds (48% PHP - 52% DB) with 11 queries