Enabling USB card on Raspberry Pi

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:

aplay -l
aplay -L

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

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:

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



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.

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 :slight_smile:

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:

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

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

You can then test default soundcard with:

speaker-test -c2

Creating the asound.cfg file as instucted is not working… I can’t hear anything. :frowning:
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:

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.

Strange, no sound with the speaker-test -c2?

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

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?

Complete silence… :open_mouth:

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

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

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)

dietpi-software uninstall 35

Install 7.8:

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:

#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

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.

I’ve followed the instructions but it does not work.
It seems that the squeezebox server is not starting even though I’ve done the required steps above.
Maybe there is something wrong/missing?
If I try launching from the command line, this is the output:


NOTE:

If you’re running some unsupported Linux/Unix platform, please use the buildme.sh
script located here:

slimserver-vendor/CPAN at public/7.8 · Logitech/slimserver-vendor · GitHub

If 7.8 is outdated by the time you read this, Replace “7.8” with the major version
You should never need to do this if you’re on Windows or Mac OSX. If the installers
don’t work for you, ask for help and/or report a bug.


Looks like missing CPAN modules. If we install the 7.9 CPAN’s :

wget http://dietpi.com/downloads/binaries/all/logitechmediaserver_7.9.0_CPAN_5.20_armv6hf.tar.gz -O package.tar
tar xvzf package.tar -C /
rm package.tar

We are left with:

root@DietPi:~# squeezeboxserver
The following modules failed to load: DBI JSON::XS

So lets compile those missing CPAN modules:

apt-get install -y cpanminus build-essential yasm nasm libxml-parser-perl zlib1g-dev libjpeg-dev libpng-dev
cpanm DBI JSON::XS

Copy them over to LMS:

