Open filip-franek opened 7 months ago
I've just looked into this a little bit, and I think there are potentially a few overlapping issues.
Firstly and most critically, the libsoundio library that SignalFlow uses for cross-platform I/O sadly does not yet support Pipewire. In fact, libsoundio has been somewhat dormant over the past couple of years as its author has gone on to develop the Zig language. I'm hoping that there may be some community contributions in future, but I might look at switching to an alternative. cubeb looks promising.
Secondly, support for non-float32 is not yet implemented, which might currently rule out this particular device even outside of pipewire. I've added an issue for this. I don't think it should be a particularly complex piece of work (converting between float32 and int16 is just a case of a multiply and round), but I don't think I have a suitable device here to test on. At some point and when budget allows, I'd like to pick up a Linux laptop or NUC for testing.
I'm not sure why libasound required a symlink; could be something to do with the way in which 64-bit vs 32-bit libraries are installed by your package manager?
Hey @filip-franek, I have finally got hold of a Linux build machine that I can use for development, and have just pushed a fix for the float32
sample rate issue. If you have a moment to test whether it works at some point, I'd really appreciate it!
You will need to clone the latest commit from the repo and then build from source as described here. The only caveat is that it still won't work via pipewire because of the libsoundio constraint mentioned previously, so you would need to run it via a pure Alsa/Pulseaudio backend.
Thanks @ideoforms . It fixed the error I had before, but it introduced a new one ;).
Have not tried to debug it yet.
Python 3.11.6 (main, Oct 8 2023, 05:06:43) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from signalflow import *
>>> graph = AudioGraph()
Output device: Default ALSA Output (currently PipeWire Media Server) (0Hz, buffer size 8192 samples, 1 channel)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: AudioGraph: Audio output device has zero sample rate
Tried to run it in Docker as well, but it brings up other issues I have to look into.
Dockerfile that can output audio to my soundcard
# Dockerfile
FROM debian:bullseye
# Install necessary packages
RUN apt-get update && apt-get install -y \
alsa-utils \
python3 \
python3-pip\
pulseaudio \
pulseaudio-utils
WORKDIR /app
COPY . /app
RUN pip3 install signalflow
RUN usermod -aG audio root
docker build -t signalflow .
docker run -it --rm -e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native -v ~/.config/pulse/cookie:/root/.config/pulse/cookie --group-add $(getent group audio | cut -d: -f3) --name signalflow signalflow bin/bash
root@f65773f6849a:/app# python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from signalflow import *
>>> graph = AudioGraph()
Output device: Dummy Output Device (48000Hz, buffer size 48128 samples, 1 channel)
>>>
Exception in AudioGraph: Node audioout-soundio cannot render because output buffer size is insufficient (48128 samples requested, buffer size = 2048). Increase the buffer size.
Thanks for re-testing! I suspect the first set of issues must boil down to libsoundio's lack of pipewire support, which would mean replacing SignalFlow's audio hardware abstraction layer. 🫤
For the second tests via Docker, this may be resolvable by simply increasing the audio buffer size by specifying output_buffer_size = 48128
in your ~/.signalflow/config
(info on configuring signalflow). Can you let me know if that helps?
These are my system and audio sound specs:
These are the steps I have taken.
and got this error
I though the issue was:
but the error log also mentioned it could not find the
libasound_module_pcm_pipewire.so
library:I have got that library though:
so to temporarily fix it, I just created a symlink:
Perhaps Alsa has to be restarted afterward
sudo alsa force-reload
.That hopefully fixed the initial error and I run
signalflow test
and got:which suggests that the audio output device being used by the
signalflow
program is not properly configured or recognized by the system, specifically regarding its sample rate.I tried to reconfigure
signalflow configure
to setupoutput_backend_name
andoutput_device_name
, but the device does not seem to be listed insignalflow list-output-device-names
.Any idea how to debug this?