title: Python 3.6: How to play audio faster
body: <p>So, I have this bit of code that print out text in a delayed fashion like you see in some old school or indie video games.</p>
  
  <p>Everything is working, but not the way I want it to.
  I want the printing and the playing of the sound to be faster as right now it is too slow.</p>
  
  <p>Is there any way to make this possible?</p>
  
  <p>Here is my code:</p>
  
  <p>Note: This lags in pycharm but works fine in terminal/cmd.</p>
  
  <pre><code>import sys
  import time
  from pydub import AudioSegment
  from pydub.playback import play
  
  
  
  def print_delay(string_in):
      sound_1 = "text_beep.wav"
      sound_play = AudioSegment.from_wav(sound_1)
  
  
      for char in string_in:
          sys.stdout.write(char)
          sys.stdout.flush()
          play(sound_play)
  
          if char != ",":
              time.sleep(0.01)
          if char == ".":
              time.sleep(0.20)
          if char == ",":
              time.sleep(0.10)
  
      print("\n")
  
  string_hello = "Hello World, this is a sample text.\nI want want this to print out faster without being delayed by the sound file.\nIs there any faster way to do this?"
  
  print_delay(string_hello)
  </code></pre>