blaa / WaveSync

Multi-room synchronised audio playback over shaky network connections and cheap (rasbperry pi) hardware.
MIT License
64 stars 13 forks source link

Receiver not working with pulseaudio? #7

Closed tadly closed 5 years ago

tadly commented 5 years ago

From the README I gather that using pulseaudio on the receiver should be possible (even though it's discouraged). Sadly, I can't get it to work.

My test scenario has both, the transmitter and the receiver running on the same device.

I see the transmitter sending data and I see the receiver receiving it. However, I don't see a client show up in pulseaudio. I did try different device-indexes which also did not help.

Anything I'm missing?

For reference my commands:

Transmitter

$ pactl load-module module-simple-protocol-unix rate=44100 format=s16le channels=2 record=true source=0 socket=/tmp/music.source
$ wavesync --tx /tmp/music.source
STATE: dsts=1 total: pkts=100 kB=143 time=0 kB/s: avg=169.746 cur=169.746
STATE: dsts=1 total: pkts=200 kB=287 time=1 kB/s: avg=170.907 cur=172.084
...

Receiver

$ wavesync --rx
Joining multicast group 224.0.0.57
Got new configuration - opening audio stream
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Assuming maximum chunk delay of 3000.00ms in this setup
Queue empty - waiting
Got stream flowing. q_len=31
Drop chunk: q_len=128 delay=-67.9ms < 0. tolerance=15.0ms: P=8.06
Drop chunk: q_len=127 delay=-59.0ms < 0. tolerance=15.0ms: P=6.87
...
blaa commented 5 years ago

I will check it later today (at night probably) but please check with different --device-index on receiver. Starting with 0 up to even 10. That is passed to pyaudio and can change output device to pulseaudio potentially.

On 28 March 2019 10:55:29 CET, tadly notifications@github.com wrote:

From the README I gather that using pulseaudio on the receiver should be possible (even though it's discouraged). Sadly, I can't get it to work.

My test scenario has both, the transmitter and the receiver running on the same device.

I see the transmitter sending data and I see the receiver receiving it. However, I don't see a client show up in pulseaudio. I did try different device-indexes which also did not help.

Anything I'm missing?

For reference my commands:

Transmitter

$ pactl load-module module-simple-protocol-unix rate=44100 format=s16le
channels=2 record=true source=0 socket=/tmp/music.source
$ wavesync --tx /tmp/music.source
STATE: dsts=1 total: pkts=100 kB=143 time=0 kB/s: avg=169.746
cur=169.746
STATE: dsts=1 total: pkts=200 kB=287 time=1 kB/s: avg=170.907
cur=172.084
...

Receiver

$ wavesync --rx
Joining multicast group 224.0.0.57
Got new configuration - opening audio stream
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM
cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No
such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No
such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type
for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type
for card
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No
such file or directory)
attempt to connect to server failed
Assuming maximum chunk delay of 3000.00ms in this setup
Queue empty - waiting
Got stream flowing. q_len=31
Drop chunk: q_len=128 delay=-67.9ms < 0. tolerance=15.0ms: P=8.06
Drop chunk: q_len=127 delay=-59.0ms < 0. tolerance=15.0ms: P=6.87
...

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/blaa/WaveSync/issues/7

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

tadly commented 5 years ago

Oh damn... Channel 8 actually worked.

I've worked with pyaudio before (I prefer sounddevice though because it's more pythonic) but don't remember my output index being this high.

Anyways. This specific issue is concluded (sorry for the buzz) but as a small improvement suggestion...

get_host_api_info_by_index could be used to retrieve the defaultOutputDevice :)

>>> import pyaudio
>>> pyaudio.PyAudio().get_host_api_info_by_index(0)
{'index': 0, 'structVersion': 1, 'type': 8, 'name': 'ALSA', 'deviceCount': 9, 'defaultInputDevice': 8, 'defaultOutputDevice': 8}
blaa commented 5 years ago

Good idea. I was thinking about android-termux-capable output. But that would have to be something OpenGLES-related I guess.

blaa commented 5 years ago

Implemented this in 2.1.0, did small tests only though.