ralph-irving / squeezelite

Lightweight headless squeezebox player for Lyrion Media Server
https://sourceforge.net/projects/lmsclients/files/squeezelite/
Other
387 stars 98 forks source link

Multiple Identical Dacs w/squuezelite emulation. #174

Closed faux-peter closed 1 year ago

faux-peter commented 1 year ago

Ralph, I am unable to stream multiple identical dacs of the same type. I can use the first DAC, say Adapt, but fails to stream Adapt_1 and Adapt_2. They show up in LMS but I think they are reported as busy.

I poked around and see that some dacs do not have a unique iserialnumber so the only way I can see them being identified is by physical usb port (ex usb-0000:03:00.0-3). Obviously, that means they always have to be plugged into the same USB port.

I know ALSA supports multiple dacs of the same type but I don't know how to get it working through squeezelite.

ralph-irving commented 1 year ago

I have a system with sound cards CODEC and CODEC_1. You must set a unique mac address on the 2nd instance using the -m parameter. For example;

squeezelite -o hw:CARD=CODEC

squeezeltie -o hw:CARD=CODEC_1 -m 00:00:00:AB:CD:EF

Just replace the CODEC and CODEC_1 with the device names for your system.

faux-peter commented 1 year ago

This is how I have it set.

/usr/local/bin/squeezelite -n 'Office' -o hw:CARD=Adapt_1 -a 80:::1: -m 8c:fb:61:9d:06:40 -C 15 -s 127.0.0.1 -z &

/usr/local/bin/squeezelite -n 'Kitchen_Player' -o hw:CARD=Adapt -a 80:::1: -m cc-a0-3c-c8-28-fa -C 15 -s 127.0.0.1 -z &

Not sure what I'm doing wrong but this failed to play Office.

faux-peter commented 1 year ago

Well I did get Office to play after I paused Kitchen_player. It took 15 to 20 seconds but I can't stream different music to each at the same time.

PaulWebster commented 1 year ago

Your syntax for the “MAC” in your 2nd player looks wrong.PaulOn 19 Dec 2022, at 17:18, faux-peter @.***> wrote: Well I did get Office to play after I paused Kitchen_player. It took 15 to 20 seconds but I can't stream different music to each at the same time.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

faux-peter commented 1 year ago

I fixed the MAC syntax but no luck. With the -C command the Office will play when kitchen is paused for 15 seconds. However they will not play at the same time. Is your setup using identical DAC's?

ralph-irving commented 1 year ago

Yes I'm using two Behringer UCA-202 USB audio adapters.

Try stopping both squeezelite instances and installing the Client Cleanup plugin in LMS. Then delete any and all instances of both players that may exist with client cleanup.

If you still have problems try removing -s 127.0.0.1 from both to let squeezelite discover your lms server.

faux-peter commented 1 year ago

Installed Client Cleanup, stopped squeezelite players, removed -s 127.0.0.1 and rebooted but same issue. Do you think it's because these USB dac's don't have an iserial number? I know the Behringer does because I have a UCA 222. Just stabbing in the dark.

Thanks for mentioning the Client Cleanup plugin, I certainly could have used it in the past.

faux-peter commented 1 year ago

closed by accident..

ralph-irving commented 1 year ago

Squeezelite does not know anything about device serial numbers so that's unlikely to be the cause.

I've assumed you're running squeezelite on linux, which flavour and is pipewire or pulse audio enabled. If so, have you tried the pulseaudio build of squeezelite?

It really seems that another process has grabbed one of the audio devices.

What does alsacap report with both squeezelite instances shutdown? You'll find the source in the repo and the command to build it is at the top of the file.

If none of the above helps, then I'd suggest running both squeezelite commands in separate terminal sessions adding -d all=debug and remove -z so the processes stay in the foreground.

faux-peter commented 1 year ago

I'm running it on Raspberry Pi 4 via PiCorePlayer. I will try your suggestions. Not sure about pipewire on PCP.

faux-peter commented 1 year ago

This is what is says without any squeelite running. ` Scanning for playback devices

Card 0, ID Headphones', namebcm2835 Headphones' Device 0, ID bcm2835 Headphones', namebcm2835 Headphones', 8 subdevices (8 available) 1..8 channels, sampling rate 8000..192000 Hz Sample formats: U8, S16_LE Buffer size range from 80 to 131072 Period size range from 80 to 131072 Subdevice 0, name subdevice #0' Subdevice 1, namesubdevice #1' Subdevice 2, name subdevice #2' Subdevice 3, namesubdevice #3' Subdevice 4, name subdevice #4' Subdevice 5, namesubdevice #5' Subdevice 6, name subdevice #6' Subdevice 7, namesubdevice #7'

Card 1, ID Adapt', nameUSB-A to 3.5mm Jack Audio Adapt' Device 0, ID USB Audio', nameUSB Audio', 1 subdevices (1 available) 2 channels, sampling rate 8000..48000 Hz Sample formats: S16_LE, S24_3LE Buffer size range from 22 to 96000 Period size range from 11 to 48000 Subdevice 0, name `subdevice #0'

