spectrum

spectrum — Run an FFT on the audio signal, output spectrum data

Properties

guint bands Read / Write
guint64 interval Read / Write
gboolean message Read / Write
gint threshold Read / Write
gboolean message-magnitude Read / Write
gboolean message-phase Read / Write
gboolean post-messages Read / Write
gboolean multi-channel Read / Write

Types and Values

struct GstSpectrum

Object Hierarchy

    GObject
    ╰── GstObject
        ╰── GstElement
            ╰── GstBaseTransform
                ╰── GstAudioFilter
                    ╰── GstSpectrum

Description

The Spectrum element analyzes the frequency spectrum of an audio signal. If the “post-messages” property is TRUE, it sends analysis results as application messages named

"spectrum" after each interval of time given

by the “interval” property.

The message's structure contains some combination of these fields:

  • GstClockTime "timestamp": the timestamp of the buffer that triggered the message.

  • GstClockTime "stream-time": the stream time of the buffer.

  • GstClockTime "running-time": the running_time of the buffer.

  • GstClockTime "duration": the duration of the buffer.

  • GstClockTime "endtime": the end time of the buffer that triggered the message as stream time (this is deprecated, as it can be calculated from stream-time + duration)

  • GstValueList of gfloat "magnitude": the level for each frequency band in dB. All values below the value of the “threshold” property will be set to the threshold. Only present if the “message-magnitude” property is TRUE.

  • GstValueList of gfloat "phase": The phase for each frequency band. The value is between -pi and pi. Only present if the “message-phase” property is TRUE.

If “multi-channel” property is set to true. magnitude and phase fields will be each a nested GstValueArray. The first dimension are the channels and the second dimension are the values.

Example application

<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" parse="text" href="../../../../tests/examples/spectrum/spectrum-example.c" />

Last reviewed on 2011-03-10 (0.10.29)

Synopsis

Element Information

plugin

spectrum

author

Erik Walthinsen <omega@cse.ogi.edu>, Stefan Kost <ensonic@users.sf.net>, Sebastian Dröge <sebastian.droege@collabora.co.uk>

class

Filter/Analyzer/Audio

Element Pads

name

sink

direction

sink

presence

always

details

audio/x-raw-int, width=(int)16, depth=(int)[ 1, 16 ], signed=(boolean)true, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

audio/x-raw-int, width=(int)24, depth=(int)[ 1, 24 ], signed=(boolean)true, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

audio/x-raw-int, width=(int)32, depth=(int)[ 1, 32 ], signed=(boolean)true, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

name

src

direction

source

presence

always

details

audio/x-raw-int, width=(int)16, depth=(int)[ 1, 16 ], signed=(boolean)true, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

audio/x-raw-int, width=(int)24, depth=(int)[ 1, 24 ], signed=(boolean)true, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

audio/x-raw-int, width=(int)32, depth=(int)[ 1, 32 ], signed=(boolean)true, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

Functions

Types and Values

struct GstSpectrum

struct GstSpectrum;

Property Details

The “bands” property

  “bands”                    guint

Number of frequency bands.

Flags: Read / Write

Default value: 128


The “interval” property

  “interval”                 guint64

Interval of time between message posts (in nanoseconds).

Flags: Read / Write

Allowed values: >= 1

Default value: 100000000


The “message” property

  “message”                  gboolean

Whether to post a 'spectrum' element message on the bus for each passed interval (deprecated, use post-messages).

Flags: Read / Write

Default value: TRUE


The “threshold” property

  “threshold”                gint

dB threshold for result. All lower values will be set to this.

Flags: Read / Write

Allowed values: <= 0

Default value: -60


The “message-magnitude” property

  “message-magnitude”        gboolean

Whether to add a 'magnitude' field to the structure of any 'spectrum' element messages posted on the bus.

Flags: Read / Write

Default value: TRUE


The “message-phase” property

  “message-phase”            gboolean

Whether to add a 'phase' field to the structure of any 'spectrum' element messages posted on the bus.

Flags: Read / Write

Default value: FALSE


The “post-messages” property

  “post-messages”            gboolean

Post messages on the bus with spectrum information.

Flags: Read / Write

Default value: TRUE

Since: 0.10.17


The “multi-channel” property

  “multi-channel”            gboolean

Send separate results for each channel

Flags: Read / Write

Default value: FALSE

Since: 0.10.29