[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Re: Re: playing sound on Windows
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Re: Re: playing sound on Windows
- From: "sarah" <sarahbmarques@xxxxxxxxx>
- Date: Tue, 02 Jul 2013 15:41:33 -0700 (PDT)
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 02 Jul 2013 18:41:41 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:to:subject:mime-version:content-type :content-transfer-encoding:x-mime-autoconverted; bh=jzjaXqeBJmpfcV8StYT1YF9N/NqNqE9DJ8nGVouUX88=; b=cnS5vXULh/zQnF3DOGBv969wvujlz1kaKDcJVd96zer90jNDJjf41jiwENlHCgzJGv jNLoBMxluhSf1AHdWID0PhTCjTOA4cqMQchV0aRxWXinE0U8fX+frrTRj7RUDPgDusX2 hWK2WaIgfTkpjYicK81AB09jIEfczpbRbR86Ks9cW4Iz9Dt8y91pGQpyu/H8/79FfdOX +0GY6ow8YrigogsSscb+RL30rkXD7Iohh72g0N5pbN6I24PxXA6lBWE7V+UtiKbse7bi JvsIchRGpky7mm1QwXOnu47Umr2ieM4e9tOfc36c6SBVxsIRKBqfnF5pr2tBq2stpTZE jQmA==
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
I did it, but didn't work. Could you send me the file after you changed
it, please? Thanks,
Sarah
-----Mensagem original-----
De: Christoph Gohlke <cgohlke@xxxxxxx>
Para: pygame-users@xxxxxxxx
Data: Quinta, 27 de Junho de 2013 11:23
Assunto: Re: [pygame] playing sound on Windows
Works for me on Windows after replacing `pygame.init()` with
`pygame.mixer.init()`
Christoph
On 6/27/2013 8:11 AM, sarah wrote:
> 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')
>