0

I have the code shown below.And It is playing the d0.wav audio file.But my problem is, it is playing at very high speed even anybody cannot recognize what is saying in the audio.I recorded the d0.wav file using Speech2go software and saved it as a wav file.But when I'm saving it, audio files' sound is medium.I want to know why this is happening and how to correct it. Please, someone, guide me.Below is my code.

import time, sys
from pygame import mixer

mixer.init()
sound=mixer.Sound("d0.wav")
sound.play()
time.sleep(10000)
Luke B
  • 2,075
  • 2
  • 18
  • 26
  • Define very high speed. Is it 2x as fast or is it more (you can test this by playing the file in something like VLC)? It might help to add link to the misbehaving audio file. My guess is that Speech2go is writing this wav file with a different frequency than what is expected in pygame/SDL. Also, does the wav file contain mono or stereo sound data? Finally, have you tried other wav files and if so, are they also fast or do those play at the right speed? – CodeSurgeon Nov 25 '17 at 21:17
  • It 2x as the original speed.I haven't tried with other wav files I'll try it – Lissa Sheks Nov 26 '17 at 02:15
  • From what I see in pygame, the only point to change the frequency is globally at the initialization phase. [This](https://www.pygame.org/docs/ref/mixer.html#pygame.mixer.pre_init) `pre_init` function is what you would need to call, and you would need to set the parameter for the desired frequency there. Instead of the default frequency of 22050, you can try using double that value (44100). – CodeSurgeon Nov 26 '17 at 04:35

0 Answers0