I've started to learn Python a few days ago, I'm using the useful aXYZ module (thanks cyke64 to trigger sounds based on phone change of position. Anyway, it seems difficult to me to play two sounds one after another.
This is the code I'm using (taken from one tutorial)
Since this is within a function that is called several times a second (its called from the read(x, y, z) that triggers the aXYZ module, it starts to play the first file and immediately stops and starts to play the second and stops (I suppose due to the s.close()Code:s = audio.Sound.open(path1) s.play() s = audio.Sound.open(path2) s.play() s.close()
I would like to know how to play an entire sound and then start to play the other sound, looks like s.play() is asynchronous, it doesnt "wait" for the file to completely play before to start with the new one.
Is there any way to do this or I'll have to embed the play function inside a while loop and then constantly ask if the file is finished played?