📜  在后台播放音频文件 Python 代码示例

📅  最后修改于: 2022-03-11 14:46:30.603000             🧑  作者: Mango

代码示例1
#You First Need To Do This In Your Python Terminal: "pip install pydub"
from pydub import AudioSegment
from pydub.playback import play
import threading

sound = AudioSegment.from_wav('myfile.wav')
t = threading.Thread(target=play, args=(sound,))
t.start()

print("I like this line to be executed simoultinously with the audio playing")