spectrum

## 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
        ╰── GInitiallyUnowned
            ╰── 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 element 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

    1
    <span style="color: red"><xi:include></xi:include></span>

## 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, format=(string){ S16LE, S24LE, S32LE, F32LE, F64LE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], layout=(string)interleaved

name | src
direction | source
presence | always
details | audio/x-raw, format=(string){ S16LE, S24LE, S32LE, F32LE, F64LE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], layout=(string)interleaved

## 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

Whether to post a 'spectrum' element message on the bus for each passed interval.

Flags: Read / Write

Default value: TRUE

### The `“multi-channel”` property

      “multi-channel”            gboolean

Send separate results for each channel.

Flags: Read / Write

Default value: FALSE