Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Play #Audio #File #In #Background #Python
ADD COMMENT
Topic
Name
8+6 =