I am using simpleaudio in a text-based adventure game. I am using Python 3. In my main loop, I want to achieve this: play a short audio clip, and once it finishes, start playing the same audio clip again. My problem is, that I cannot figure out how to make Simpleaudio do this.
I have read all of the API documentation to no avail. I have tried many different things regarding loops, and none of them work.
import simpleaudio as sa
def audio(audiofile):
filename = "/Users/*********/Desktop/Programming/Python Files/Adventure Game/Audio Files/" + audiofile
wave_obj = sa.WaveObject.from_wave_file(filename)
play_obj = wave_obj.play()
A = True
while True:
audio("openingtune.wav")
clear_screen()
firstinput = input("> ")
user_input1(firstinput)
# I didn't include the other functions because they're not relevant to this.
Note: the "while true" loop refreshes every so often (after input has been taken, and output has been given). I have no idea how to do this: once the song has finished playing one time, it should start over at the same point.