Card 2, ID CODEC', nameUSB Audio CODEC' Device 0, ID USB Audio', nameUSB Audio', 1 subdevices (1 available) 1..2 channels, sampling rate 32000..48000 Hz Sample formats: S8, U8, S16_LE Buffer size range from 64 to 96000 Period size range from 32 to 48000 Subdevice 0, name `subdevice #0'

Card 3, ID Adapt_1', nameUSB-A to 3.5mm Jack Audio Adapt' Device 0, ID USB Audio', nameUSB Audio', 1 subdevices (1 available) 2 channels, sampling rate 8000..48000 Hz Sample formats: S16_LE, S24_3LE Buffer size range from 22 to 96000 Period size range from 11 to 48000 Subdevice 0, name subdevice #0'

faux-peter commented 1 year ago

Two separate terminals from ssh logins. With the first playing audio this is the output of the second.

[17:25:45.338261] slimproto:898 connecting to 192.168.1.29:3483 [17:25:45.338489] slimproto:937 connected [17:25:45.338541] slimproto:948 local player [17:25:45.338578] sendHELO:148 mac: 15:da:35:63:d3:5f [17:25:45.338615] sendHELO:150 cap: CanHTTPS=1,Model=squeezelite,AccuratePlayPoints=1,HasDigitalOut=1,HasPolarityInversion=1,Balance=1,Firmware=v1.9.9-1403-pCP,ModelName=SqueezeLite,MaxSampleRate=48000,dsf,dff,alc,aac,ogg,ops,ogf,flc,aif,pcm,mp3,loc [17:25:45.688184] process:528 setd [17:25:45.688282] sendSETDName:254 set playername: Office [17:25:45.688413] process:528 setd [17:25:45.688601] process:528 aude [17:25:45.688644] process_aude:422 enable spdif: 1 dac: 1 [17:25:45.689002] process:528 audg Server: Logitech Media Server (8.3.0 - 1667251155) Connection: close Content-Type: audio/mpeg Set-Cookie: Squeezebox-albumView=; path=/ Set-Cookie: Squeezebox-expandPlayerControl=true; path=/ Set-Cookie: Squeezebox-expanded-MY_MUSIC=1; path=/ Set-Cookie: Squeezebox-expanded-FAVORITES=0; path=/ Set-Cookie: Squeezebox-expanded-PLUGINS=1; path=/ Set-Cookie: Squeezebox-expanded-PLUGIN_MY_APPS_MODULE_NAME=1; path=/ Set-Cookie: Squeezebox-expanded-RADIO=1; path=/

Just kept repeating the following until I turned off the first player

[17:26:29.578700] sendRESP:226 RESP [17:26:29.579877] _check_lame_header:163 gapless: skip: 2257 samples: 194375092 delay: 1105 padding: 763 [17:26:29.580240] mad_decode:247 setting track_start [17:26:29.580277] mad_decode:276 gapless: skipping 1152 frames at start [17:26:29.580514] mad_decode:276 gapless: skipping 1105 frames at start [17:26:29.676945] output_thread:685 open output device: hw:CARD=Adapt_1 [17:26:29.677054] alsa_open:354 opening device at: 44100 [17:26:29.678463] alsa_open:425 opened device hw:CARD=Adapt_1 using format: S24_3LE sample rate: 44100 mmap: 1 [17:26:29.678629] alsa_open:516 buffer: 80 period: 4 -> buffer size: 3528 period size: 882 [17:26:29.681911] ALSA snd_pcm_hw_hw_params:386 SNDRV_PCM_IOCTL_HW_PARAMS failed (-28) [17:26:29.682025] alsa_open:533 unable to set hw params: No space left on device [17:26:32.000992] process:528 strm [17:26:32.001899] process_strm:280 strm command t [17:26:32.002947] sendSTAT:195 STAT: STMt [17:26:34.682186] output_thread:685 open output device: hw:CARD=Adapt_1 [17:26:34.682358] alsa_open:354 opening device at: 44100 [17:26:34.683531] alsa_open:425 opened device hw:CARD=Adapt_1 using format: S24_3LE sample rate: 44100 mmap: 1 [17:26:34.683652] alsa_open:516 buffer: 80 period: 4 -> buffer size: 3528 period size: 882 [17:26:34.687564] ALSA snd_pcm_hw_hw_params:386 SNDRV_PCM_IOCTL_HW_PARAMS failed (-28) [17:26:34.687644] alsa_open:533 unable to set hw params: No space left on device

It just continues

ralph-irving commented 1 year ago

pcp only provides alsa so no need to worry about it.

I've never seen that specific error with alsa_open. The obvious would be to confirm none for your filesystems are full.

If not, try forcing 16 bit output instead of the default 24 supported by the adapters. It might be a resource issue with the usb bus. Use -a 80::16:1: instead of what you currently have set.

faux-peter commented 1 year ago

It worked using 80::16:1:

Huge thank you to you, Ralph.

There's plenty of room on the filesystem. 266M used of 58.4G and the audio files are on a 1TB SSD via USB.

Thank you again for taking the time to assist me, I really appreciate it.

Is there a limit to how many dacs can be supported? I don't really understand what the issue was? I'm gathering from what you wrote I can't add a USB hub and more dacs?

ralph-irving commented 1 year ago

That's great. You're welcome.

There's no limit in squeezelite, but the slower usb buses 1.1 and 2.0 have a bandwidth limit.