Vijayabhaskar J
Vijayabhaskar J

Reputation: 436

Moviepy saving audio adds noise at the end of the file

I found out simply saving the audio file is adding some weird noise to the file at the end. It's not happening to all the files but to some of the files.

This even occurs by just reading an audio file and then simply writing it.

audio_file = AudioFileClip("source.wav")

audio_file.write_audiofile("noisy.mp3")

Listen to the last 1 sec of both clips.

There is a "bort" sound

Source file: https://bayfiles.com/L5b3tfv8oe/source_wav

Noisy File produced: https://bayfiles.com/3fc1t1vao6/noisy_mp3

I don't know how to fix this, any help is appreciated.

Upvotes: 2

Views: 867

Answers (1)

amirothman
amirothman

Reputation: 157

Have you tried with a different wave file? The noise might stem from the conversion of wave format to mp3.

Update:

I've checked the files and I realise something. Firstly, keep in mind that mp3 is a lossy compression. It leaves artefacts. I hypothesise that the "noise" that you are hearing is actually the signal being looped back. I think mp3 encoding shifts the time somehow.

Original signal on top, the output signal on the bottom

I copied the start of the signal and it appeared and sounded similar. So not noise but the actual signal! haha. very interesting.

Upvotes: 1

Related Questions