[Tutor] Sound problems

Wayne Werner waynejwerner at gmail.com
Thu Dec 10 17:55:12 CET 2009


On Thu, Dec 10, 2009 at 8:40 AM, Dave Angel <davea at ieee.org> wrote:

> If I may make a guess (I've never used pygame), I'd suggest that the sound
> playing logic counts on using the event loop for its timing.  So without an
> event loop, no sound.
>

Also, livewires is a pretty ancient - AFAICT they haven't had a new release
in over a year. Pygame is a little more active in its development and is
really easy enough with so much documentation there's no reason to learn
livewires.

Here's a simple example of playing a midi file with pygame only:

import pygame

pygame.init()
pygame.mixer.music.load('ISawHerStandingThere.mid')
pygame.mixer.music.set_endevent(pygame.QUIT)
pygame.mixer.music.play()

while True:
    event = pygame.event.poll()
    if event.type == pygame.QUIT:
        print 'Quitting'
        break


Of course, replace "ISawHerStandingThere.mid" with whatever music file you
want to play...

HTH,
Wayne


-- 
To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn’t. - Primo Levi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091210/5e9944aa/attachment.htm>


More information about the Tutor mailing list