I have an audio mixer with a few queues. I want to assign different volume values to different queues in the mixer. For doing this, I set Alsa audio volume to maximum value. I noticed that the volume range of Alsa audio is 0-30. I assume that volume range in the pipeline is 0-1. Does volume value 1 in the pipeline match 30 automatically?
What do you mean by “volume range in the pipeline” exactly?
For a double/float range 1.0 usually means “no change”, and above 1.0 means amplification.
The max value in various GStreamer settings tends to be an arbitrary limitation in most cases and that doesn’t mean that the rest of the values will be scaled.
(Weird corner case exception possibly the GstController interface, but you didn’t mention using that, so can probably ignore it.)
GstStreamVolume interface that some elements implement, for different ways of setting the volume.
Thank for your reply, Müller.
I have two computers and they have volume ranges:
- min: 0 and max: 36
- min: 0 and max: 76
For a double/float range 1.0 usually means “no change”, I get it. That means if
I have code to set maximum volume in Alsa control:
volume 1.0 in the pipeline matches 36 or 76 respectively, correct?
I need progress bars on the GUI in my app to adjust the volumes in different queues.
I ask this question because I have issue with volume value in the gstreamer pipeline. My progress bar has range 0-100. I set one of the volumes in the pipeline to 0.01*progress bar value while progress bar moves. The sound volume change is not linear. And audio sound is still high when I set volume value in the pipeline to 0.1. This says audio sound volume does not change much when volume value in the pipeline changes from 1.0 to 0.1.
The sound volume change is not linear. And audio sound is still high when I set volume value in the pipeline to 0.1. This says audio sound volume does not change much when volume value in the pipeline changes from 1.0 to 0.1.
I think the problem might be that the volume change IS linear, but that’s not how human ears perceive it. An excellent resource is Programming Volume Controls.
Volume sliders must not be linear. Linear volume sliders are a nuisance because human perception of loudness is not linear at all, it is logarithmic. That is why all audio equipment worth its name uses the dB scale to indicate volume and gain settings.
In short, you should probably implement a nonlinear curve. “Technically” it should be exponential but I found that either x3 or x4 sound quite good and are very easy to implement. So as your volume slider goes from
x=1, you actually set the gstreamer volume to
Thanks a lot, Michiel. The link is very helpful.
this is how alsa mixer is coded for normalized volume control.