Stuttering Audio in WAV File from ALSA Source in C++ App

Christoph Kuhr christoph.kuhr at web.de
Thu Feb 18 08:35:16 UTC 2016


Hi *,

I try to record audio from a microphone using an alsasrc. Pipeline is
playing, audio is recorded and written to a WAV file. When I open the
WAV file with Audacity, it has the expected audio format, but it is
stuttering.

With gst-launch-1.0 it is working as expected:
gst-launch-1.0 alsasrc device="hw:3,0" do-timestamping=true !
"audio/x-raw,channels=2,format=S32LE,rate=48000" ! filesink
location="test1.wav"

I already tried the following code with "do-timestamp" true/false for
the alsasrc and with sync true/false for the filesink.
What might be the problem?

Here is the code:

    alsa_src   = gst_element_factory_make ("alsasrc", "ALSA Source");
    g_object_set (alsa_src, "do-timestamp", TRUE, "device", "hw:3,0", NULL);

    wavenc  = gst_element_factory_make ("wavenc", "WAVE Encoder");

    filesink  = gst_element_factory_make ("filesink", "Filesink");
    g_object_set (filesink, "location", WAVPATH, NULL);

    gst_bin_add_many (GST_BIN (pipeline), alsa_src, wavenc, filesink, NULL);

    // caps = "audio/x-raw,channels=2,rate=48000,format=S32LE"
    gst_element_link_filtered(alsa_src, wavenc, caps);
    gst_element_link(wavenc,filesink);

Thanks in advance!

BR,
Ck


More information about the gstreamer-devel mailing list