PaulStoffregen / Audio

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

Correct clipping and noise in effect_reverb #407

Closed emeb closed 5 days ago

emeb commented 2 years ago

The effect_reverb block converts the incoming audio stream to q31 using the CMSIS DSP function arm_q15_to_q31() which left justifies the 16-bit signed data within a 32-bit signed value and provides no guard bits for signal growth during the processing of the reverb algorithm.

I've added 8 guard bits on the incoming audio stream after conversion to q31, and also safely removed those guard bits with saturation prior to conversion back to q15 on the outgoing stream. This has significantly improved the audio quality in the reverb block.