Answers for "Play Audio File In Background Python"

0

Play Audio File In Background Python

#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")
Posted by: Guest on September-18-2021

Python Answers by Framework

Browse Popular Code Answers by Language