PDA

View Full Version : Running 2 different external DACs from the same Pi using piCorePlayer



muggo
2017-09-30, 10:52
I'm currently running piCorePlayer on a Pi 1 driving a Teddy Pardo USB DAC. It works perfectly & I've added the setup information on the working DACs page.
I'd now like to add a 2nd (& different) DAC using the 2nd USB port on the Pi. I haven't bought the new DAC yet, but would like to know if piCorePlayer will support 2 external DACs concurrently. Perhaps the 2nd DAC will need different settings in piCorePlayer, but I can't see this is an option. Maybe it will work with the same settings...
My other option is to buy a 2nd Pi for the new DAC.
Any advice would be much appreciated.
Many thanks
Paul

drmatt
2017-09-30, 10:53
To play a different stream, we assume...?


Transcoded from Matt's brain by Tapatalk

muggo
2017-09-30, 11:08
To play a different stream, we assume...?


Transcoded from Matt's brain by Tapatalk

No. The 2nd DAC will be dedicated to a headphone amp, so there will be only 1 stream. I figure I'd switch the first DAC to an input I don't use thus keeping the speakers quiet while I'm listening to my headphones.

drmatt
2017-09-30, 11:33
Well, doesn't matter really you could call it a separate stream and leave the two virtual players permanently synced anyway. From what I recall to add a second audio output from PcP you would need to make changes at the shell prompt, I'm not sure there's configuration for that in the UI.

I am sure you could coax alsa in Linux to send the same stream to both DACs somehow too and have a single renderer send audio to both, but you would only gain a little network bandwidth and you may well lose in stability.

Transcoded from Matt's brain by Tapatalk

muggo
2017-09-30, 12:27
Well, doesn't matter really you could call it a separate stream and leave the two virtual players permanently synced anyway. From what I recall to add a second audio output from PcP you would need to make changes at the shell prompt, I'm not sure there's configuration for that in the UI.

I am sure you could coax alsa in Linux to send the same stream to both DACs somehow too and have a single renderer send audio to both, but you would only gain a little network bandwidth and you may well lose in stability.

Transcoded from Matt's brain by Tapatalk

Thanks Matt.
I haven't seen anything relevant in UI.
I'm a complete dunce with Linux & wouldn't know where to start with a shell prompt. As for coaxing alsa in Linux......!
I'll give it a try using the current USB feed from Pi to DAC #1 into DAC #2. I can mess around with settings in UI if required. If that works, I'll try both together. If that fails, I'll have to get another Pi, unless I can get advice on how & what to do at the shell prompt.
I don't need anything sophisticated. Just the ability to drive 2 DACS (1 at a time) from the same Pi.
Cheers
Paul

Man in a van
2017-09-30, 14:06
This might help, or not :p

http://forums.slimdevices.com/showthread.php?107003-Two-Squeezelite-instances-on-one-player

muggo
2017-10-01, 01:32
This might help, or not :p

http://forums.slimdevices.com/showthread.php?107003-Two-Squeezelite-instances-on-one-player

Thanks.
I guess the first thing I have to do it u/g from 1.16 to 3.xx to get the extra functionality.
Beyond backing up my working SD card first, is this a straightforward & automated u/g?

Man in a van
2017-10-01, 02:14
Fresh install on a fast card I reckon:)

Greg Erskine
2017-10-01, 02:16
+1 for fresh install.

drmatt
2017-10-01, 03:12
I'll give it a try using the current USB feed from Pi to DAC #1 into DAC #2. I can mess around with settings in UI if required. If that works, I'll try both together. If that fails, I'll have to get another Pi, unless I can get advice on how & what to do at the shell prompt.
I don't need anything sophisticated. Just the ability to drive 2 DACS (1 at a time) from the same Pi.
Cheers
Paul

The two DACs will not work together without explicit coding in the OS, they will be seen as totally separate devices even if you put them on the same hub. That's why your choices are either to
a) configure a second virtual squeezebox player (aka squeezelite) that is explicitly configured to use the second sound device, or to
b) hack the alsa sound drivers to create a virtual "bridged" sound device that actually sends audio data to both real devices underneath, and *then* configure your squeezelite process to talk to the virtual bridged driver instead of either of the physical drivers underneath..

Very much simpler to do the first option, and there's howtos such as the one linked above for you to follow too. As you say you can always buy another pi too, which may well give you more flexibility in the long term anyway. (Headphone amp nearer to sitting position, for example.)


Transcoded from Matt's brain by Tapatalk

