[Python] Manipulate the volume of a constantly repeating audio in Pyglet

Discussão em 'Python' iniciado por Stack, Dezembro 18, 2024.

  1. Stack

    Stack Membro Participativo

    How can I manipulate the volume of the audio loaded via pyglet.media.load?

    The reason is that I have to repeat a sound repeatedly (eg bullets), but if I use the Player, the sound is queued to be able to play it and plays it only once using .play() (eg bullet = pyglet.media.load("bullet.wav", streaming=False) audioPlayer = pyglet.media.Player() audioPlayer.queue(bullet) if the audioPlayer.play() command is used several times, for example from a key, it is executed only once and that's it)

    If I don't use the Player, I can use the sound constantly, but at that point I can no longer manipulate the volume of the audio. (eg bullet = pyglet.media.load("bullet.wav", streaming=False) bullet.play())

    So how can I go about solving the problem? I don't have much experience using Pyglet audio, so I'm probably ignoring something I'm not aware of.

    Continue reading...

Compartilhe esta Página