Live data from Hacker News

Reverse-engineering my speakers' API to get reasonable volume control

jamesbvaughan.com

21–30 of 144 posts

Re: Reverse-engineering my speakers' API to get reasonable volume control

#21
I wish someone would solve the opposite problem in PCs and laptops—that of too little audio gain. Designers never leave any gain in reserve for when audio input levels are too low.

Why do they do this? The problem is so obvious that you'd reckon they're doing it to deliberately annoy users.

The problem doesn't stop there, the lack of gain with Bluetooth is notorious. Almost every Bluetooth device I own has insufficient gain, franky it's a damn nuisance. The audio in the two sound bars that I own is so low on some audio material that I'm thinking of pulling them apart to see if I can find an op amp and increase its feedback resistor to obtain more gain. I should NOT have to do this.

Let me give you an example, the audio levels on many YouTube videos can be all over the place. Often the audio can be 6 to 10 dB below what it ought to be, thus it's impossible to listen on a laptop's speakers, especially so when one is listening in a location where the background noise is high.

What's wrong with the designers who design this digital stuff, don't they ever use the equipment themselves?

Haven't they ever seen a traditional radio or HiFi where the volume potentiometer is off at the 7 o'clock position, 12 noon is the maximum volume with a nominal one volt input signal or a radio station that's using normal levels of modulation, and the reserve gain is the range from the noon position to the 5PM one?

Do I have to say it again? The reserve gain is for when the input signal is lower that it ought to be. The world is not ideal, audio signals can be far from ideal—even from high tech companies like Google.

Occasionally help comes along, VLC has settings that allow the gain to be set to over 100℅ but I've often had situations where even VLC hasn't had the necessary reserve.

I've come to the conclusion the designers and programmers of this digital equipment haven't a clue about how ordinary amplifiers work. Or they have never taken the trouble to find out. They just assume a 16-bit input has 65536 levels and that's the range. Full stop! They never give consideration to what happens when the peak audio input covers perhaps less than one third that range of bits.

To get enough volume I've even had to use the audio equalizer, that's when one has been available, and often there is not. To get the extra gain I slide all sliders to maximum. Having to do this frequently is an ergonomic nightmare.

This is what happens when the arrogant digital world is too prowd to take a leaf out of the analog world—the world that managed to get these issues right about a century or more ago.

Re: Reverse-engineering my speakers' API to get reasonable volume control

#22

  // Yes, this is JavaScript embedded in HTML embedded in TypeScript.


  // I only recently learned that you can reference elements by ID this way.
  // It's kind of horrible but also I love it on tiny pages like this.
You have to kind of embrace the duality of every moment.

  -Spencer Dinwiddie

Re: Reverse-engineering my speakers' API to get reasonable volume control

#23

I know it is tangential, but this about his old system caught my attention: With that system, I could set the amplifier’s analog volume knob such that the max volume out of the streamer corresponded to my actual maximum preferred listening volume, giving me access to the full range of Spotify or AirPlay’s volume controls. Assuming an analog input, this might result in a noticable quality reduction at low volumes.

In this case, I was using the optical out from a WiiM mini into a Yamaha amp. I don't know much about digital audio, but I know that I was able to control the volume of the WiiM's digital output with that setup. On the other hand, I use a Schiit Asgard at my desk, where I have it connected to my Mac via USB-C. In that setup, I have no control over the volume level going in to the Asgard. MacOS just disables the softw…

I think for a WiiM mini to control the volume on the digital output, it would need to scale down every sample. This is probably fine over some range (it has a 24 bit output, so putting the volume at two thirds, would still result in 16 bits, the same as CD). But I'm curious what would happen at very low volumes, e.g. if you're down to only 4 bits.

Re: Reverse-engineering my speakers' API to get reasonable volume control

#24
post #8

Why do speakers even expose a web api in the first place? It’s just easily available without any security? Hope this person segmented this device away from other devices. The lack of basic security in the IoT space is astounding to me.

“The S in IoT stands for secure.”

Re: Reverse-engineering my speakers' API to get reasonable volume control

#25

I know it is tangential, but this about his old system caught my attention: With that system, I could set the amplifier’s analog volume knob such that the max volume out of the streamer corresponded to my actual maximum preferred listening volume, giving me access to the full range of Spotify or AirPlay’s volume controls. Assuming an analog input, this might result in a noticable quality reduction at low volumes.

Tangential fun fact: amps have a fixed gain, because it's hard to make a variable gain without distortion [1]. The volume knob doesn't control amplification, in fact it controls an attenuation stage, because it's easier to make variable attenuation with low distortion. [1] that's why there were so many different "classes" of amps, they're all making different tradeoffs about how they're doing the amplification.

According to Claude, the attenuation stage is before the power amp stage. Does that mean worse SNR whether the volume is controlled using the volume control or via the input?

(Ignoring the additional quantization issue with a scaled digital input.)

Re: Reverse-engineering my speakers' API to get reasonable volume control

#28

Earlier quoted context omitted.

In this case, I was using the optical out from a WiiM mini into a Yamaha amp. I don't know much about digital audio, but I know that I was able to control the volume of the WiiM's digital output with that setup. On the other hand, I use a Schiit Asgard at my desk, where I have it connected to my Mac via USB-C. In that setup, I have no control over the volume level going in to the Asgard. MacOS just disables the softw…

I think for a WiiM mini to control the volume on the digital output, it would need to scale down every sample. This is probably fine over some range (it has a 24 bit output, so putting the volume at two thirds, would still result in 16 bits, the same as CD). But I'm curious what would happen at very low volumes, e.g. if you're down to only 4 bits.

Each bit is ~6dB, so 2/3 perceived volume is still 23 bits. 8 bits is 48dB, which is less than 1% of the original volume, and still using 16 bits

Re: Reverse-engineering my speakers' API to get reasonable volume control

#29
post #20

> Those methods either give me a tiny slider that I can only use 10% of or about 15 steps where the jump from step 3 to step 4 takes the speakers from “a bit too quiet” to “definitely bothering the neighbors” levels. Volume controls need to be logarithmic, not linear. To a first degree approximation, everybody gets this wrong.

[deleted]

Re: Reverse-engineering my speakers' API to get reasonable volume control

#30

Earlier quoted context omitted.

I think for a WiiM mini to control the volume on the digital output, it would need to scale down every sample. This is probably fine over some range (it has a 24 bit output, so putting the volume at two thirds, would still result in 16 bits, the same as CD). But I'm curious what would happen at very low volumes, e.g. if you're down to only 4 bits.

Each bit is ~6dB, so 2/3 perceived volume is still 23 bits. 8 bits is 48dB, which is less than 1% of the original volume, and still using 16 bits

And this is why all computer audio should be 24 bit internally. A lot of the newer pro apps are actually using 32 bit floats
Post reply on HN