Hi everyone,
I have a question about releasing an audio device (hw:4 for aplay -l, 11 for sounddevice). When I try to access the audio card directly after using pulsesink with this command:
gst-launch-1.0 playbin uri=file:///wake_up_16k.wav audio-sink="pulsesink device=alsa_output.usb-Pollen_Robotics_Reachy_Mini_Audio___________________-00.analog-stereo" ; python -c "import sounddevice as sd, soundfile as sf; sd.play(*sf.read('wake_up_16k.wav'), device=11); sd.wait()"
sounddevice sees the device as busy (0 channels) and returns this error:
sounddevice.PortAudioError: Error opening OutputStream: Invalid number of channels [PaErrorCode -9998]
Interestingly, this issue doesn’t occur when using alsasink:
gst-launch-1.0 playbin uri=file:///wake_up_16k.wav audio-sink="alsasink device=hw:4" ; python -c "import sounddevice as sd, soundfile as sf; sd.play(*sf.read('wake_up_16k.wav'), device=11); sd.wait()"
Adding a sleep 5 between the two commands resolves the problem. Could this be due to pulsesink not releasing the audio device properly, or is it related to PipeWire? I was told to use pulsesink even with PipeWire, althought pipewiresink gives the same result.
For the context this is a simplified example I’ve got with a python script.
Thanks!