最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

programming languages - Python library pydub, exit code -1073741819 - Stack Overflow

programmeradmin2浏览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!

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
Add a comment  | 

1 Answer 1

Reset to default 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")
发布评论

评论列表(0)

  1. 暂无评论