1

I have a pygame project where I need to play sound. However when I tried to download some free sound effects, It did not play at the game. More correctly, It did play however the played sound was short(around 0.2 - 0.3s) and corrupted like a scratch noice. The sounds I used was also short, like 1 second sound so I suspected maybe I needed a longer sound(which would delay the sound's time however I wanted to be sure). I recorded a sound myself. 5-6 seconds, and the result was the same. The sound I recorded didnt play properly and instead produced a short scratch sound. I want to know the reason of this behavior.

Here is some of my code.

pygame.init()
pygame.mixer.init()

self.piece_pick_up = pygame.mixer.Sound(r"sound\piece_pick_up.mp3")
self.piece_drop = pygame.mixer.Sound(r"sound\piece_drop.mp3")

self.piece_pick_up.play()

This is not the whole code of course, I copied the relevant parts that I used for sound playing. The playing command is in the mouse handler when activates with click.

Am I doing something wrong ? But if the code was wrong, It should not have played at all, rather than playing corrupted sound.

I tried recording with 44100 and 22050 frequency, didn't fix the problem. please help me.

Note: I used mp3 file type.(I first tried Wav) Here is the first sound I tried if it is any help. It requires membership however for downloading.

https://www.freesound.org/people/newagesoup/sounds/339363/

Note 2: I used the following settings for the recording. Don't know if they are compatible with pygame.

Type: Mp3

Sample Rate: 22050 and 44100 (both tried)

Resample mode (if needed): 192pt Sinc

Bitrate: 128 kbps

Max Paython
  • 1,595
  • 2
  • 13
  • 25
  • Since it's a free sound source, could you upload the file where we don't need to register a account and note down the royalty link so we can have a try ourselves? – Torxed May 30 '16 at 06:33
  • @Torxed As I added later, I started recording after that didn't work. The problem persists, so the error must come from somewhere else. Let me add my recording details nonetheless. – Max Paython May 30 '16 at 06:42
  • Would appreciate it, I'm on the road without a mic and quite frankly dunno where to get a mp3 to test with that isn't 150mb large. – Torxed May 30 '16 at 06:43
  • Trying to figure out why my sound has stopped working on my laptop, hence getting back to you kinda late. Maybe someone else will beat me to it : ) – Torxed May 30 '16 at 09:05

0 Answers0