spectrum

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

Synopsis

struct              GstSpectrum;

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GstObject
               +----GstElement
                     +----GstBaseTransform
                           +----GstAudioFilter
                                 +----GstSpectrum

Properties

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

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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127