Shop OBEX P1 Docs P2 Docs Learn Events
BlocklyProp S3 - Modify default program to reduce volume — Parallax Forums

BlocklyProp S3 - Modify default program to reduce volume

I have three S3s running in a room while 15 other students are working on other projects. The combined volume of the S3s is high.
The factory default program is in SPIN which I haven't used in years. I would be grateful for help to change the parameters to reduce the volume of the tones.
I have attached a copy of the file as comes from factory but re-named it to avoid confusion.

Thanks, John

Comments

  • There is a set_volume method in scribbler.spin. You could scale the vol parameter to a smaller value, which should reduce the volume for all sounds played by the S3.
  • Just un-comment example line? I tried below and threw an error on the line "expecting instruction or variable."
    Sorry to be thick, I have only been using PropC.
    Thanks.

    original:
    PUB set_volume(vol)

    '' Set the current volume level to vol (0 - 100) percent.
    ''
    '' Example: scribbler.set_volume(50) 'Set volume level to 50%.

    return _enqueue_tone(constant(VOLU << 13) | ((vol #> 0 <# 100) * $1fff / 100))


    modified:
    PUB set_volume(vol)

    '' Set the current volume level to vol (0 - 100) percent.
    ''
    scribbler.set_volume(50) 'Set volume level to 50%.

    return _enqueue_tone(constant(VOLU << 13) | ((vol #> 0 <# 100) * $1fff / 100))

  • Sorry, I should have been more explicit. Try this code:
    PUB set_volume(vol)
      vol /= 2
    
      '' Set the current volume level to vol (0 - 100) percent.
      ''
      '' Example: scribbler.set_volume(50) 'Set volume level to 50%.
    
      return _enqueue_tone(constant(VOLU << 13) | ((vol #> 0 <# 100) * $1fff / 100))
    
    By adding the line "vol /= 2" the volume will be cut in half. If you want it reduced further user 3 or 4 instead of 2.
Sign In or Register to comment.