filter-graph: add dcblock and ramp plugins

This commit is contained in:
Wim Taymans 2024-12-09 14:59:33 +01:00
parent df271d13f3
commit 94e823ddad
3 changed files with 325 additions and 8 deletions

View file

@ -0,0 +1,59 @@
context.modules = [
{ name = libpipewire-module-filter-chain
args = {
node.description = "DCBlock Filter"
media.name = "DCBlock Filter"
filter.graph = {
nodes = [
{
name = dcblock
type = builtin
label = dcblock
control = {
"R" = 0.995
}
}
{
# add a short 20ms ramp
name = ramp
type = builtin
label = ramp
control = {
"Start" = 0.0
"Stop" = 1.0
"Duration (s)" = 0.020
}
}
{
name = volumeL
type = builtin
label = mult
}
{
name = volumeR
type = builtin
label = mult
}
]
links = [
{ output = "dcblock:Out 1" input = "volumeL:In 1" }
{ output = "dcblock:Out 2" input = "volumeR:In 1" }
{ output = "ramp:Out" input = "volumeL:In 2" }
{ output = "ramp:Out" input = "volumeR:In 2" }
]
inputs = [ "dcblock:In 1" "dcblock:In 2" ]
outputs = [ "volumeL:Out" "volumeR:Out" ]
}
capture.props = {
node.name = "effect_input.dcblock"
audio.position = [ FL FR ]
media.class = Audio/Sink
}
playback.props = {
node.name = "effect_output.dcblock"
audio.position = [ FL FR ]
node.passive = true
}
}
}
]

View file

@ -472,6 +472,28 @@ extern struct spa_handle_factory spa_filter_graph_factory;
*
* It has two input ports "In 1" and "In 2" and one output port "Out".
*
* ### dcblock
*
* Use the `dcblock` plugin implements a [DC blocker](https://www.dsprelated.com/freebooks/filters/DC_Blocker.html).
*
* It has 8 input ports "In 1" to "In 8" and corresponding output ports "Out 1"
* to "Out 8". Not all ports need to be connected.
*
* It also has 1 control input port "R" that controls the DC block R factor.
*
* ### Ramp
*
* Use the `ramp` plugin creates a linear ramp from `Start` to `Stop`.
*
* It has 3 input control ports "Start", "Stop" and "Duration (s)". It also has one
* output port "Out". A linear ramp will be created from "Start" to "Stop" for a duration
* given by the "Duration (s)" control in (fractional) seconds. The current value will
* be stored in the output notify port "Current".
*
* The ramp output can, for example, be used as input for the `mult` plugin to create
* a volume ramp up or down. For more a more coarse volume ramp, the "Current" value
* can be used in the `linear` plugin.
*
* ## SOFA filter
*
* There is an optional builtin SOFA filter available.