electronstudio / raylib-python-cffi

Python CFFI bindings for Raylib
http://electronstudio.github.io/raylib-python-cffi
Eclipse Public License 2.0
152 stars 29 forks source link

no sound since raylib 4.1.0.0.dev0 #94

Closed cyberic99 closed 1 year ago

cyberic99 commented 1 year ago

I am using raylib on linux with python 3.10.7

Using this script:

$ cat c.py 
import time
import pyray
pyray.init_audio_device()
s=pyray.load_sound("sound.wav")
pyray.set_sound_volume(s,1)
pyray.play_sound(s)
time.sleep(1)
$ python3 -mpip install --user --upgrade raylib==4.0.1.0.dev0
# -> sound plays correctly
$ python3 -mpip install --user --upgrade raylib==4.1.0.0.dev0
# -> no sound
# -> I see a 'miniaudi0' source in pavucontrol, but I hear nothing

same with latest version 4.2.1.1

Thank you

electronstudio commented 1 year ago

What Linux distribution are you using?

The main thing that changed between those versions of Raylib Python CFFI was the version of Raylib used. (Although the GitHub Actions build environment also changes regularly and unpredictability) So this seems likely to be either a problem with Raylib itself, or a problem with the way we build Raylib.

Please download Raylib, compile it including examples, and then see if examples such as https://github.com/raysan5/raylib/blob/master/examples/audio/audio_sound_loading.c work

electronstudio commented 1 year ago

If that works, then build Raylib Python CFFI with your Raylib by

pip3 install --no-binary raylib --upgrade --force-reinstall raylib
electronstudio commented 1 year ago

Raylib did a pretty major change to their audio system around this time period so that might be related https://github.com/raysan5/raylib/commit/22c17da4d7b33f1c3a345b2e04e7935e16603ae9

cyberic99 commented 1 year ago

What Linux distribution are you using?

Archlinux, which is a rolling release

Please download Raylib, compile it including examples, and then see if examples such as https://github.com/raysan5/raylib/blob/master/examples/audio/audio_sound_loading.c work

they run but I get no sound. and no specific error is printed

(I used raylib 4.2.0-2 from my package manager, did not try the master)

electronstudio commented 1 year ago

I'm on Arch too. When I run your example the sound plays, and it outputs:

  RAYLIB STATIC 4.2.1.1 LOADED
  INFO: AUDIO: Device initialized successfully
  INFO:     > Backend:       miniaudio / PulseAudio
  INFO:     > Format:        32-bit IEEE Floating Point -> 16-bit Signed Integer
  INFO:     > Channels:      2 -> 2
  INFO:     > Sample rate:   44100 -> 44100
  INFO:     > Periods size:  3304
  INFO: FILEIO: [sound.wav] File loaded successfully
  INFO: WAVE: Data loaded successfully (44100 Hz, 16 bit, 2 channels)

I think it could be something specific to your system. But either way, if the bug is present in Raylib C code (rather than Raylib Python CFFI code) then you'll have to report it to Raylib.

cyberic99 commented 1 year ago

OK, thank you for your answers. I reproduced the issue with only C code, I reported it upstream, I'll let you know about any progress

electronstudio commented 1 year ago

confirmed as bug in raylib/miniaudio so closing

cyberic99 commented 1 year ago

FYI the bug has been resolved in raylib (or rather in miniaudio), see: https://github.com/raysan5/raylib/issues/2740

Thanks