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:
However, the following code only produced a garbled crackling sound:
I'm not sure if this is specific to Python or a generic problem so I'm starting in this forum.
Code: Select all
import pygame from pygame.locals import * pygame.init() pygame.mixer.init() laserSound = pygame.mixer.Sound('/usr/share/sounds/alsa/Front_Center.wav') laserSound.play() print laserSound.get_length() print laserSound.get_volume()
Many thanks for any assistance...