I have been working on real-time audio signals on smartphones (iOS and Android) and my goal is to make voice amplitude stable in a certain range even if a person is talking closer to the mic of the smartphone or away from the mic of the smartphone.
The problem arises when I apply the algorithm on chunks of data 40ms at 48000Hz i.e 1920 shorts. The output is somewhat clipped.
But when I apply the same algorithm to complete data, it works amazingly fine. I am attaching the screenshots. Please have a look.
So in this picture, I have merged three signals spectrograms. Top to bottom with label that can be seen on the picture.

What I am doing is applying the DRC algorithm of Matlab to my recorded data. I want to get my data the same as the data being displayed in the last picture from top to bottom. But in real-time (simulated), I am getting clipping as it can be seen in 2nd last picture from the top.
What should be done to avoid this clipping? How to resolve it? Also, I am applying Low pass filter after the processing.

  • $\begingroup$ It is currently very hard to help with your problem since the description of what you did is lacking detail. Could you for example post the code you used to obtain the second and third signals? For now I can only assume that there's an error regarding the block processing - the distortion seems to regularly happen at block transitions. Is that DRC algorithm memoryless? If not: Do you make sure the initial state of the algorithm for each block is correct, i.e., the end state of the previous block? $\endgroup$
    – applesoup
    Oct 23, 2021 at 17:19
  • $\begingroup$ Hi @applesoup, Its a bit late for now. I'll post the code and share audio file with you in the morning, $\endgroup$ Oct 23, 2021 at 17:58


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.