# webrtcdsp

A voice enhancement filter based on WebRTC Audio Processing library. This library provides a whide variety of enhancement algorithms. This element tries to enable as much as possible. The currently enabled enhancements are High Pass Filter, Echo Canceller, Noise Suppression, Automatic Gain Control, and some extended filters.

While webrtcdsp element can be used alone, there is an exception for the echo canceller. The audio canceller need to be aware of the far end streams that are played to loud speakers. For this, you must place a webrtcechoprobe element at that far end. Note that the sample rate must match between webrtcdsp and the webrtechoprobe. Though, the number of channels can differ. The probe is found by the DSP element using it's object name. By default, webrtcdsp looks for webrtcechoprobe0, which means it just work if you have a single probe and DSP.

The probe can only be used within the same top level GstPipeline. Additionally, to simplify the code, the probe element must be created before the DSP sink pad is activated. It does not need to be in any particular state and does not even need to be added to the pipeline yet.

# Example launch line

As a convenience, the echo canceller can be tested using an echo loop. In this configuration, one would expect a single echo to be heard.

     gst-launch-1.0 pulsesrc ! webrtcdsp ! webrtcechoprobe ! pulsesink

In real environment, you'll place the probe before the playback, but only process the far end streams. The DSP should be placed as close as possible to the audio capture. The following pipeline is astracted and does not represent a real pipeline.

     gst-launch-1.0 far-end-src ! audio/x-raw,rate=48000 ! webrtcechoprobe ! pulsesink \
                    pulsesrc ! audio/x-raw,rate=48000 ! webrtcdsp ! far-end-sink

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstBaseTransform
                        ╰──GstAudioFilter
                            ╰──webrtcdsp

## Factory details

Authors: – Nicolas Dufresne

Classification: – `Generic/Audio`

Rank – none

Plugin – webrtcdsp

Package – GStreamer Bad Plug-ins

## Pad Templates

### `sink`

    audio/x-raw:
             format: S16LE
             layout: interleaved
               rate: { (int)48000, (int)32000, (int)16000, (int)8000 }
           channels: [ 1, 2147483647 ]
    audio/x-raw:
             format: F32LE
             layout: non-interleaved
               rate: { (int)48000, (int)32000, (int)16000, (int)8000 }
           channels: [ 1, 2147483647 ]

Presence – always

Direction – sink

Object type – GstPad

### `src`

    audio/x-raw:
             format: S16LE
             layout: interleaved
               rate: { (int)48000, (int)32000, (int)16000, (int)8000 }
           channels: [ 1, 2147483647 ]
    audio/x-raw:
             format: F32LE
             layout: non-interleaved
               rate: { (int)48000, (int)32000, (int)16000, (int)8000 }
           channels: [ 1, 2147483647 ]

Presence – always

Direction – src

Object type – GstPad

## Properties

### compression-gain-db

    “compression-gain-db” gint

Sets the maximum |gain| the digital compression stage may apply, in dB.

Flags : Read / Write / Construct

Default value : 9

### delay-agnostic

    “delay-agnostic” gboolean

Enable or disable the delay agnostic mode.

Flags : Read / Write / Construct

Default value : false

### echo-cancel

    “echo-cancel” gboolean

Enable or disable echo canceller

Flags : Read / Write / Construct

Default value : true

### echo-suppression-level

    “echo-suppression-level” Webrtc-echo-suppression-level *

Controls the aggressiveness of the suppressor. A higher level trades off double-talk performance for increased echo suppression.

Flags : Read / Write / Construct

Default value : moderate (1)

### experimental-agc

    “experimental-agc” gboolean

Enable or disable experimental automatic gain control.

Flags : Read / Write / Construct

Default value : false

### extended-filter

    “extended-filter” gboolean

Enable or disable the extended filter.

Flags : Read / Write / Construct

Default value : true

### gain-control

    “gain-control” gboolean

Enable or disable automatic digital gain control

Flags : Read / Write / Construct

Default value : true

### gain-control-mode

    “gain-control-mode” Webrtc-gain-control-mode *

Controls the mode of the compression stage

Flags : Read / Write / Construct

Default value : adaptive-digital (1)

### high-pass-filter

    “high-pass-filter” gboolean

Enable or disable high pass filtering

Flags : Read / Write / Construct

Default value : true

### limiter

    “limiter” gboolean

When enabled, the compression stage will hard limit the signal to the target level. Otherwise, the signal will be compressed but not limited above the target level.

Flags : Read / Write / Construct

Default value : true

### noise-suppression

    “noise-suppression” gboolean

Enable or disable noise suppression

Flags : Read / Write / Construct

Default value : true

### noise-suppression-level

    “noise-suppression-level” Webrtc-noise-suppression-level *

Controls the aggressiveness of the suppression. Increasing the level will reduce the noise level at the expense of a higher speech distortion.

Flags : Read / Write / Construct

Default value : moderate (1)

### probe

    “probe” gchararray

The name of the webrtcechoprobe element that record the audio being played through loud speakers. Must be set before PAUSED state.

Flags : Read / Write / Construct

Default value : webrtcechoprobe0

### startup-min-volume

    “startup-min-volume” gint

At startup the experimental AGC moves the microphone volume up to |startup_min_volume| if the current microphone volume is set too low. No effect if experimental-agc isn't enabled.

Flags : Read / Write / Construct

Default value : 12

### target-level-dbfs

    “target-level-dbfs” gint

Sets the target peak |level| (or envelope) of the gain control in dBFS (decibels from digital full-scale).

Flags : Read / Write / Construct

Default value : 3

### voice-detection

    “voice-detection” gboolean

Enable or disable the voice activity detector

Flags : Read / Write / Construct

Default value : false

### voice-detection-frame-size-ms

    “voice-detection-frame-size-ms” gint

Sets the |size| of the frames in ms on which the VAD will operate. Larger frames will improve detection accuracy, but reduce the frequency of updates

Flags : Read / Write / Construct

Default value : 10

### voice-detection-likelihood

    “voice-detection-likelihood” Webrtc-voice-detection-likelihood *

Specifies the likelihood that a frame will be declared to contain voice.

Flags : Read / Write / Construct

Default value : low (1)

## Named constants

### Webrtc-echo-suppression-level

#### Members

`low` (0) – Low Suppression
`moderate` (1) – Moderate Suppression
`high` (2) – high Suppression

### Webrtc-gain-control-mode

#### Members

`adaptive-digital` (1) – Adaptive Digital
`fixed-digital` (2) – Fixed Digital

### Webrtc-noise-suppression-level

#### Members

`low` (0) – Low Suppression
`moderate` (1) – Moderate Suppression
`high` (2) – High Suppression
`very-high` (3) – Very High Suppression

### Webrtc-voice-detection-likelihood

#### Members

`very-low` (0) – Very Low Likelihood
`low` (1) – Low Likelihood
`moderate` (2) – Moderate Likelihood
`high` (3) – High Likelihood

The results of the search are