Man in a van
2017-10-01, 04:07
I think a P1 would struggle a bit (although it is possible to increase the USB power).

A rpi 3b with a good power supply might be better. (Then you have your two pi :)).

drmatt
2017-10-01, 04:45
Well I had assumed the DACs were self powered, but that's true if they are bus powered you will need a powered hub.


Transcoded from Matt's brain by Tapatalk

Man in a van
2017-10-01, 11:01
I have just tried this with two usb dacs on a rpi 3b with pCP-standard and the latest LMS.

One dac is a bus powered Stoner UD120 and the other an iFI Nano (with its own battery).

Although I could see all the output options on the Squeezelite settings page, I only managed to get one dac to register as a player.

I swapped the Stoner for a HiFiBerry digi plus pro and both players are registered.

I can't actually test the HiFiBerry at the moment but the optical output is glowing red:)

Edit: as an aside, I seem to have lost the Spotty from "My Apps".:confused:

Every lining has a dark cloud:rolleyes:

Edit: Spotty back after pulling the plug and restarting the following morning :p

muggo
2017-10-01, 14:22
Thanks everyone for their help.
I've decided to buy another Pi to drive the 2nd DAC. For the cost involved it seems the easiest option, especially as I'm no Linux or pCP expert.
At the same time, I'll take the opportunity to see what 3.2x has to offer.
Cheers
Paul

Roland0
2017-10-01, 15:06
Using ALSA to send the same audio to multiple devices isn't that complicated, it just involves editing one file - see this post (http://forums.slimdevices.com/showthread.php?106885-piCorePlayer-3-1-can-you-send-the-audio-output-to-HDMI-and-analog&p=874878&viewfull=1#post874878).

Man in a van
2017-10-02, 00:55
Cheers Roland0

I'll maybe try this later today with both usb dacs connected.

Man in a van
2017-10-02, 07:40
Cheers Roland0

I'll maybe try this later today with both usb dacs connected.


Well this is the list of devices


**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: DA [DA], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 1: DA [DA], device 1: USB Audio [USB Audio #1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Audio [iFi (by AMR) HD USB Audio], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

and this is the file example referred to by Roland0


pcm.!default {
type plug
slave {
pcm "both"
}
}
pcm.both {
type route
slave {
pcm multi
channels 4
}

ttable.0.0 1.0
ttable.1.1 1.0
ttable.0.2 1.0
ttable.1.3 1.0
}
pcm.multi {
type multi
slaves.a {
pcm "analog"
channels 2
}
slaves.b {
pcm "hdmi"
channels 2
}
bindings.0.slave a
bindings.0.channel 0
bindings.1.slave a
bindings.1.channel 1
bindings.2.slave b
bindings.2.channel 0
bindings.3.slave b
bindings.3.channel 1
}
pcm.hdmi {
type hw
card 0
device 0
channels 2
}
pcm.analog {
type hw
card 0
device 3
channels 2
}


As both cards use "USB Audio" for their name, will I be able to use them?

paul-
2017-10-02, 09:48
Should still work because they have different card numbers. In the example case the same card provided two output.

The labels pcm.hdmi and pcm.analog in the example are completely arbitrary. card and device are what defines the selection

In your case, this should define your two devices.

pcm.usb1 {
type hw
card 1
device 0
channels 2
}

pcm.usb2 {
type hw
card 2
device 0
channels 2
}

Man in a van
2017-10-02, 11:19
Well thanks a lot Paul and Roland, I actually got it to work :)

First off I made a fresh v3.22 image on the rpi3b and connected both dacs.

I substituted the wording as directed by Paul.

I used Winscp to change the file, at first it refused me permission to rename the asound.conf to asoundold.conf, so I just replaced the text and pressed save.

Again I had a permissions refusal with, I think, code 3. Anyway i just ignored that as the text seem to be saved, I did press "Backup" in the web gui as directed by Greg.

Alas, when I started Radio Paradise, not a peep from either dac :eek: (Using one set of headphones between the two).

Well it was nearly tea time and we all know a "Bear of little brain" needs food, so I had a think and checked the Squeezelite page.

Good move on my part, as I had forgotten to change the output from Analogue to USB, save and reboot and Radio Paradise plays.

Don't know if I'll ever use it properly, but a good exercise :cool:

Ronnie

ElEsido
2018-05-18, 16:56
Hi

I'm trying to do this in order to compare three UBS dacs. However I can't get it to work, can you help me?

The system is a Picoreplayer Linux on a RPi3.


tc@piCorePlayer:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Amanero [Combo384 Amanero], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 1: DG8SAQI2C [DG8SAQ-I2C], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

