Disconnecting silence from recorded audio AVAudioRecorder

I am working on an iOS application that allows the user to record some audio. Audio is recorded using AVAudioRecorder, then saved to a file.

I would like to remove the silence from the beginning and end of the recorded sound.

Any ideas?

+6
source share
2 answers

I am not currently performing a similar task. This is not trivial. Because silence will not be a straight line of zeros. there will be some fluctuations.

If you are guaranteed a clear signal, it would be rather trivial to set a marker in the first sample with an absolute value greater than 0.001.

You can set the final marker without going back through the file. all you do is every pattern that exceeds this threshold, you set a final marker in that pattern.

If your entrance has the ability to contain glare and squitps, before it starts correctly, you will need a more sophisticated technique. Post a comment below and I will continue the answer.

+1
source

When I created audio applications for iOS, the sound eventually ends on the server. I do not know if your application is similar in this regard. If so, you can do what I did:

use SoX in the backend for subsequent sound processing, turning off silence using a threshold value.

If you need to do all this over the phone, it will be harder. You must create a power level filter using OpenAL or the OpenAL artwork library

+1
source

Source: https://habr.com/ru/post/886735/


All Articles