Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

GStreamerMediaPlayer users linear volume instead of cubic #1963

Open
2 of 8 tasks
brett-lynnes opened this issue Aug 18, 2021 · 2 comments
Open
2 of 8 tasks

GStreamerMediaPlayer users linear volume instead of cubic #1963

brett-lynnes opened this issue Aug 18, 2021 · 2 comments

Comments

@brett-lynnes
Copy link

brett-lynnes commented Aug 18, 2021

IMPORTANT: Before you create an issue, please take a look at our Issue Reporting Guide.

Briefly summarize your issue:

As specified when setting volume in GStreamer ( https://gstreamer.freedesktop.org/documentation/audio/gststreamvolume.html?gi-language=c#gststreamvolume-page ) the inputted value should be converted from cubic to linear. If this is not done, a "slider" will not sound like it is equally increasing in volume. This also stops very low volumes from playing softly. If someone is attempting to play music at bedtime at 5% volume (0.05) it effectively sounds like 37% of maximum.

What is the expected behavior?

If you implement the SDK to have more granularity in the volume controls, allowing for percentages like 5%, it should play the music very softly. Also, if you increase the volume from 10% to 20% the user should experience the same amount of increase as from 60% to 70%. If the UI is implemented as a volume slider, it should sound like the volume is constantly increasing as the user constantly increases the slider.

What behavior are you observing?

You hear an inverse log scaled increase. The difference between 10% and 20% is far greater than the increase between 60% and 70% (which is barely noticeable). Also very small percentages are still very loud.

Provide the steps to reproduce the issue, if applicable:

set a channel volume to 1 (1%, not 10%) and notice how it is still audible. 1% volume should be very hard to hear.

I fixed this in code and tested using available GStreamer routines you can find here: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/blob/1.0/gst-libs/gst/audio/streamvolume.h . I attached my git diff files (basically just a 2 line change to the MediaPlayer.cpp to covert the audio scaling)
MediaPlayer.cmake.patch.txt
MediaPlayer.cpp.patch.txt

Tell us about your environment:

What version of the AVS Device SDK are you using?

  <1.24.0>

Tell us what hardware you're using:

  • Desktop / Laptop
  • Raspberry Pi
  • Other - tell us more:

Tell us about your OS (Type & version):

  • Linux
  • MacOS
  • Raspbian Stretch
  • Raspbian Jessy
  • Other - tell us more:
@brett-lynnes
Copy link
Author

found this which does a better job of explaining the problem:
https://www.dr-lex.be/info-stuff/volumecontrols.html

@blazusiak-amazon
Copy link

Hello @brett-lynnes,

Thank you for bringing this issue to our attention. A formal fix for this issue is being investigated internally.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants