Ah ok thank you Nathan. I was unsure about how the pyglet.app.run() worked, thanks for clearing that up.
On Feb 25, 8:09 pm, Nathan <[email protected]> wrote: > On Sat, Feb 25, 2012 at 10:14 AM, Tyler Pachal <[email protected]> wrote: > > Hello, > > I am new to Pyglet and am trying to play the same .wav file over and > > over and over. > > > What I have so far is: > > > import pyglet > > import random, time > > from pyglet.media import Player > > > # get ready to play > > sound... > > sound = pyglet.media.load('go1.wav') > > > #initialize > > player > > player = Player() > > > player.queue(sound) > > > #play 200 > > times > > for i in range(1,201): > > print(i) > > player.seek(0) > > player.play() > > time.sleep(1.0) > > > pyglet.app.run() > > 1) I have never had any luck with Player.seek() > > 2) Sound files won't really play until you get to pyglet.app.run(), so > even if the seek command worked, your code would spend 200 seconds > getting a player ready to play, and then resetting it, and then when > you hit pyglet.app.run() it would finally play once. > > Note that the code below doesn't set up a window or anything, so you > will have to Ctrl-C out of the program. > > ------- > import pyglet, time > from pyglet.media import Player > > # Load the sound source > sound = pyglet.media.load('go1.wav') > > # Set up the player to play in a loop > player = Player() > player.queue(sound) > player.eos_action = player.EOS_LOOP > player.play() > > # If you want your program to do _anything_ while your sound plays, > # you should set up a window here and set it to handle events and > # do something. > > pyglet.app.run() > ----------- > > ~ Nathan -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
