Biostar Beta. Not for public use.
Spam:How do play audio (playsound) in background of Python script?
1
Entering edit mode
3 months ago
Rohit • 10
@Rohit-52175

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.

Python Machine_learning • 382 views
ADD COMMENTlink
0
Entering edit mode
ADD COMMENTlink
This thread is not open. No new answers may be added
Similar Posts
Loading Similar Posts
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.3