Jump to content

Enable USB DAC on Raspotify

Go to solution Solved by girottic,

 

 

I know nothing about Linux and wrestled with this over a couple of days.  Here are the not-very-detailed steps that worked for me:

 

=====================

(Using a new Rpi4)

Install DietPi

:shutdown

 

Connect DAC via USB

Restart Rpi

 

Open: 

:sudo dietpi-config

Audio Options>Soundcard>Select <<Your USB DAC>> or any USB device 

Select>DietPi-Justboom, “EQ Enable [ON]”

 

Save backup of alsa.conf, then confirm that the following entries:

:sudo nano /usr/share/alsa/alsa.conf

defaults.ctl.card 1

defaults.pcm.card 1

 

Test output through DAC:

:speaker-test -c2 -t sine -f 500

Ctrl+c to exit

 

if good . . .

:sudo Dietpi-software

Install Raspotify

 

To set default bitrate to highest available . . . 

Save backup of default/raspotify,, then:

:sudo nano /etc/default/raspotify

Change "#BITRATE=160" to:

“BITRATE=320”

 

:reboot

 

Save backup of asound.conf, then:

#sudo nano /etc/asound.conf

Change “pcm.!default{...” to:

 

pcm.!default{

type asym

playback.pcm {

type plug

slave.pcm "dmix:CARD=1,RATE=48000"

}

}

 

======================
 

The last entry was the magic for me.  I believe the dmix entry is the essential part.  Prior to making that change, the speaker test would work and all seemed well, but there was no sound when playing from Raspotify.

 

If you have questions or need details on the above, I'm not your guy.  I hope this helps though!

 

Good luck!

 

Hello, I successfully installed Raspbian and Raspotify. But when using Spotify on my phone to cast to the Rapsberry Pi, I can't output sound out of the DAC (but only the Raspberry Pi). And the Raspberry Pi sounds awful. I would love to use my DAC. 

 

There are only a few threads online suggesting a few things 

 

- - device hw:1,0 (Doesn't work)

 

disabling the onboard audio chip (access denied, how do I get permission?)

 

Here's the config file for Raspotify. Changing anything in this file doesn't seem to have any effect

 

Spoiler

# /etc/default/raspotify -- Arguments/configuration for librespot

# Device name on Spotify Connect
#DEVICE_NAME="raspotify"

# Bitrate, one of 96 (low quality), 160 (default quality), or 320 (high quality)
#BITRATE="160"

# Additional command line arguments for librespot can be set below.
# See `librespot -h` for more info. Make sure whatever arguments you specify
# aren't already covered by other variables in this file. (See the daemon's
# config at `/lib/systemd/system/raspotify.service` for more technical details.)
#
# To make your device visible on Spotify Connect across the Internet add your
# username and password which can be set via "Set device password", on your
# account settings, use `--username` and `--password`.
#
# To choose a different output device (ie a USB audio dongle or HDMI audio out),
# use `--device` with something like `--device hw:0,1`. Your mileage may vary.
#
#OPTIONS="--username <USERNAME> --password <PASSWORD>"

# Uncomment to use a cache for downloaded audio files. Cache is disabled by
# default. It's best to leave this as-is if you want to use it, since
# permissions are properly set on the directory `/var/cache/raspotify'.
#CACHE_ARGS="--cache /var/cache/raspotify"

# By default, the volume normalization is enabled, add alternative volume
# arguments here if you'd like, but these should be fine.
#VOLUME_ARGS="--enable-volume-normalisation --linear-volume --initial-volume=100"

# Backend could be set to pipe here, but it's for very advanced use cases of
# librespot, so you shouldn't need to change this under normal circumstances.
#BACKEND_ARGS="--backend alsa"

 

Alternatively, is there an OS I can install on the Raspberry Pi which allows me to stream Spotify (via Spotify connect) to an external DAC? 

 

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

 

 

I know nothing about Linux and wrestled with this over a couple of days.  Here are the not-very-detailed steps that worked for me:

 

=====================

(Using a new Rpi4)

Install DietPi

:shutdown

 

Connect DAC via USB

Restart Rpi

 

Open: 

:sudo dietpi-config

Audio Options>Soundcard>Select <<Your USB DAC>> or any USB device 

Select>DietPi-Justboom, “EQ Enable [ON]”

 

Save backup of alsa.conf, then confirm that the following entries:

:sudo nano /usr/share/alsa/alsa.conf

defaults.ctl.card 1

defaults.pcm.card 1

 

Test output through DAC:

:speaker-test -c2 -t sine -f 500

Ctrl+c to exit

 

if good . . .

:sudo Dietpi-software

Install Raspotify

 

To set default bitrate to highest available . . . 

Save backup of default/raspotify,, then:

:sudo nano /etc/default/raspotify

Change "#BITRATE=160" to:

“BITRATE=320”

 

:reboot

 

Save backup of asound.conf, then:

#sudo nano /etc/asound.conf

Change “pcm.!default{...” to:

 

pcm.!default{

type asym

playback.pcm {

type plug

slave.pcm "dmix:CARD=1,RATE=48000"

}

}

 

======================
 

The last entry was the magic for me.  I believe the dmix entry is the essential part.  Prior to making that change, the speaker test would work and all seemed well, but there was no sound when playing from Raspotify.

 

If you have questions or need details on the above, I'm not your guy.  I hope this helps though!

 

Good luck!

 

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks man! I actually figured it out a while back. There’s a much easier way. Something to do with changing a line in the ALSA notepad file. 
 

EDIT: I just bought a Yamaha RN 402 amp with Spotify/Google/Alexa built in and some Klipsch RP 600m speakers for 600€. The deal was so good, I couldn’t resist. Anyways, my Raspberry Pi will be dusty for a while. 

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, girottic said:

Happy to hear you worked it out and thanks for the tip!  Enjoy the new rig too!

It’s effin’ sweet man. Worth every penny. Definitely an impulse buy since my $10 cardboard “exciter” speaker setup was working beautifully. In fact, the mids were better than on the Klipsch RP 600 (which are worth $500 a pair). But the Klipsch are just better in every other way...
 

Anyways, I cannot shut up about it because I’m so happy. And thanks a lot for your help. I actually wanna switch the bitrate on the Pi from 160 to 320. And you showed me how. 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×