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!
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!
Share Improve this question edited Jan 18 at 19:03 CSER228 asked Jan 17 at 17:22 CSER228CSER228 11 bronze badge 1- Please do not upload images of code/data/errors. – dimakin Commented Jan 18 at 16:02
1 Answer
Reset to default 0Try 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")