[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: Thu, 27 Jun 2013 08:11:39 -0700 (PDT)
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Thu, 27 Jun 2013 11:11:47 -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=JmeqG9xNd1QUgCjxVKsWjBjSxBHC6XfUjDoBEvqz6HGH4OB/oSguCDpXJiZy2XVibH 0vH+Nm8NdSIGFh1Hm3qfRBXwInf/qUrhcpgUqWhW2f5DaQjaI70F6HoNUYB6OLYf1VKp XG1CWwVAykzs4zwrXyCqr8XBJ+cx1slGKHncmlHxhDSJzMz2FdNyKekwXjryWKwbeO6j DyKTI3/4bOZhLj5Bb5AmCsG1GBxaCw0blgFtokOGoB/GLrvTw8nPK1QL1ASKGlCqVEL8 yyylCzzRz65T0WCNm1KKzC9uDFGtG22LDFC12ZOzL5h2VWdy4JbycrpyW7Y1tF9kqrfc TSdA==
- 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