0

i am using pygame.mixer to play and pause an audio. I am playing the audio for first 10secs, pausing and unpausing to play the next 10secs and it goes on.

I have also tried the play pause feature using soundcard module.

When the audio is played thru both the modules, the pygame.mixer plays the audio at a higher pitch than the original audio whereas the soundcard module plays it as the same pitch as in like the original audio.

I could not understand the reason. Can anyone help me out here?

In the image below, the yellow highlighted is the samplerate of the audio Audio at 16000Hz.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Athulya
  • 65
  • 6
  • Did you manually set the sample frequency? e.g; 48000Hz? If so, you probably paying the sound back at a too high rate. – Stefan Mar 01 '21 at 07:26
  • in pygame , i have set the frequency like pygame.mixer.init(frequency=16000) because my audio is at samplerate 16000Hz – Athulya Mar 01 '21 at 07:28
  • The sample rate (frequency) is directly related to the pitch of your sound. Without any more context I am betting this is the cause of the problem. Can you show proof your audio is indeed at 16kHz sampled? – Stefan Mar 01 '21 at 07:43
  • Hi, thanks for the update. This is useful information. However, it makes the question harder. :-( – Stefan Mar 01 '21 at 09:14
  • Any suggestions? – Athulya Mar 01 '21 at 09:47

0 Answers0