How to play sond with pyglet without the small delay

30 views Asked by At

I’m playing sound in a game, something like:

sound = pyglet.media.load("assets/sound/launch.mp3", streaming=False)
player = pyglet.media.Player()

# latter

def on_some_event():
    player.queue(sound)
    player.play()

If I do this, the sound is produced with a lag, not when the event occur, but some time after, enough for the player to feel that the sound is the consequence of something else.

His their a way to make pyglet produce the sound sooner (the sound is short).

I did edit my sound, removing any blank at the beginning, and I also tried to put the sound in the queue at initialization time, but it has no effect.

0

There are 0 answers