Hello,
What should happen is the sound should cut into the other one before the
first one stops, so you get an overlap. This happens when you call play
on the sound itself, but not when you queue a sound onto a player and
play it over and over.
I'm not sure what would be the best structure for this, but here is what
I need:
Sounds to be connected to objects like zombies. Those zombies then move
around the map. This changes the sound's location both when the zombie
moves and when the player moves. When the zombie is running, I want the
footsteps to overlap. When the zombie is behind the player, I would like
it to lower in pitch.
Thanks,
Brandon Keith Biggs <http://www.brandonkeithbiggs.com/>
On 6/5/2015 8:31 PM, [email protected] wrote:
I think I can answer #2.
I've played around abit lately with the audio and player functions in
pyglet, and yes you can load sounds into a player before hand to play
as you want.
|
player =pyglet.media.Player()
sound =pyglet.resource.media('sound.wav',streaming=False)
player.queue(sound)
player.play()
|
When you play a sound source it also return's a player class, which
you an also treat as a regular player:
|
sound =pyglet.resource.media('sound.wav')
player =sound.play()
player.queue(sound)
player.play()
|
The problem however is that re-loading each sound into the queue can
cause a noticable delay in playback as its loaded into the audio
buffer. Another problem is that once the sound is done playing, its
removed from the queue/buffer, and if you try pre-loading them you
also get a noticable delay in when the sounds are played. You could
try seeking back to the beginning of a sound before it finished
playing, but that can also potentially cause distorsions on playback.
There are a few ways the Player can handle the end of a sound as well
with the eos_action variable, such as Pausing when a sound finishes,
Next to play the next sound in the queue automatically, and Loop,
which will play the sound over and over again forever when you hit
play only once.
I've been thinking lately about taking a closer look at the Player
class and trying to add a new eos_action function like "replay", which
would return to the start of the sound and pause the player, and wait
for the next time *.play() is called so you don't have to keep
generating new Players everytime.
--
You received this message because you are subscribed to the Google
Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.