Enabling USB card on Raspberry Pi

Having issues with your DietPi installation, or, found a bug? Post it here.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Enabling USB card on Raspberry Pi

Post by Sciamano »

Hello.
I'm trying DietPi on my Raspberry Pi 2 model B, in order to use it as a Squeezebox/Squeezelite machine.
I have a USB soundcard on the Pi, to enhance audio output, but I can't seem to make it work: in the dietpi-config audio configuration it is not recognized.
Therefore squeezelite is not sending anything to the correct output (I guess it's sending audio to the 3,5mm jack).
In alsamixer the USB card works (I can select it and change volume) but I can't find a way to make squeezelite use it.
Any help?
Thanks!!
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Enabling USB card on Raspberry Pi

Post by Fourdee »

Sciamano wrote:Hello.
I'm trying DietPi on my Raspberry Pi 2 model B, in order to use it as a Squeezebox/Squeezelite machine.
I have a USB soundcard on the Pi, to enhance audio output, but I can't seem to make it work: in the dietpi-config audio configuration it is not recognized.
Therefore squeezelite is not sending anything to the correct output (I guess it's sending audio to the 3,5mm jack).
In alsamixer the USB card works (I can select it and change volume) but I can't find a way to make squeezelite use it.
Any help?
Thanks!!
Hi,

We will need to manually set the soundcard via /etc/asound.conf, so it becomes default.

Please can you paste the results from the following commands, this will help us find the card we need to set:

Code: Select all

aplay -l
aplay -L
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Enabling USB card on Raspberry Pi

Post by Sciamano »

Thanks for the reply.
I think I solved using a different approach.
I edited /etc/default/squeezelite and I added the following line:

Code: Select all

SL_SOUNDCARD="front:CARD=Set,DEV=0"
Output to the USB soundcard now works.
Was this an improper solution?

Anyway here are the ouputs you requested:

Code: Select all

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: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Code: Select all

null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
dmix:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample mixing device
dmix:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample snooping device
hw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Hardware device with all software conversions
default:CARD=Set
    C-Media USB Headphone Set, USB Audio
    Default Audio Device
sysdefault:CARD=Set
    C-Media USB Headphone Set, USB Audio
    Default Audio Device
front:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    Front speakers
surround21:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    Direct sample mixing device
dsnoop:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    Direct sample snooping device
hw:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Set,DEV=0
    C-Media USB Headphone Set, USB Audio
    Hardware device with all software conversions
Thanks for your help.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Enabling USB card on Raspberry Pi

Post by Fourdee »

Was this an improper solution?
Theres no such thing as a right or wrong way to do things in Linux. Always do whats best for you :)

A different method would be to set the USB card as default soundcard:
From your results we can see the USB card is card 1: Set [C-Media USB Headphone Set], device 0:.
So /etc/asound.conf would be:

Code: Select all

pcm.!default {
   type hw
   card 1
   device 0
}

ctl.!default {
   type hw
   card 1
   device 0
}
You can then test default soundcard with:

Code: Select all

speaker-test -c2
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Enabling USB card on Raspberry Pi

Post by Sciamano »

Creating the asound.cfg file as instucted is not working... I can't hear anything. :(
My solution is working though, so it's not a big problem, although I would like to solve it anyway.

I'm also encountering another strange problem in LMS: even though I've selected certain browse modes, I only actually see different ones in the LMS browsing window (specifically I don't see the "Artists" view) and when connecting to the server using the android app Squeezer, I see the Artists choice, but it shows songwriters/composers rather than the actual band/singer...

See images:

Image

Image

Image

This did not happen on my older LMS installation on Raspbian, and I can't understand why it's behaving like this.
Again, thanks a lot for your help.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Enabling USB card on Raspberry Pi

Post by Fourdee »

Sciamano wrote:Creating the asound.cfg file as instucted is not working... I can't hear anything. :(
My solution is working though, so it's not a big problem, although I would like to solve it anyway.
Strange, no sound with the speaker-test -c2?

Try launching alsamixer and see if it picks up the card, should show you some controls:

Code: Select all

alsamixer
I'm also encountering another strange problem in LMS: even though I've selected certain browse modes, I only actually see different ones in the LMS browsing window (specifically I don't see the "Artists" view) and when connecting to the server using the android app Squeezer, I see the Artists choice, but it shows songwriters/composers rather than the actual band/singer...
Might be a bug in LMS, we install LMS version 7.9 in DietPi. Can you remember which version you installed on Raspbian?
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Enabling USB card on Raspberry Pi

Post by Sciamano »

Fourdee wrote:
Sciamano wrote:Creating the asound.cfg file as instucted is not working... I can't hear anything. :(
My solution is working though, so it's not a big problem, although I would like to solve it anyway.
Strange, no sound with the speaker-test -c2?
Complete silence... :shock:
Try launching alsamixer and see if it picks up the card, should show you some controls:

Code: Select all

alsamixer
I'll do it tomorrow, and report back. Sorry but I had to remove the DietPi card for today, in order to make syncthing work because I need it up and running right now.
I'm also encountering another strange problem in LMS: even though I've selected certain browse modes, I only actually see different ones in the LMS browsing window (specifically I don't see the "Artists" view) and when connecting to the server using the android app Squeezer, I see the Artists choice, but it shows songwriters/composers rather than the actual band/singer...
Might be a bug in LMS, we install LMS version 7.9 in DietPi. Can you remember which version you installed on Raspbian?
It was version 7.8
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Enabling USB card on Raspberry Pi

Post by Sciamano »

Ok, it looks like reflashing the image on a new SD card also solved the problem with the USB soundcard, which now works.
I really would like to solve the problem with the Artists view in LMS, too...
Is there any easy way to install LMS v7.8 on DietPi, in order to check whether this problem is related to v7.9?

EDIT: I have also tried disabling the "Additional Browse Modes" plugin, which I had disabled in v7.8, but it did not solve.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Enabling USB card on Raspberry Pi

Post by Fourdee »

Sciamano wrote:Ok, it looks like reflashing the image on a new SD card also solved the problem with the USB soundcard, which now works.
I really would like to solve the problem with the Artists view in LMS, too...
Is there any easy way to install LMS v7.8 on DietPi, in order to check whether this problem is related to v7.9?

EDIT: I have also tried disabling the "Additional Browse Modes" plugin, which I had disabled in v7.8, but it did not solve.
Yep, so you can remove the DietPi 7.9 (you may lose all configuration/settings for LMS)

Code: Select all

dietpi-software uninstall 35
Install 7.8:

Code: Select all

wget http://downloads.slimdevices.com/LogitechMediaServer_v7.8.0/logitechmediaserver_7.8.0_all.deb -O package.deb
dpkg -i package.deb
If LMS doesnt start after a reboot, try using the DietPi custom service:

Code: Select all

#Remove service
update-rc.d logitechmediaserver remove
rm /etc/init.d/logitechmediaserver

#DietPi-Services init
cp /DietPi/dietpi/conf/squeezeboxserver.service /etc/dietpi/dietpi-software/services/squeezeboxserver.service
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Enabling USB card on Raspberry Pi

Post by Sciamano »

Great information, thanks.
I'll try and report back ASAP.
I'm quite convinced that the problem lies with LMS v7.9 since all the apps that remotely control the squeeze players encounter the same bug (composers shown instead of singers/bands).
It would be nice if other DietPi/LMS users gave their feedback about this, as I find it hard to believe that I am the only one encountering this problem.
Post Reply