GNOME Bugzilla – Bug 667917
alsasink: Rate doesn't match (requested 88200Hz, get 0Hz)
Last modified: 2012-07-31 12:21:27 UTC
Hi all, perhaps someone can help me fix this in my player. So, I have an external USB sound card/DAC that supports the following sample rates 8000, 16000, 32000, 41000, 48000, 96000. I use Guayadeque to play my music. I have a variety of flac music files (mostly 44.1, 48, and 96 kHz) that I play in the "bit-perfect" configuration by choosing the {Output device = ALSA and "hw:0,0"}. This generally automatically sends the music file "as is" to the sound card without any prior down- or up-sampling. I also have some 196 kHz files that I got from HDtracks.com. These files are handled by being down-sampled to 96 kHz and sent as such to the external sound card by the Guayadeque program. This is expected, since my card does not support the 196 KHz sample rates. However, here comes the confusing part -- I recently tried to play some 88.2 kHz rate files -- and the player returns the following error: "Error: Gstreamer error 'Could not get/set settings from/on resource.'" When I change the {Output device = PulseAudio} with all the other settings as default, I get a slightly different error message: "Error: Gstreamer error 'Resource not found.'" This confusing since one would simply expect for the file to be down-sampled to 44.1 kHz (just like the 192 KHz is to 96 kHZ), i.e. one-half sample rate. Also strange is that Guayadeque will play 24/176.4 kHz file without any problems. On my system it down-samples it to 96kHz which is what my card can process. Since 44.1, 88.2 and 176.4 kHz are all multiples of each other, it is strange that it only has problems down-sampling the 88.2 kHz files. How can we fix this? The 88.2 kHz files shouls be down-sampled to 44.1 kHz to be played. __________________________ When I try creating a pipeline: gst-launch-0.10 filesrc location=/home/hrvoje/Music/sample/sample.flac ! decodebin ! audioconvert ! audioresample ! alsasink device="dmix:0,0" I get no problems and the file plays well. It down-samples the file to 48kHz and sends it to my card. However, when I try: gst-launch-0.10 filesrc location=/home/hrvoje/Music/sample/sample.flac ! decodebin ! audioconvert ! audioresample ! alsasink device="hw:0,0" Setting pipeline to PAUSED ... Pipeline is PREROLLING ... ERROR: from element /GstPipeline:pipeline0/GstAlsaSink:alsasink0: Could not get/set settings from/on resource. Additional debug info: gstalsasink.c(510): set_hwparams (): /GstPipeline:pipeline0/GstAlsaSink:alsasink0: Rate doesn't match (requested 88200Hz, get 0Hz) ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... Freeing pipeline ... Seems that it won't do it for ALSA "hw:0,0". This really strange since all the other sampling rates play well. Thank you all for help!
PS. I just wanted to add a link to a free sample 24/88.2 kHz file to be used for testing this issue: http://www.hydrogenaudio.org/forums/index.php?act=attach&type=post&id=6362 It is a short sample file from Linn Records I believe.
This sample file is fixed by the following. The result sounds correct to me (with my hardware, 96 kHz ends up being selected for this file). commit 8d29fe88345621032b277c0a21afdf94bb8e09fd Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> Date: Mon Jan 16 11:43:25 2012 +0000 alsasink: fix high sample rates being rejected An ALSA sink may select a different rate (as we use the _set_rate_near API, which is not guaranteed to set the exact target rate). The rest of the code seems to already handle this well, as output from a 88200 Hz file seems to have the correct pitch when selecting a 96 kHz rate. commit 361f2b169cacc92699c8a4acb55e27ef29afc113 Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> Date: Mon Jan 16 11:40:47 2012 +0000 alsasink: fix rate match message mistaking error code for sample rate commit e60027c795512e6a716d616fa33bbe72f91b25d6 Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> Date: Mon Jan 16 11:40:16 2012 +0000 alsasink: log API errors along with the error code and string
*** Bug 673127 has been marked as a duplicate of this bug. ***
This relates to the 673127 duplicate of this bug. I have installed the gst-plugins-base 0.10.36. However there is still a problem with the playback of the 24000Hz file. The pitch is too high, all the voices are sped up and sound like chipmunks. Is there a way to slow down the playback? Thanks. here is a link to a sample mp3 file http://feeds.themoth.org/~r/themothpodcast/~5/ptf5B4fDNSc/moth-podcast-217-barbara-wiener.mp3
I thought I would add that the file in the above case which is 24000Hz gets resampled to 32000Hz by the ~ $ gst-launch-0.10 playbin2 uri=file:///home/hrvoje/Downloads/moth.mp3 audio-sink="audioconvert ! audioresample ! rgvolume ! volume ! level ! volume ! equalizer-10bands ! rglimiter ! audioresample ! alsasink device=hw:0,0" Also, when I play it through a different player it gets resampled to 44100Hz and it sounds fine.
That file sounds fine with either playbin2 alone, and with a command line equal to yours plus a audioconvert just before alsasink (would fail here otherwise). I recall that the sample I had was sounding right (eg, not sped up nor slowed down), though to be honest I can't recall what it was so... I have gst 0.10 from about mid june here, so not that recent.
Thanks for the comment. So I tried some things: ~ $ gst-launch-0.10 playbin2 uri=file:///home/hrvoje/Downloads/moth.mp3 This plays fine and converts to 44100Hz. ~ $ gst-launch-0.10 playbin2 uri=file:///home/hrvoje/Downloads/moth.mp3 audio-sink="alsasink device=hw:0,0" This does not play OK. The sound is corrupted. It converts to 32000Hz. I also tried taking out or duplicating different parameters in the line, such as": audioconvert or audioresample. However, nothing seems to matter. When alsasink device=hw:0,0 is used, the file sounds wrong, and converts to 32000Hz. Any ideas?