User avatar
Posts: 4
Joined: Thu Dec 27, 2012 11:03 pm

Garbled sound from audio jack

Fri Dec 28, 2012 12:32 am


I'm new to RPi and just started my first Python program leveraging pygame library. I'm having difficulty get sounds to play via the audio jack, but only from Python programs.

The following works from the command prompt:
aplay /usr/share/sounds/alsa/Front_Center.wav

However, the following code only produced a garbled crackling sound:

Code: Select all

import pygame
from pygame.locals import *

laserSound = pygame.mixer.Sound('/usr/share/sounds/alsa/Front_Center.wav')
print laserSound.get_length()
print laserSound.get_volume()
I'm not sure if this is specific to Python or a generic problem so I'm starting in this forum.

Many thanks for any assistance...

Return to “Troubleshooting”