Biostar Beta. Not for public use.
How do play audio (playsound) in background of Python script?
0
Entering edit mode
6 weeks ago
Rohit • 0
India / Bangalore

I am just writing a small python game that I've learned from the Machine Learning course and I have a function that does the beginning narrative.

I am trying to get the audio to play in the background but unfortunately, the mp3 file plays first before the function continues.

How do I get it to run in the background?

> import playsound
> 
> def displayIntro():
> 
> playsound.playsound('storm.mp3',True)
> 
> print('')
> 
> print('')
> 
> print_slow('The year is 1845, you have just arrived home...')

Also, is there any way of controlling the volume of the play sound module?

I should add that I am using a Mac, and I am not wedded to using play sound, it just seems to be the only module that I can get working.

ADD COMMENTlink
0
Entering edit mode
ADD COMMENTlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.1