Resampling audio from 88200 to 96000 samples per second

Nick Okasinski n.koi at usa.net
Fri Nov 23 08:17:50 PST 2012


I have an audio file recorded with a sample rate of 88200 that I want to 
play on a USB DAC that supports 96000 but not 88200.

The following pipeline plays the file but re-samples to 48000:

% gst-launch-0.10 filesrc location=Song.flac ! decodebin ! alsasink, 
device=hw:0,0 -v

> /GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:src0: caps 
> = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, 
> width=(int)32, depth=(int)24, rate=(int)88200, channels=(int)2
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstFlacDec:flacdec0.GstPad:src: 
> caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, 
> width=(int)32, depth=(int)24, rate=(int)88200, channels=(int)2
> /GstPipeline:pipeline0/GstAlsaSink:alsasink0.GstPad:sink: caps = 
> audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, 
> width=(int)32, depth=(int)24, rate=(int)88200, channels=(int)2
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:src0.GstProxyPad:proxypad1: 
> caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, 
> width=(int)32, depth=(int)24, rate=(int)88200, channels=(int)2
> Pipeline is PREROLLED ...
> Setting pipeline to PLAYING ...
> New clock: GstAudioSinkClock
I confirmed the sampling rate with 'cat /proc/asound/card0/stream0':
> Playback:
>   Status: Running
>     Interface = 3
>     Altset = 1
>     URBs = 3 [ 7 7 8 ]
>     Packet Size = 388
>     Momentary freq = 48000 Hz (0x30.0000)

This mailing list post 
<http://gstreamer-devel.966125.n4.nabble.com/Playing-RAW-Audio-after-Resampling-td970602.html> 
suggests something like this:

% gst-launch-0.10 filesrc location=Song.flac ! decodebin ! audioresample 
! 'audio/x-raw-int, rate=96000' ! alsasink, device=hw:0,0 -v

However, this does not produce sound and provides the following message:

> /GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:src0: caps 
> = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, 
> width=(int)32, depth=(int)24, rate=(int)88200, channels=(int)2
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstFlacDec:flacdec0.GstPad:src: 
> caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, 
> width=(int)32, depth=(int)24, rate=(int)88200, channels=(int)2
> ERROR: from element 
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstFlacParse:flacparse0: GStreamer 
> encountered a general stream error.
> Additional debug info:
> gstbaseparse.c(2890): gst_base_parse_loop (): 
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstFlacParse:flacparse0:
> streaming stopped, reason not-negotiated
> ERROR: pipeline doesn't want to preroll.
> Setting pipeline to NULL ...
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:src0: caps 
> = NULL
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstFlacDec:flacdec0.GstPad:src: 
> caps = NULL
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstFlacDec:flacdec0.GstPad:sink: 
> caps = NULL
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstFlacParse:flacparse0.GstPad:src: 
> caps = NULL
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstFlacParse:flacparse0.GstPad:sink: 
> caps = NULL
> /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: 
> caps = NULL
> Freeing pipeline ...

I'm sure the NULL caps is not a good sign.  Can someone help me 
understand what I'm doing wrong?

Thanks in advance,

n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20121123/11c7b5a5/attachment.html>


More information about the gstreamer-devel mailing list