Comment by pixelpoet

Comment by pixelpoet a day ago

20 replies

If your YT/Winamp/whatever volume isn't at 100%, then what you're doing is:

1. generate audio signal

2. reduce volume of that signal, losing information because it's quantised

3. take that volume-reduced signal and boost it right back up again, but now with the lower bits destroyed

You can make this effect as bad as you like, e.g. turn it down to 1% and then amplify by 100x... but why?

alterom a day ago

Because the quality drop is imperceptible for most people, but the convenience of having volume controls at the component that makes sound isn't.

jdietrich a day ago

The loss of information from a reduction of bit depth is purely a reduction of signal-to-noise ratio; the least significant bit is dithered to eliminate quantization distortion. In normal domestic listening scenarios this is usually imperceptible, because the noise floor imposed by dither is below the threshold of hearing for any reasonable gain staging.

https://www.izotope.com/en/learn/what-is-dithering-in-audio....

AndyKelley a day ago

Because in order to get the best dynamic range while listening to diverse music, you need to detect the loudness of tracks and albums and adjust the gain of each track/album accordingly. In order to have room for the music player to adjust the volume higher for quieter tracks, you need to apply a "pregain" to lower the volume overall, while turning up your speakers to compensate. This solves the problem, but by doing this, your music player will generally have a lower volume relative to all other applications on the system, meaning that it generally will be desirable to turn down application-specific volume knobs accordingly.

More information: https://www.youtube.com/watch?v=iuEtQqC-Sqo

  • pixelpoet 20 hours ago

    I'm a bit star-struck to have you reply to my somewhat offhand comment, am aware of your audio player work and really want to be a Zig convert (just missing those vec3 and complex operators, having equal mathematical standing to ints and floats) and your original Zig intro video is IMO one of the best tech presentations of all time, but I digress...

    I'm aware of ReplayGain and this processing is important for per-track overall gain, but what I'm getting at is lower level: instead of there being two lossy/rounded stages of dimming and amplification, you want to communicate to the OS a log2 "dimming factor", so that this can be subtracted from a later log2 amplification factor such that we ideally waste no processing time if the sum is zero, and otherwise don't suffer the twice-quantised signal degradation (at most one accurate scaling pass, instead of two arbitrarily precision-reducing ones). It's maybe a minor point / imperceptible as others have noted, but IMO this seems like the Correct (TM) approach.

  • brudgers 19 hours ago

    Why not use a compressor?

    • miunau 15 hours ago

      Compressors destroy dynamic range. The idea is to normalize, not limit.

      • brudgers 6 hours ago

        Compressors can manage dynamics.

        When properly understood.

        And provide a consistent interface for managing.

        When thoughtfully placed in a signal chain.

skrebbel a day ago

I don't think this is true in practice anymore. Given that most sources are 16 bit wide, and afaik most OSes internally use 24 bits these days in the OS mixer (at least my laptop does), the information loss is negligible (just some rounding errors and that's it).

I'd be much more worried about 44.1khz sources being resampled to 48khz if that's the OS playback rate. I mean you won't be able to hear that either in practice but at least it's not negligible.

  • miunau 15 hours ago

    You're correct, with Realtek AC97 devices the resampling used to sound absolutely horrendous. Like they picked the worst possible algo. It's not as big of an issue these days though.

__alexs 15 hours ago

Ah so that's why my headphone amp disables volume control on the output entirely.

xanderlewis a day ago

I just like to have my audio samples divisible by a (preferably large) power of two — what's wrong with that? Sounds more crispy that way.

api a day ago

Apps shouldn’t even have local volume controls. It’s an OS function.

  • Brian_K_White a day ago

    I do not want to have to go hunt down the app in a list of all currently running apps in some os-level mixer to turn down or up one app. It is absolutely both an os and an app function. Both are needed.

    • echelon a day ago

      It's a problem because the OS doesn't mandate control. If every app had to function via OS volume controls and APIs, the world would be a wonderful place.

      Truly first-class audio with sublime control plane ergonomics.

      That'll never happen since any random app developer can just multiply audio volume by a float in whatever API and attach their own unique take on a slider. I'll merit the cases where you need to have individual level and channel controls, such as editing software and professional music tools, but most apps are not these.

      It's times like this when I do appreciate Apple's dictatorial take on things, though even they could not win this fight.

  • crazygringo a day ago

    Yes and no.

    Clearly there is a need to give different volumes to different apps, so you can have quiet background music while a timer app is louder, or Zoom is louder.

    Ideally there would be an OS-level mixer to independently set the volume of each app. I believe Windows has this, Mac definitely doesn't. And for convenience, an app's local volume control would exist, but set it at the OS mixer level, so you don't have them competing with each other.

    But without this, an app does have to have local volume controls.

    Also, it's important to be able to set gain as well, i.e. turn the volume "above 100%". For those YouTube videos that for some reason are only 5% as loud as other videos. Even better is if you can set the gain per-video so that it won't be absurdly loud and clipping when you move on to the next video.

    Bonus points if an OS or media player ever gives the option of a dynamic compressor, so you can actually listen to those amateur podcasts where one speaker's microphone is 10x quieter than another's. Or listen to the quiet parts of classical music recordings even in the presence of background noise.

  • weiliddat a day ago

    Well sometimes you want Spotify running at a lower volume than your 100 people Teams meeting, or maybe the other way around ;)

  • alterom a day ago

    Yeah, because clicking out of the app to adjust its volume is fun!

    Clicks for the click God!