arcade icon indicating copy to clipboard operation
arcade copied to clipboard

Documentation: Sound compatibility recommendations

Open pushfoo opened this issue 3 years ago • 5 comments

Documentation request:

What documentation needs to be added?

Information on maximizing cross-platform compatibility for sound assets.

Where should it be added?

Probably the programming guide.

Details

Switching from soloud to pyglet for sound means that we inherit pyglet's issues. On OpenAL backends, only 16 bit audio is supported. Linux users can switch to a pulse backend, but macs reportedly only support 16 bit:

Your audio files are 24bit, but unfortunately the OpenAL backend does not support that. Linux also has a PulseAudio backend available, but for OSX it only has OpenAL. Essentially you need to use 16bit audio files for cross platform support.

A user ran into this on the pyglet discord server, and our users may be more confused by this as beginners. An easy recommendation would be to import assets into Audacity and export as 16 bit PCM wav, which is the default setting for wav export.

pushfoo avatar Jul 14 '22 00:07 pushfoo

Perhaps we should prioritize PulseAudio over OpenAL by default?

Cleptomania avatar Jul 14 '22 00:07 Cleptomania

We could, but that wouldn't address the issue for mac users.

pushfoo avatar Jul 14 '22 00:07 pushfoo

Yeah I still think we should recommend those default WAV settings. That’s going to be by far the most universally usable format.

But perhaps using PulseAudio by default stops the issue for a handful of people, and doesn’t really have a downside I can think of

Cleptomania avatar Jul 14 '22 00:07 Cleptomania

Will it fall back to OpenAL if Pulse fails for whatever reason?

pushfoo avatar Jul 14 '22 00:07 pushfoo

Yeah there is a tuple in sound.py and the order of that is the priority. It can be overridden by users but OpenAL is the default priority

Cleptomania avatar Jul 14 '22 00:07 Cleptomania

As an update to this issue, some distros are switching to PipeWire as their default rather than PulseAudio. It has a Pulse Audio compatibility mode so we may not need to do anything to ensure compatibility, but in the future we might want to prioritize it when available.

pushfoo avatar Feb 15 '23 03:02 pushfoo

@pushfoo I have been running Pipewire with Pyglet/Arcade for close to two years and it just works out of the box. Almost nothing supports PipeWire natively, the PulseAudio compatibility it offers is pretty much flawless though.

Cleptomania avatar Feb 15 '23 04:02 Cleptomania

Just a note that the only reason OpenAL is the only backend for Mac is because it's the only one that supports positional sound on Mac. While another could be added that supports 24 bit, it would cause a small discrepancy between drivers.

caffeinepills avatar Mar 15 '23 15:03 caffeinepills

Perhaps we should prioritize PulseAudio over OpenAL by default?

Given https://github.com/pyglet/pyglet/issues/952, I think we should do the opposite, or at least recommend pipewire-pulseaudio if OpenAL isn't an option for a Linux user.

pushfoo avatar Sep 13 '23 01:09 pushfoo