[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] playing sound on Windows
- To: pygame-users@xxxxxxxx
- Subject: [pygame] playing sound on Windows
- From: "sarah" <sarahbmarques@xxxxxxxxx>
- Date: Mon, 17 Jun 2013 18:41:27 -0700 (PDT)
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 17 Jun 2013 21:41:36 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:to:subject:mime-version:content-type; bh=3in5J/bgd+GciuN/OtilZOJRjKvYbOH/IXgIKBVPisk=; b=QeVwDZZwVB5Eom5jO1SgWFfaA0aHRnHw9ddjreaC30ljMgChkw3mN7SOiGHLZmGOOt F0JimVhmjR/h4yQaUa/TKeVa0y23I/2nJMy++OksB1AATYrGjBN3D5Vtk5z/il6QSGC7 o8H5DecoRSpEC6pRrHqu42pp/TRBiJumzvtqoFpHhA8qs2wiMsk1/OX7RK2Hrg+ttFeh R/abH7thvFdzTVtbtQ69ES0g6bPHOdzzhRdKORdnfK/KdlDv64leCZNNNkF54/znCvyY 1Qgn+gQ3A9jdNMhoDGOEHxHbtW7l8B7ryx94prIA8yzY0zVqmTfmji+h7V70bUg+tNRi QoGQ==
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi all,
I've just subscribed to this list hoping someone can hplease elp me with the
following problem: I wrote the class bellow (I also attached it) that simply plays a sound
file when its method play_file() is called. It works on Linux perfectly, but
on Windows, no sound is played and I do need to find the reason of it.
Configurations are:
Windows 7 (32 bits), Python 2.6 and Pygame 1.9.1 (win32). Thank very
much for any help!
Sarah Barreto Marques
www.audiogames.com.br
@sarahbmarques
import sys, pygame
import time
class Sound:
pygame.mixer.pre_init(frequency=22050, size=-16, channels=2, buffer=1024)
def play_file(self, name):
# pygame.mixer.pre_init(frequency=44100, size=-16, channels=2, buffer=1024)
# pygame.mixer.get_init()
sound=pygame.mixer.Sound(name)
print 'playing'
sound.play()
print 'done'
time.sleep(2)
return sound
if __name__=='__main__':
pygame.init()
sound=Sound()
som.play_file('0.wav')
Attachment:
sound.py
Description: unknown