title: Is there a way to change the speed of printing something to match the speed of a currently playing audio file?
body: <p>I am using the winsound module to play audio files from a folder, and am trying to create a transcript system for a project I am working on. But currently my process of making this is slow and is as follows:</p>
  <p>Run code:</p>
  <ul>
  <li>speech from audio file does not match speed of <code>print()</code> function</li>
  <li>change the <code>time.sleep()</code> time up or down</li>
  <li>repeat previous steps</li>
  </ul>
  <p>Is there a quicker way of creating this? Perhaps by repeatedly changing the speed of the print statement to match the speed of the audio file in real time?</p>
  <p>I am using python 3.8 so if there are any modules that could do this that would help a lot.</p>
  <p>Also, here is a sample of the code if it helps:</p>
  <pre><code>import winsound
  
  print(&quot;You find the access tunnel, hidden within a natural cave a mile off the main road.&quot;)
  time.sleep(2)
  print(&quot; &quot;)
  print(&quot;You don't need the keycard. The door is ajar.&quot;)
  time.sleep(2)
  print(&quot; &quot;)
  print(&quot;It smells here. It smells like them. Hopefully, they've moved on. You've come so far
  already. You can't turn back now.&quot;)
  </code></pre>