I am amplifying an audio file frame-by-frame via the following algorithm:
- Find maximum value among all the samples in a frame
- Find the amplification factor to make the maximum value equal to 0 dB
- Multiply the entire frame by the above amplification factor
The above algorithm makes many samples close to 0 dB in the signal (as expected). However, when played, those samples which are close to 0 dB create a very sharp tick or click. The signal is full of such sharp ticks/clicks drastically deteriorating the listening experience.
How to avoid generating such ticks/clicks?
Edit: Tetsujin's method given in the 1st comment (to change the amplitude from 0 dB to -0.3 dB) seems to have reduced some of the clicks. But there are abundant clicks remaining at frame boundaries. I changed the amplitude from 0 dB to -0.3 dB to -1 dB to -3 dB to -10 dB but the clicks do not seem to go away. What should I do now? I have tried to read and look up what all of you were discussing but due to my limited knowledge, I couldn't see how should I go about implementing those things in my code. Could you please help me with what exactly should I do to reduce the "intersample/interframe clipping"?