No sound from 3.5mm Ear Jack (using mpc-mopidy-spotify)

Following is a repost of a github posting from yesterday

Hi,

I have a raspberry pi connected to a NFC reader, with mpc-mopidy-spotify installed and working.

The NFC reader reads in the spotify URI from a NFC card, and sends it to MPC to play the specific song.

With the command ‘mpc status’, I can see that the specific song is playing with volume set to 100%.

I have raspi-config set to force audio output to the 3.5mm ear jack, and have a speaker connected to the raspberry-pi’s ear jack. The speaker successfully outputs sound when I play youtube, but there is no sound coming from the speaker when MPC is running.

Following is my mopidy.conf :
[audio]
#mixer = softwar
#mixer_volume = 80
#output = autoaudiosink device=hw:1,0
#buffer_time =

When I run the following command, I can hear an audible tone:
$ gst-launch-1.0 audiotestsrc ! audioresample ! autoaudiosink

My MPC/Mopidy-Spotify is all up to date.

Furthermore, following is the output from the command “sudo mopidyctl config”

[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
color = true
console_format = %(levelname)-8s %(message)s
debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n  %(message)s
debug_file = /var/log/mopidy/mopidy-debug.log
config_file = /etc/mopidy/logging.conf

[audio]
mixer = software
mixer_volume = 
output = autoaudiosink
buffer_time = 

[proxy]
scheme = 
hostname = 
port = 
username = 
password = 

[mpd]
enabled = true
hostname = 127.0.0.1
port = 6600
password = 
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist = 
  listall
  listallinfo
default_playlist_scheme = m3u

[http]
enabled = true
hostname = 127.0.0.1
port = 6680
static_dir =
zeroconf = Mopidy HTTP server on $hostname

[stream]
enabled = true
protocols = 
  http
  https
  mms
  rtmp
  rtmps
  rtsp
metadata_blacklist = 
timeout = 5000

[m3u]
enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir = /var/lib/mopidy/playlists

[softwaremixer]
enabled = true

[file]
enabled = true
media_dirs = 
  $XDG_MUSIC_DIR|Music
  ~/|Home
excluded_file_extensions = 
  .jpg
  .jpeg
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[local]
enabled = true
library = json
media_dir = /var/lib/mopidy/media
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions = 
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .png
  .txt

[spotify]
enabled = true
username = cnstest5@gmail.com
password = ********
client_id = 857ef26d-3169-4d5e-b05f-4619e2cd695f
client_secret = ********
bitrate = 160
volume_normalization = true
private_session = false
timeout = 10
allow_cache = true
allow_network = true
allow_playlists = true
search_album_count = 20
search_artist_count = 10
search_track_count = 50
toplist_countries =

Please let me know how I may solve this issue.

Thank you so much!!

Are you running as a user or as a service?
The section from mopidy.conf above shows the relevant sections with # next to them which would mean they are not used, so none of the items on there are on your mopidyctl config.
Perhaps try amending the relevant mopidy.conf depending on how you are using mopidy.
Do you have an hdmi lead plugged in - if the monitor or tv is sound enabled does the sound come through there?
If you do have hdmi cable, try with it removed.

1 Like

Hi Steve, thanks for the feedback.

I am running mopidy as a service, and have a monitor connected to raspberry pi via HDMI cable. When I plug in the 3.5mm jack to the monitor’s 3.5mm plug, it works perfectly - magic!

However, even with the HDMI cable removed, the song does not output from the raspberry pi via 3.5mm plug.

How can I force the output to 3.5mm jack? I have forced 3.5mm output via raspi-config and also edited my mopidy.conf as follows, but the sound is still going through HDMI cable.

[audio]
mixer = software
mixer_volume = 80
output = alsasink device=hw:0,0
buffer_time = 

Following is my output for aplay -l (for reference).

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 7/7
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
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0

Is there any other way to output through 3.5mm jack??
Thanks for your feedback oncea again.

1 Like

To confirm, you are changing /etc/mopidy/mopidy.conf?

you can try changing or making /etc/asound.conf then enter the following;
pcm.!default {
type hw card 0,0
}
ctl.!default {
type hw card 0,0
}

and try changing the audio output back to autoaudiosink then reboot.

And if you are using stretch you might need to make sure mopidy is added to the video users
sudo adduser mopidy video

I would have expected that to stop hdmi output working too but worth checking anyway.

If the above doesn’t work then my guess is that it’s something about how the raspbian gui switches between audio devices. We’ve seen it before where the gui sets per-user control files which override the system settings. Can you compare the contents of /etc/asound.conf with /home/pi/.asoundrc ?

Hi, I know this isn’t really helpful but I think what your doing with NFC is super cool. I’m really curious how you’re doing it, and believe that it could help me with a project I’m working on. also I know someone’s has already said this, but just so I’m contributing in some way those “#” signs shouldn’t be there.

in terminal do sudo raspi-config
this will open up raspi-config settings
go to advanced settings
audio
force through 3.5mm

:slight_smile:

edit: idk if you have already got it or what not but just in case

Hi @donghoon-lee - did you ever resolve this issue? I’m encountering a very similar problem: I’m using a Raspberry Pi, running Mopidy as a service but can’t get output from the Pi’s 3.5mm jack.
Thanks!