pygame sound error

Questions about codecs, DVD playback, web plugins...
Forum rules
Before you post please read how to get help
max_77
Level 1
Level 1
Posts: 2
Joined: Mon Oct 23, 2017 1:51 pm

pygame sound error

Postby max_77 » Mon Oct 23, 2017 2:00 pm

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()

deepakdeshp
Level 8
Level 8
Posts: 2371
Joined: Sun Aug 09, 2015 10:00 am

Re: pygame sound error

Postby deepakdeshp » Tue Oct 24, 2017 5:55 am

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, and keeps the forum clean.
I am using Mint 18 Cinnamon 64 bit with AMD processor .

max_77
Level 1
Level 1
Posts: 2
Joined: Mon Oct 23, 2017 1:51 pm

Re: pygame sound error

Postby max_77 » Tue Oct 24, 2017 9:28 am

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


Return to “Sound, Multimedia, & Codecs”

Who is online

Users browsing this forum: No registered users and 2 guests