Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No audio - problem #333

Closed
Madvih opened this issue Apr 23, 2019 · 18 comments
Closed

No audio - problem #333

Madvih opened this issue Apr 23, 2019 · 18 comments
Labels

Comments

@Madvih
Copy link

Madvih commented Apr 23, 2019

Having this issue, when trying to play this error occurs:

  Process: 9366 ExecStartPre=/bin/chown raspotify:raspotify /var/cache/raspotify (code=exited, status=0/SUCCESS)
  Process: 9363 ExecStartPre=/bin/mkdir -m 0755 -p /var/cache/raspotify (code=exited, status=0/SUCCESS)
 Main PID: 9369 (librespot)
   CGroup: /system.slice/raspotify.service
           `-9369 /usr/bin/librespot --name raspotify (madosmc) --backend alsa --bitrate 96 --disable-audio-cache --enable-volume-normalisation --linear-volume --initial-volume=100

Apr 24 00:57:23 madosmc librespot[9369]: INFO:librespot_playback::audio_backend::alsa: Using alsa sink
Apr 24 00:57:23 madosmc librespot[9369]: INFO:librespot_core::session: Country: "CZ"
Apr 24 00:57:24 madosmc librespot[9369]: INFO:librespot_playback::player: Loading track "Dreaming Deeper" with Spotify URI "spotify:track:4KPRqt53xnT2Hs2rDGKiRu"
Apr 24 00:57:25 madosmc librespot[9369]: INFO:librespot_playback::player: Track "Dreaming Deeper" loaded
Apr 24 00:57:25 madosmc librespot[9369]: ERROR:librespot_playback::audio_backend::alsa: Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_buffer_size_near' failed with error 'EINVAL: Invalid argument'
Apr 24 00:57:25 madosmc librespot[9369]: ERROR:librespot_playback::player: Could not start audio: Alsa error: PCM open failed
Apr 24 00:57:25 madosmc librespot[9369]: ERROR:librespot_playback::audio_backend::alsa: Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_buffer_size_near' failed with error 'EINVAL: Invalid argument'
Apr 24 00:57:25 madosmc librespot[9369]: ERROR:librespot_playback::player: Could not start audio: Alsa error: PCM open failed
Apr 24 00:57:26 madosmc librespot[9369]: ERROR:librespot_playback::audio_backend::alsa: Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_buffer_size_near' failed with error 'EINVAL: Invalid argument'
Apr 24 00:57:26 madosmc librespot[9369]: ERROR:librespot_playback::player: Could not start audio: Alsa error: PCM open failed

My audio is on SPDIF, I tried change of bitrate, reinstall, changing --device hw:0,1(what should be my SPDIF output)

But nothing helps.

Please help, if you know how.

Thank you

@Madvih Madvih changed the title No audio problem No audio - problem Apr 23, 2019
@ashthespy
Copy link
Member

ashthespy commented Apr 24, 2019

Curious to know what your output device is - could you share details? Could you dump the hw_params when the device is playing something from some other source?
You might need to hunt for your actual card, but try along these lines:

cat /proc/asound/card0/pcm0p/info
cat /proc/asound/card0/pcm0p/sub0/info
cat /proc/asound/card0/pcm0p/sub0/hw_params

My guess would be that it doesn't support the predefined buffer size utilised in the current alsa implementation. Should probably add in a check against snd_pcm_hw_params_get_buffer_size_max to avoid this.

@Madvih
Copy link
Author

Madvih commented Apr 24, 2019

hey, thanks for the reply. I will post it right when I get home from work. I tried to look into this params, but I don't have the knowlage for this yet, need to study it more deep to understand that, meanwhile I turned for help here.

@Madvih
Copy link
Author

Madvih commented Apr 24, 2019

I manage it to work, actualy pulseaudio did. I found similar problem from last year, guy in the topic talks about bad audio drivers for his VERO 4k sound card and hes got it work by setting up pulseaudio. I did the same and it's now working after countless hours of pain :D.

There is a new error msg now, but it's playing good through SPDIF output. Thanks bud!

image

@Madvih Madvih closed this as completed Apr 24, 2019
@kingosticks
Copy link
Contributor

@Madvih Were you just using the Pi's HDMI output or some other audio board? It's great you have a workaround but we need to recreate this issue and fix it. The hw_param values would have been useful.

@Madvih Madvih reopened this Apr 24, 2019
@Madvih
Copy link
Author

Madvih commented Apr 24, 2019

I'm glad to give you any information you need to fix it.

image

image

@Madvih
Copy link
Author

Madvih commented Apr 24, 2019

BTW this information could help too. This thread sovle the problem for me and has same problem, more detailed written.

here

@kingosticks
Copy link
Contributor

When I see raspotify I keep mistakingly assuming it's a raspberry pi. So this is vero4k and whatever soundcard (AML M8 audio) that thing has. We'd specifically need the hw_params output when it's trying to play in the broken state, which I guess is no longer available since its fixed. Oh well.

@kingosticks
Copy link
Contributor

kingosticks commented Apr 24, 2019

Yeh that does help, specially:

AMLogic do not provide a full ALSA driver so if MPD needs to access the soundcard via ALSA it will struggle.

So Yeh. They've got buggy software which they don't seem too bothered about fixing, presumably cause it's outside the scope of the product they sell - fair enough. We can close this, we don't need to worry about a half-baked sound driver.

@Madvih
Copy link
Author

Madvih commented Apr 24, 2019

Yeh that does help, specially:

AMLogic do not provide a full ALSA driver so if MPD needs to access the soundcard via ALSA it will struggle.

So Yeh. They've got buggy software which they don't seem too bothered about fixing, presumably cause it's outside the scope of the product they sell - fair enough. We can close this, we don't need to worry about a half-baked sound driver.
I purged pulseaudio and change it to previous (not working) status, if you are still interested in that data. Just tell me what to write in console... or if I can close this.

@kingosticks
Copy link
Contributor

That's kind of you to do that but personally I'm all for closing this now. Probably isn't anything we can do.

@Madvih
Copy link
Author

Madvih commented Apr 24, 2019

Yeah gotcha, but big thanks for help anyway, your quick answers and keen to help me is much appreciated. If this was different kind of problem, I'm sure of that, you would help me to resolve it quickly! Thanks and have a good night!

@markerdmann
Copy link

@kingosticks I'm currently getting the same error:

[2020-04-03T07:52:56Z ERROR librespot_playback::audio_backend::alsa] Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_buffer_size_near' failed with error 'EINVAL: Invalid argument'
[2020-04-03T07:52:56Z ERROR librespot_playback::player] Could not start audio: Alsa error: PCM open failed

In my case, I'm running on Arch with jack audio.

@ashthespy
Copy link
Member

@markerdmann could you add the info from #333 (comment) so we can look at what the expected hw_parameters should be?

Also, it would seem that your using the alsa backend, and not jack?

@markerdmann
Copy link

@ashthespy Yes, I'll run those commands and post the info here.

After I posted my comment, I noticed librespot has a jack backend. I recompiled and tried running it with the jack backend, but for some reason I'm not hearing any audio or seeing any librespot errors. I'll try running it again in verbose mode.

This is my current setup:

With that setup, audio is working with:

  • Firefox
  • Chrome
  • mplayer
  • vlc (with jack or alsa as the output module)
  • spotify (but it's flakey -- sometimes it freezes up)

It's not working with:

  • librespot and spotifyd (same error)

@markerdmann
Copy link

@ashthespy Here's the output for those three commands:

sendrecv@dogen ~/a/l/t/release (dev)> cat /proc/asound/card2/pcm0p/info
card: 2
device: 0
subdevice: 0
stream: PLAYBACK
id: USB Audio
name: USB Audio
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 0
sendrecv@dogen ~/a/l/t/release (dev)> cat /proc/asound/card2/pcm0p/sub0/info
card: 2
device: 0
subdevice: 0
stream: PLAYBACK
id: USB Audio
name: USB Audio
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 0
sendrecv@dogen ~/a/l/t/release (dev)> cat /proc/asound/card2/pcm0p/sub0/hw_params 
access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 2048
buffer_size: 8192

Is there something else I should print out for the jack device that I see in aplay -L? I'm pretty sure that's the device librespot is trying to play to, because I see the following behavior:

  1. With --backend alsa and no --device, I get the snd_pcm_hw_params_set_buffer_size_near error.
  2. With --backend alsa and --device "sysdefault:CARD=Pro" I get Alsa error PCM open ALSA function 'snd_pcm_open' failed with error 'EBUSY: Device or resource busy'.

These are my qjackctl settings:

image
image

@markerdmann
Copy link

I read this issue #195 and it sounds like the alsa and jack backends are potentially being deprecated in favor of the rodio backend?

I tried recompiling with the rodio backend, and that's working on my system. 👍

@thexperiments
Copy link

Necro tip. I got it working with my DAC which has show the same errors by using --device "plughw:2,0" instead of --device "hw:2,0". As I understand it this way the alsa plugins are involved and can convert if necessary, for my dac it seems that it only supported a bit depth of 32 bit. (Topping DX3 Pro)

@roderickvd
Copy link
Member

Necro tip. I got it working with my DAC which has show the same errors by using --device "plughw:2,0" instead of --device "hw:2,0". As I understand it this way the alsa plugins are involved and can convert if necessary, for my dac it seems that it only supported a bit depth of 32 bit. (Topping DX3 Pro)

That's a good solution. Also in the upcoming librespot release there's native support for 32-bit output, so you could try that and have better sound quality to boot. It's in dev right now if you want to give it a spin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants