Replit audio help

I’m tying to get an audio file to loop while typing print is doing its thing, here’s what I have so far, but I can’t get it to stop playing when I want

def typingPrint(text):
   source = audio.play_file(“TextScroll.wav”)
   for character in text:
      sys.stdout.write(character)
      sys.stdout.flush()
      time.sleep(0.01)
   source.set_paused()

def typingInput(text):
   source = audio.play_file(“TextScroll.wav”)
   for character in text:
      sys.stdout.write(character)
      sys.stdout.flush()
      time.sleep(0.01)
   value = input()
   source.set_paused()
   return value

I see you deleted your topic that was in Code Help. That was actually the right category, but also make sure to make it Python.