0

I am making a program where I need to play files many times. When I play a file, it plays, but after 2 seconds the program closes with exit code -1073741819. Code: " from pydub import AudioSegment from pydub.playback import play while True: file_name = "sound.wav" sound = AudioSegment.from_wav(file_name) play(sound) sound.close() " Error: "Process finished with exit code -1073741819 (0xC0000005)" As you can see I tried adding: "sound.close()", but it doesn't help. I noticed that the program closes because of the line that plays the file: "play(sound)".I looked at other posts and realized that this error is caused by memory overflow. I tried adding the line: "time.sleep(0.1)" at the end of while. Didn't help.Thanks!

1

1 Answer 1

0

Try to check if a part of the song is readable.

from pydub import AudioSegment

# Load an audio file
audio = AudioSegment.from_file("song.mp3")

# Cut the first 10 seconds
trimmed_audio = audio[10000:]  

# Export the edited file
trimmed_audio.export("edited_song.mp3", format="mp3")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.