FFT, hertz and stream metadata

Stefano Parmesan s.parmesan at gmail.com
Tue May 29 00:09:01 PDT 2012


Hello everybody,

I am new of gstreamer, so please forgive me if I say something wrong.

I need your help about performing some actions with gstreamer, I tried
reading tutorials and documentation but I didn't find the solution to a few
points, and I hoped you could help me figuring out some things.

I'm using gstreamer 0.10.35 on Mac OS, and developing a simple user
interface with python, QT and numpy (python-gstreamer, gobject, pyqt4).

I currently have two pipelines, one playing a simple note,
using audiotestsrc,
and the other playing an mp3. I'm trying to visualize the spectrum of the
input signal (chosen by the user), so I connected to the "handoff" signal
of an identity element, and I'm playing around with the raw buffer received.
I have to draw the chart with frequencies in Hertz, and for doing so I'm
using the FFT function of numpy. Numpy however returns unitless
frequencies, so I need to know the stream bitrate, or the time duration
of the raw buffer, to convert such frequencies in Hertz. Moreover, I need
to reconstruct the original buffer, so I need to know the stream sample
width in order to pack the raw bytes.

This said, here my questions:
- how do I know the bitrate, or the milliseconds corresponding to the input
buffer received by an identity element with its handoff event? I tried using
the pipeline clock, but it doesn't seem to fit my needs;
- how do I know the actual sample width of the stream? I tried using
"audiosrc.get_pad("src").get_caps().get_structure(0)" but it gives me what
I guess are the accepted formats of the pad? I need the actual sample
width of the playing pipeline.

Thank you in advance for your time,
Best

--
Dott. Stefano Parmesan
PhD Student ~ University of Trento
<ahref Foundation - Trento - Italy
Tel: 0461-235794 ext. 5544
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20120529/251389bd/attachment.html>


More information about the gstreamer-devel mailing list