audioconvert: add zeroramp and gap detection to audioconvert

Make a new zeroramp.duration and zeroramp.gap property on audioconver.
It detects N samples of silence before triggering a fade-in or fade-out
of the given zeroramp.duration.

The zeroramp.duration is by default 5ms and zeroramp.gap is set to 0.

When the zeroramp.gap is set to 0, the audioconver will not do any gap
detection but it will only do fade-out from the last sample when the IO
Buffer area is removed from a port.

This by default makes the audio adapter perform a fade-out when the last
input of the port mixer was removed and the mixer is no longer scheduled
and the IO Area removed from the audioconverter input port.
This commit is contained in:
Wim Taymans 2026-06-17 17:11:42 +02:00
parent c2083336a4
commit 8971c488f3
11 changed files with 365 additions and 3 deletions

View file

@ -87,6 +87,7 @@ stream.properties = {
#dither.noise = 0
#dither.method = none # rectangular, triangular, triangular-hf, wannamaker3, shaped5
#debug.wav-path = ""
#zeroramp.gap = 0
#zeroramp.duration = 0.005
}
```

View file

@ -842,6 +842,23 @@ Dithering is only useful for conversion to a format with less than 24 bits and w
disabled otherwise.
\endparblock
@PAR@ node-prop zeroramp.gap = 0
\parblock
This instructs the audio converter to run gap detection. If zeroramp.gap consecutive
silence samples are found, the audio converter will perform a fade-in or fade-out with
new/old samples respectively.
Fade-in and fade-out are important when the signal has a sudden changes to and from silence
samples, which can cause loud pops and cracks.
When an application uses the proper PipeWire pause and resume functions, fades will be
performed automatically where needed. For applications that simply send silence when
paused (chrome, ...), zeroramp.gap detection can be a workaround.
This is disabled by default because it might corrupt the signal with excessive fades in
case the signal has large silence gaps.
\endparblock
@PAR@ node-prop zeroramp.duration = 0.005
The duration of fade-in and fade-out of the signal in seconds on silence gaps.

View file

@ -100,6 +100,7 @@ stream.properties = {
#dither.noise = 0
#dither.method = none # rectangular, triangular, triangular-hf, wannamaker3, shaped5
#debug.wav-path = ""
#zeroramp.gap = 0
#zeroramp.duration = 0.005
}
```