cp -R /usr/local/lib/arm-linux-gnueabihf/perl/5.20.2/* /usr/share/squeezeboxserver/CPAN/

LMS 7.8 requires a specific version of Audio::Scan:

Audio::Scan object version 0.95 does not match bootstrap parameter 0.93

So lets compile that Audio Scan version 0.93:

cpanm Audio::Scan@0.93

Copy them over to LMS, again:

cp -R /usr/local/lib/arm-linux-gnueabihf/perl/5.20.2/* /usr/share/squeezeboxserver/CPAN/

Running fine (minus optional cpan module):

root@DietPi:~# squeezeboxserver
NOTE: Class::XSAccessor 1.05+ not found, install it for better performance
[16-10-26 18:31:33.3785] main::init (368) Starting Logitech Media Server (v7.8.0, 1395409907, Thu Mar 27 13:20:53 PDT 2014) perl 5.020002
[16-10-26 18:31:33.3883] main::changeEffectiveUserAndGroup (983) Warning: Logitech Media Server must not be run as root!  Trying user squeezeboxserver instead.
[16-10-26 18:31:34.6240] Slim::Utils::SQLiteHelper::postConnect (359) Optimizing DB because of missing or empty sqlite_stat1 table
[16-10-26 18:31:36.1939] main::checkDataSource (1089) Warning: Schema updated or no media found in the database, initiating scan.
NOTE: Class::XSAccessor 1.05+ not found, install it for better performance
[16-10-26 18:31:37.8168] main::main (202) Starting Logitech Media Server scanner (v7.8.0, 1395409907, Thu Mar 27 13:20:53 PDT 2014) perl 5.020002
[16-10-26 18:31:38.8719] Slim::Schema::forceCommit (2130) Warning: Trying to commit transactions before DB is initialized!
[16-10-26 18:31:39.1424] Slim::Music::Import::runImporter (488) Starting Slim::Media::MediaFolderScan scan
[16-10-26 18:31:39.1437] Slim::Music::Import::endImporter (620) Completed Slim::Media::MediaFolderScan Scan in 0 seconds.
[16-10-26 18:31:39.1657] Slim::Music::Artwork::precacheAllArtwork (608) Starting precacheArtwork for 0 albums
[16-10-26 18:31:39.1669] Slim::Music::Import::endImporter (620) Completed precacheArtwork Scan in 0 seconds.
[16-10-26 18:31:39.1805] Slim::Music::Import::runScanPostProcessing (403) Starting Database optimization.
[16-10-26 18:31:39.1843] Slim::Music::Import::endImporter (620) Completed dbOptimize Scan in 0 seconds.
[16-10-26 18:31:39.3909] Carp::carp (168) Warning: Can't locate auto/Compress/Raw/Zlib/autosplit.ix:   ./auto/Compress/Raw/Zlib/autosplit.ix: Permission denied at /usr/share/perl/5.20/AutoLoader.pm line 181.
 at /usr/share/squeezeboxserver/CPAN/Compress/Raw/Zlib.pm line 6.
[16-10-26 18:31:39.4178] Slim::Utils::Misc::msg (1311) Warning: [18:31:39.4173] Can't locate auto/Compress/Raw/Zlib/autosplit.ix:   ./auto/Compress/Raw/Zlib/autosplit.ix: Permission denied at /usr/share/perl/5.20/AutoLoader.pm line 181.
 at /usr/share/squeezeboxserver/CPAN/Compress/Raw/Zlib.pm line 6.
[16-10-26 18:31:39.4834] Slim::Utils::SQLiteHelper::postConnect (359) Optimizing DB because of missing or empty sqlite_stat1 table

Still not working…

Well, this is funny in an awkward way. After the _n_th reboot, squeezeboxserver has decided to start.
It’s now scanning the library. As soon as it finishes we’ll see if the problem was LMS v7.9 :slight_smile:

EDIT: Artists are now shown correctly. I guess it’s a problem with LMS v7.9, then.
Wouldn’t it be better to get the version on DietPi back to v7.8?

In the ideal world yes, but all people see is numbers and assume the higher the number, the better something is :wink:. Had no end of users ask for 7.9, even when it was in beta.

If 7.8 fixes the artists issue, i’ll make the change. Have you been able to test with 7.8 and confirmed working?

1 sec, just seen your logs, looks like a permissions issue.

EDIT: LMS runs as root, so this error shouldn’t exist.

line 181 of /usr/share/perl/5.20/AutoLoader.pm:

        if (!$replaced_okay or $@) {
            $path ="auto/$calldir/autosplit.ix";
            eval { require $path; };
        }

File exists, not sure why LMS is throwing that error, possible bug in LMS when trying to use a non-absolute path:

root@DietPi-JustBoom:~# find / -type f -name autosplit.ix | grep 5.20
/usr/share/squeezeboxserver/CPAN/arch/5.20/arm-linux-gnueabihf-thread-multi-64int/auto/IO/Interface/autosplit.ix
/usr/share/squeezeboxserver/CPAN/arch/5.20/i386-linux-thread-multi-64int/auto/IO/Interface/autosplit.ix
/usr/share/squeezeboxserver/CPAN/arch/5.20/x86_64-linux-thread-multi/auto/IO/Interface/autosplit.ix

I believe this is a LMS specific bug (or the android client Squeezer) with regards to the artist display.

Your best bet would be to post on the LMS support forum and try to obtain some answers: http://forums.slimdevices.com/forumdisplay.php?27-Logitech-Media-Server

If the artists display works as expected in a standard desktop web browser, the issue may be specific to the Squeezer android app (a bug).

The problem with the Artists view disappears when using v7.8 of LMS.
It’s definitely related to the 7.9 version, and it’s not a bug with the Squeezer app, as I have tried different apps (squeeze remote, and others) and they all show the songwriters/composers instead of the actual artists.
I will try to get information on the LMS support forums.

As far as the problem with the LMS starting, I think (but I am not sure) that it was a problem of compatibility between the database (created by LMS v7.9) and the downgraded LMS.

Everything has been working correctly for two days now, even after several reboots.
In my opinion LMS v7.9 has modified something which broke the apps. Maybe DietPi should offer the installation of both LMS versions, leaving the choice to the users.

I’ll report back if I find out anything useful on the LMS support forums.
Thanks for the patience and support.

Ok, I have asked on the slimdevices forum for this Artists/Composers problem.
Apparently LMS v7.9 has changed something in these regards, and many apps suffer from this problem (all the free ones). It’s not sure whether paid apps are not affected, and I have no means to try because none of them offers any trial versions.

User pippin suggests this solution:

You can configure the way artist lists are shown under “Settings->my music”. You can configure not to show all artists but only albumartist.
And yes, Apps which better support 7.9 might give you both an “all artists” and an “albumartist” list

I had tried this, but it did not work. I will try again and report back if this workaround works.

It works.
LMS v7.9 needs to be set as per the following image. This way, squeeze remote apps like Squeezer and Squeeze control will show Artists correctly: