I want to control max98357 by connecting it to Arduino.
I want to control the volume, but I don't know how.
I can adjust it in several steps with gain, but I'm not satisfied.
Is it possible to adjust the max98357 sound volume?
Digital volume control is done by multiplication. i.e. Multiply every sample by 0.5 and the level will be cut in half (-6dB). Multiply by zero and you get silence, etc.
...I'm talking about the digital samples... Like 44.100 samples per second, etc.
You have to be VERY careful boosting volume digitally because you can exceed the maximum value for a given number of bits. If you do it "wrong" you can get overflow-roll-over and terribly distorted sound. If you do it "right" but go over 100% you'll get
clipping which is the same kind of "regular distortion" you get if you try to get 20 Watts from a 10W amplifier.
Normally, you don't