[pulseaudio-tickets] [Bug 97777] Clipping with per-stream volume above 100% even though device volume below 100%

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Sep 13 16:33:57 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=97777

--- Comment #2 from Tanu Kaskinen <tanuk at iki.fi> ---
Regarding the "unnecessary" clipping of float data: since we talk to alsa using
integers, the sink works in integer mode (you can see the sink sample spec in
"pactl list sinks"). When the audio moves from the sink input (representing the
application stream), the data has to be converted to integers. Since 1.1 isn't
representable in the int16 range, clipping occurs. The sink volume hasn't yet
been applied at this point.

If the sink used floats too, I think the audio wouldn't get clipped.

I suppose we could reorder the processing so that sink and stream volumes are
applied to the stream audio before we convert the audio to ints and mix it with
other streams. This would mean applying the sink volume multiple times if there
are multiple streams, though, whereas the current code only applies the sink
volume once to the mix result.

The case where you successfully play a stream with +10dB volume to a sink with
-10dB volume without clipping is a case where we skip the stream volume
application step and merge the stream volume with the sink volume when the sink
volume is applied. I think you'd get clipping if there was another stream
playing at the same time, because in this situation the stream and sink volume
application has to be two separate steps.

Your goal is to be able to increase the volume of a specific stream higher than
other streams, without risk of clipping, right? This could be solved by adding
some headroom in the mixing phase as you suggested. The processing order would
have to be changed too, as explained above. Another solution would be to set
the default stream volume to something less than 100%. That would be simpler.
The two solutions aren't equivalent, however: do you wish that the volume of
the loud stream is remembered the next time the application starts to play, or
should it revert to the default volume? We cap the remembered volume to 100%,
so the "mixing headroom" solution is good if you don't want to remember the
volume, and the "lower default volume" solution is good if you want to remember
the volume.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-bugs/attachments/20160913/db674b0b/attachment.html>


More information about the pulseaudio-bugs mailing list