Clear Microphone buffer

Hello
After recording and playing sound from the microphone, data remains in the buffer.
If you record a new sound from a microphone, which is shorter than the previous one, then artifacts from the previous recording are heard.
How do I clear the buffer after playing a sound?

You can access the raw data of a Sound and edit it using Sound::lock and Sound::unlock. So you could use that method to clear out previous recordings. Alternatively you could release the old Sound and create a new one for the new recording.

Thanks.