How to detect signal level without creating a "fakesink" audio-pipeline?
Stefan Kost
ensonic at hora-obscura.de
Sat Aug 20 03:59:16 PDT 2011
On 08/13/11 13:05, Osmo Antero wrote:
> Hello,
>
> I would like improve my audio-recorder software. It uses GStreamer for
> the recording task.
>
> The recorder has a "timer" that can start recording if it detects
> sound input on the line. The timer is simply a textual command that is
> interpreted by the program.
>
> These are examples of the "timer" actions:
>
> start if voice 5s
> # pause if silence 8 seconds
> # start at 14:50 pm
> # stop if silence
>
> To my question:
> Let's take the first command (start if voice 5s) as an example.
>
> The timer process notices the "start if voice" command and creates a
> audio-pipeline that listens to the selected device. It will start
> recording if detects a signal/audio/voice that lasts at least 5
> seconds time.
>
> The timer calls the listener module that creates this pipeline:
>
> $ gst-launch-0.10 pulsesrc
> device="alsa_output.pci-0000_06_01.0.analog-stereo.monitor"
> name=source0 ! level name=level ! queue ! audioconvert !
> audio/x-raw-int,channels=1 ! fakesink name=output-sink
>
> Notice that this records to a "fakesink" sink and its output is
> discarded. The listener does only care about the signal level.
>
> This pipeline sets up a callback function on "message::element" signal
> (in src/gst-listener.c module)
>
> g_signal_connect(bus, "message::element",
> G_CALLBACK(listener_message_handler), NULL);
>
> That calls (in src/gst-listener.c module)
> static gboolean listener_message_handler(GstBus * bus, GstMessage *
> message, gpointer data) {
>
> ...
> }
>
> This is how the timer/listener can start the REAL RECORDING PROCESS if
> it detects some signal/audio/voice on the line.
>
> Please see the src/gst-listener.c (and src/timer.c) modules here:
> http://bazaar.launchpad.net/~osmoma/audio-recorder/trunk/view/head:/src/gst-listener.c
>
>
> http://bazaar.launchpad.net/~osmoma/audio-recorder/trunk/view/head:/src/timer.c
>
> ------
>
> The annoying thing is that this fakesink recorder (pipeline) is also
> VISIBLE in the GNOME's "Sound Preferences" dialog.
>
> Take a look at this picture:
> http://bildr.no/view/949174 (the fakesink recorder/listener is
> annoyingly visible in the settings)
>
> Here is another picture:
> http://bildr.no/view/949177
> This picture shows both the "fakesink" listener pipeline that tries to
> detect "silence". The second is the REAL GStreamer-recorder that
> outputs the a disc file.
>
> The question:
> =============
>
> Is there any better way to detect the signal level (audio level) in
> GStreamer? I want a method that avoids this visible "fakesink"
> recorder. Can I monitor signal level on any device (eg. audio card,
> webcam, microphone) without pipeline?
There is a level element. You also find examples of using it in the
element docs and under gst-plgin-good/tests/examples/
Stefan
>
> I hope you understand my question ;-)
>
> -----
> Here are couple of pictures of the recorder
> http://ubuntuforums.org/showthread.php?t=1672679
>
> Source code on the Launchpad
> https://launchpad.net/audio-recorder
>
> Most kindly
> Moma Antero
> Oslo, Norway
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list