Music Volume

Category: PyAngelo

Last updated 1 year ago

Heath Jones

Heath Jones Asked 1 year ago

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


Jeff Plumb

Jeff Plumb Answered 1 year 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.