PaulStoffregen / Audio

Teensy Audio Library
http://www.pjrc.com/teensy/td_libs_Audio.html
1.08k stars 401 forks source link

SGTL5000: autoVolumeDisable crashes AVC if autoVolumeControl "hardLimit" enabled #164

Open z-l-p opened 8 years ago

z-l-p commented 8 years ago

On the Teensy Audio Shield, if I set up the SGTL5000's Auto Volume Control like this:

autoVolumeControl(1, 0, 0, -50, 26, 26); (maxGain, response, hardLimit, threshold, attack, decay)

then I can use autoVolumeDisable() and autoVolumeEnable() with success.

BUT, if I enable the hard limiter like this:

autoVolumeControl(1, 0, 1, -50, 26, 26);

then autoVolumeDisable() leaves the AVC in a state where autoVolumeEnable() cannot re-enable it!

This was mentioned on the forums by Pensive (referring to his bitcrusher code) but I think he identified the wrong argument as problematic. (He said it was max gain but I can't reproduce any problems with that argument.)

Edit: I just noticed that the hard knee sounds the same as the soft knee option: There is significant compression even with the threshold set to 0dB. Either the threshold math is off, or maybe the library isn't actually setting the SGTL5000's hard limit mode?

Pensive commented 8 years ago

Interesting - I'm sure I pinned that down to being the only change necessary to prevent a crash. Perhaps there is more than meets the eye here?

It was a long time ago though.....