audiotestsrc
AudioTestSrc can be used to generate basic audio signals. It support several different waveforms and allows to set the base frequency and volume. Some waveforms might use additional properties.
Waveform specific notes:
Gaussian white noise
This waveform produces white (zero mean) Gaussian noise. Volume sets the standard deviation of the noise in units of the range of values of the sample type, e.g. volume=0.1 produces noise with a standard deviation of 0.132767=3277 with 16-bit integer samples, or 0.11.0=0.1 with floating-point samples.
Ticks
This waveform is special in that it does not produce one continuous signal. Instead, it produces finite-length sine wave pulses (the "ticks"). It is useful for detecting time shifts between audio signal, for example between RTSP audio clients that shall play synchronized. It is also useful for generating a signal that feeds the trigger of an oscilloscope.
To further help with oscilloscope triggering and time offset detection, the waveform can apply a different volume to every Nth tick (this is then called the "marker tick"). For instance, one could generate a tick every 100ms, and make every 20th tick a marker tick (meaning that every 2 seconds there is a marker tick). This is useful for detecting large time offsets while still frequently triggering an oscilloscope.
Also, a "ramp" can be applied to the begin & end of ticks. The sudden start of the sine tick is a discontinuity, even if the sine wave starts at 0. The* resulting artifacts can often make it more difficult to use the ticks for an oscilloscope's trigger. To that end, an initial "ramp" can be applied. The first few samples are modulated by a cubic function to reduce the impact of the discontinuity, resulting in smaller artifacts. The number of samples equals floor(samplerate / sine-wave-frequency). Example: with a sample rate of 48 kHz and a sine wave frequency of 10 kHz, the first 4 samples are modulated by the cubic function.
Example launch line
gst-launch-1.0 audiotestsrc ! audioconvert ! autoaudiosink
This pipeline produces a sine with default frequency, 440 Hz, and the default volume, 0.8 (relative to a maximum 1.0).
gst-launch-1.0 audiotestsrc wave=2 freq=200 ! tee name=t ! queue ! audioconvert ! \
autoaudiosink t. ! queue ! audioconvert ! libvisual_lv_scope ! videoconvert ! autovideosink
In this example a saw wave is generated. The wave is shown using a scope visualizer from libvisual, allowing you to visually verify that the saw wave is correct.
gst-launch-1.0 audiotestsrc wave=ticks apply-tick-ramp=true tick-interval=100000000 \
freq=10000 volume=0.4 marker-tick-period=10 sine-periods-per-tick=20 ! autoaudiosink
This pipeline produces a series of 10 kHz sine wave ticks. Each tick is 20 sine wave periods long, ticks occur every 100 ms and have a volume of 0.4. Every 10th tick is a marker tick and has the default marker tick volume of 1.0. The beginning and end of the ticks are modulated with the ramp.
Hierarchy
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstBaseSrc ╰──audiotestsrc
Factory details
Authors: – Stefan Kost
Classification: – Source/Audio
Rank – none
Plugin – audiotestsrc
Package – GStreamer Base Plug-ins
Pad Templates
src
audio/x-raw:
format: { S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, F32LE, F32BE, F64LE, F64BE, S8, U8 }
layout: { (string)interleaved, (string)non-interleaved }
rate: [ 1, 2147483647 ]
channels: [ 1, 2147483647 ]
Properties
apply-tick-ramp
“apply-tick-ramp” gboolean
Apply ramp to tick samples
Flags : Read / Write
Default value : false
can-activate-pull
“can-activate-pull” gboolean
Can activate in pull mode
Flags : Read / Write
Default value : false
can-activate-push
“can-activate-push” gboolean
Can activate in push mode
Flags : Read / Write
Default value : true
freq
“freq” gdouble
Frequency of test signal. The sample rate needs to be at least 2 times higher.
Flags : Read / Write
Default value : 440
is-live
“is-live” gboolean
Whether to act as a live source
Flags : Read / Write
Default value : false
marker-tick-period
“marker-tick-period” guint
Make every Nth tick a marker tick (= a tick with different volume). Only used if wave = ticks. 0 = no marker ticks.
Flags : Read / Write
Default value : 0
marker-tick-volume
“marker-tick-volume” gdouble
Volume of marker ticks. Only used if wave = ticks andmarker-tick-period is set to a nonzero value.
Flags : Read / Write
Default value : 1
samplesperbuffer
“samplesperbuffer” gint
Number of samples in each outgoing buffer
Flags : Read / Write
Default value : 1024
sine-periods-per-tick
“sine-periods-per-tick” guint
Number of sine wave periods in one tick. Only used if wave = ticks.
Flags : Read / Write
Default value : 10
tick-interval
“tick-interval” guint64
Distance between start of current and start of next tick, in nanoseconds.
Flags : Read / Write
Default value : 1000000000
timestamp-offset
“timestamp-offset” gint64
An offset added to timestamps set on buffers (in ns)
Flags : Read / Write
Default value : 0
Named constants
GstAudioTestSrcWave
Different types of supported sound waves.
Members
sine
(0) – Sine
square
(1) – Square
saw
(2) – Saw
triangle
(3) – Triangle
silence
(4) – Silence
white-noise
(5) – White uniform noise
pink-noise
(6) – Pink noise
sine-table
(7) – Sine table
ticks
(8) – Periodic Ticks
gaussian-noise
(9) – White Gaussian noise
red-noise
(10) – Red (brownian) noise
blue-noise
(11) – Blue noise
violet-noise
(12) – Violet noise
The results of the search are