The card called "Codec" is a ibasso D10


squeezelite -l
Output devices:
null - Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=Amanero - Combo384 Amanero, USB Audio - Default Audio Device
front:CARD=Amanero,DEV=0 - Combo384 Amanero, USB Audio - Front speakers
surround21:CARD=Amanero,DEV=0 - Combo384 Amanero, USB Audio - 2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Amanero,DEV=0 - Combo384 Amanero, USB Audio - 4.0 Surround output to Front and Rear speakers
surround41:CARD=Amanero,DEV=0 - Combo384 Amanero, USB Audio - 4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Amanero,DEV=0 - Combo384 Amanero, USB Audio - 5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Amanero,DEV=0 - Combo384 Amanero, USB Audio - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Amanero,DEV=0 - Combo384 Amanero, USB Audio - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Amanero,DEV=0 - Combo384 Amanero, USB Audio - IEC958 (S/PDIF) Digital Audio Output
sysdefault:CARD=DG8SAQI2C - DG8SAQ-I2C, USB Audio - Default Audio Device
front:CARD=DG8SAQI2C,DEV=0 - DG8SAQ-I2C, USB Audio - Front speakers
surround21:CARD=DG8SAQI2C,DEV=0 - DG8SAQ-I2C, USB Audio - 2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=DG8SAQI2C,DEV=0 - DG8SAQ-I2C, USB Audio - 4.0 Surround output to Front and Rear speakers
surround41:CARD=DG8SAQI2C,DEV=0 - DG8SAQ-I2C, USB Audio - 4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=DG8SAQI2C,DEV=0 - DG8SAQ-I2C, USB Audio - 5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=DG8SAQI2C,DEV=0 - DG8SAQ-I2C, USB Audio - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=DG8SAQI2C,DEV=0 - DG8SAQ-I2C, USB Audio - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=DG8SAQI2C,DEV=0 - DG8SAQ-I2C, USB Audio - IEC958 (S/PDIF) Digital Audio Output
sysdefault:CARD=CODEC - USB Audio CODEC, USB Audio - Default Audio Device
front:CARD=CODEC,DEV=0 - USB Audio CODEC, USB Audio - Front speakers
surround21:CARD=CODEC,DEV=0 - USB Audio CODEC, USB Audio - 2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=CODEC,DEV=0 - USB Audio CODEC, USB Audio - 4.0 Surround output to Front and Rear speakers
surround41:CARD=CODEC,DEV=0 - USB Audio CODEC, USB Audio - 4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=CODEC,DEV=0 - USB Audio CODEC, USB Audio - 5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=CODEC,DEV=0 - USB Audio CODEC, USB Audio - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=CODEC,DEV=0 - USB Audio CODEC, USB Audio - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=CODEC,DEV=0 - USB Audio CODEC, USB Audio - IEC958 (S/PDIF) Digital Audio Output

asound.conf

# default - Generated by piCorePlayer
#pcm.!default {
# type plug
# slave.pcm "hw:0,0"
#}


pcm.!default {
type plug
slave {pcm "three"}
}

pcm.three {
type route
slave {
pcm "multi"
channels 6
}
ttable.0.0 1.0
ttable.1.1 1.0
ttable.0.2 1.0
ttable.1.3 1.0
ttable.0.4 1.0
ttable.1.5 1.0
}

pcm.multi {
type multi
slaves.a {
pcm "usb0"
channels 2
}
slaves.b {
pcm "usb1"
channels 2
}
slaves.c {
pcm "usb2"
channels 2
}
bindings.0.slave a
bindings.0.channel 0
bindings.1.slave a
bindings.1.channel 1
bindings.2.slave b
bindings.2.channel 0
bindings.3.slave b
bindings.3.channel 1
bindings.4.slave c
bindings.4.channel 0
bindings.5.slave c
bindings.5.channel 1
}


pcm.usb0 {
type hw
card 0
device 0
channels 2
}

pcm.usb1 {
type hw
card 1
device 0
channels 2
}

pcm.usb2 {
type hw
card 2
device 0
channels 2
}


The above alsa.conf does not work. Squeezelite does not start with "default" in the Picoreplayer web gui output settings field, or when I leave this field empty.

Entering one of the dacs in the output field does work.

sysdefault:CARD=Amanero
sysdefault:CARD=DG8SAQI2C
sysdefault:CARD=CODEC


However, I'd like to let them all paly simultaneously. Any help how to get sound simultaneously from all three dacs would be most welcome.