pygame sound error

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
max_77

pygame sound error

Post by max_77 »

Hello,

I'm running linux mint 18 cinnamon 64 bit. Cinnamon version is 3.07. The Linux Kernal is 4.4.0-21-generic.

Anyways, I'm trying to run pygame in the python 2.7.12 IDLE shell. I can't get the sound to work. The error I get is:
Traceback (most recent call last):
File "/home/max/Desktop/beepTest.py", line 6, in <module>
pygame.mixer.init()
error: No available audio device

Heres my code if your curious to see:

import pygame, sys
import pygame.mixer
from pygame.locals import *

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

soundObj = pygame.mixer.Sound('/home/max/Desktop/badswap.wav')
soundObj.play()
import time
time.sleep(1) # wait and let the sound play for 1 second
soundObj.stop()


while True: # main game loop
DISPLAYSURF.fill(WHITE)
DISPLAYSURF.blit(textSurfaceObj, textRectObj)
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
deepakdeshp
Level 20
Level 20
Posts: 12341
Joined: Sun Aug 09, 2015 10:00 am

Re: pygame sound error

Post by deepakdeshp »

Are your speakers working in Mint , outside Python?
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help.
Regards,
Deepak

Mint 21.1 Cinnamon 64 bit with AMD A6 / 8GB
Mint 21.1 Cinnamon AMD Ryzen3500U/8gb
max_77

Re: pygame sound error

Post by max_77 »

Yes, if I for example launch a web browser, then the sound for the video is heard.
Locked

Return to “Sound”