play audio file in background python

Solutions on MaxInterview for play audio file in background python by the best coders in the world

showing results for - "play audio file in background python"
Yoann
24 Oct 2017
1#You First Need To Do This In Your Python Terminal: "pip install pydub"
2from pydub import AudioSegment
3from pydub.playback import play
4import threading
5
6sound = AudioSegment.from_wav('myfile.wav')
7t = threading.Thread(target=play, args=(sound,))
8t.start()
9
10print("I like this line to be executed simoultinously with the audio playing")
11