Git Product home page Git Product logo

Comments (11)

berrnd avatar berrnd commented on July 28, 2024 5

Hi,

had the same problem and stumbled over this while searching ... got it working by adding --onstart 'sudo amixer cset numid=3 1' --onstop 'sudo amixer cset numid=3 0' to OPTIONS.

See the Raspberry Pi documention, you also maybe have to add raspotify ALL = (root) NOPASSWD: /usr/bin/amixer to your /etc/sudoers.

from raspotify.

xtraminty avatar xtraminty commented on July 28, 2024 4

I was having the same issue and just wanted to post the (fairly) simple fix I found for it. It's a little messy but it still works anyway.

Anyway, I'm running OSMC, which as it's not Raspbian means I can't use the Raspi config method or anything with the amixer. Instead what I found to do was edit the actual /boot/config.txt file using a simple sudo nano and added hdmi_ignore_edid_audio=1

I don't fully understand why it works but I think the command stops any sound to the display and so the service instead defaults to the analogue output. I presume this command would also mean anything else you had running that wasn't OSMC/kodi would also default to analogue audio. OSMC still works fine with audio coming out over HDMI and/or analogue so no issues there

from raspotify.

F2210 avatar F2210 commented on July 28, 2024 1

@WolfgangHusen you could try using this thread to awnser your question:
https://www.raspberrypi.org/forums/viewtopic.php?f=26&t=11086

This is the awnser given:

In that case you can force it from a command line prompt...
Code: Select all
sudo amixer cset numid=3 <n>
where n is 0=auto, 1=headphones, 2=hdmi.
Change to 1 to force sound through the 3.5mm headphone jack :D

Since I'm not sure this command is persistent after reboot, just follow the following steps to make the change persistent after boot.

To keep this change, just add this line to the crontab file:
if you are using a rpi with desktop, open a terminal, if not just issue the commands in the command line interface.

  1. change to root user
    sudo su
    password is prompted, just enter your sudo password (user password)
  2. open the crontab file
    crontab -e
  3. add the line (using the nano file editor)
    add this line at the bottom of the file:
    @reboot amixer cset numid=3 <1>
    this runs the command after every boot
  4. if using nano file editor, issue 'ctrl-x', then 'y', then just press enter.
    reboot and see if it worked.

from raspotify.

dtcooper avatar dtcooper commented on July 28, 2024

I can try to help. Could you paste the contents of your /etc/default/raspotify please!

from raspotify.

kaisteltner avatar kaisteltner commented on July 28, 2024

GNU nano 2.2.6 File: /etc/default/raspotify

/etc/default/raspotify -- Arguments for librespot

Device name on Spotify Connect
DEVICE_NAME="Raspberry"

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

Additional command line arguments for librespot can be set below.
See librespot -h for more info.

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 XXXXXX --password XXXXXXX --device hw:0"


This is it. I couldn't get the code to show up as a "whole codeblock". I got rid of the commentmarks since they turned everything in huge letters.

from raspotify.

magnulu avatar magnulu commented on July 28, 2024

Thank you so much for this fix. OSMC first-timer, also raspotify virgin. You made my day :-)

from raspotify.

mreigosa avatar mreigosa commented on July 28, 2024

the same problem here, is this the solution?:
OPTIONS="--onstart 'sudo amixer cset numid=3 1' --onstop 'sudo amixer cset numid=3 0'"
or should be:
OPTIONS="--device hw:0 --onstart 'sudo amixer cset numid=3 1' --onstop 'sudo amixer cset numid=3 0'"

because I still have only hdmi sound

from raspotify.

WolfgangHusen avatar WolfgangHusen commented on July 28, 2024

Help folks,
same issues on all my raspis: sound via HDMI works, but not on Jack.
Here my option file (nothing special - at the bottom you see some things I tried according the recommendations above):

/etc/default/raspotify -- Arguments for librespot

Device name on Spotify Connect

DEVICE_NAME="JajaSpot"

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.

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 <...> --password "

Uncomment to use a cache for downloaded audio files. It's best to leave this

as-is since permissions are properly set on directory `/var/cache/raspotify'.

#CACHE_ARGS="--cache /var/cache/raspotify"

#--onstart 'sudo amixer cset numid=3 1'
#--onstop 'sudo amixer cset numid=3 0'

#OPTIONS="--onstart 'sudo amixer cset numid=3 1' --onstop 'sudo amixer cset numid=3 0' --device 'hw:0,0'"
#OPTIONS="--onstart 'sudo amixer cset numid=3 1' --onstop 'sudo amixer cset numid=3 0'"
OPTIONS:"--device 'hw:0,0'"

STATUS here (seems to be fine):
pi@jajaraspi:~ $ sudo systemctl status raspotify -l
● raspotify.service - Raspotify
Loaded: loaded (/lib/systemd/system/raspotify.service; enabled)
Active: active (running) since Sa 2017-12-02 14:46:46 CET; 4s ago
Process: 24901 ExecStartPre=/bin/chown raspotify:raspotify /var/cache/raspotify (code=exited, status=0/SUCCESS)
Process: 24898 ExecStartPre=/bin/mkdir -p 0755 /var/cache/raspotify (code=exited, status=0/SUCCESS)
Main PID: 24904 (librespot)
CGroup: /system.slice/raspotify.service
└─24904 /usr/bin/librespot --name JajaSpot --backend alsa --bitrate 160 --disable-audio-cache

Dez 02 14:46:46 jajaraspi systemd[1]: Started Raspotify.
Dez 02 14:46:46 jajaraspi librespot[24904]: INFO:librespot: librespot 8971d3a (2017-10-05). Built on 2017-10-05. Build ID: POyxPQVg
Dez 02 14:46:47 jajaraspi librespot[24904]: WARN:mdns::fsm: error sending packet Error { repr: Os { code: 99, message: "Cannot assign requested address" } }

And on the Spotify Browser app I can select the raspi and it runs, but no sound.

from raspotify.

WolfgangHusen avatar WolfgangHusen commented on July 28, 2024

thanks @jb2210, with your feedback and the other comments I could make it work.

from raspotify.

scred47 avatar scred47 commented on July 28, 2024

I was having the same issue and just wanted to post the (fairly) simple fix I found for it. It's a little messy but it still works anyway.

Anyway, I'm running OSMC, which as it's not Raspbian means I can't use the Raspi config method or anything with the amixer. Instead what I found to do was edit the actual /boot/config.txt file using a simple sudo nano and added hdmi_ignore_edid_audio=1

I don't fully understand why it works but I think the command stops any sound to the display and so the service instead defaults to the analogue output. I presume this command would also mean anything else you had running that wasn't OSMC/kodi would also default to analogue audio. OSMC still works fine with audio coming out over HDMI and/or analogue so no issues there

This is what worked for me same setup osmc with raspberrypi2

from raspotify.

Delphae avatar Delphae commented on July 28, 2024

What worked for me was the suggestion of F2210:
run on the command line
sudo amixer cset numid=3 1

the audio is sent to the jack output
I am running Volumio on a Raspberry 3B
after reboot it remains sending the audio to jack :-)

from raspotify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.