Music Volume

Category: PyAngelo

Last updated 6 months ago

Heath Jones

Heath Jones Asked 6 months ago

How do you change the volume of music in your game so some things are louder than others?

Jeff Plumb

Jeff Plumb Answered 6 months ago

Hi Heath,

Take a look at the reference page for the playSound() function. This function takes three parameters, and the third one is the volume of the sound specified with a value between 0 and 1 with 1 being the loudest.

So you could use the following:

setCanvasSize(500, 400)
blip = loadSound("/samples/sounds/blip.wav")

text("Hit W to make a 'blip' sound!", 0, 0)
while True:
    if isKeyPressed(KEY_W):
        playSound(blip, False, 0.25)

Notify me of updates
Add to Favourites
Back to Questions

No comments yet!

Become a free member to post a comment about this question.