microbit-foundation / micropython-microbit-v2

Temporary home for MicroPython for micro:bit v2 as we stablise it before pushing upstream
MIT License
41 stars 22 forks source link

SoundEffect vol_start/vol_end parameters and attributes accepts values up to 2492 #129

Closed microbit-carlos closed 1 year ago

microbit-carlos commented 1 year ago

Up to value 2492 works, although anything above 255 (the max value) sounds as loud:

>>> audio.SoundEffect(vol_start=2492, vol_end=2492)
SoundEffect(500, 2500, 500, 2492, 2492, 3, 0, 18)
>>> audio.SoundEffect().vol_start = 2492
>>> audio.SoundEffect().vol_end = 2492
>>> 

2493 starts to throw exceptions indicating the max value is 9999.

>>> audio.SoundEffect(vol_start=2493)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: maximum value is 9999
>>> audio.SoundEffect(vol_end=2493)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: maximum value is 9999
>>> audio.SoundEffect().vol_start = 2493
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: maximum value is 9999
>>> audio.SoundEffect().vol_end = 2493
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: maximum value is 9999
>>> 
dpgeorge commented 1 year ago

Fixed by de3813848f09ba954b56b11b7d4a08a572a536e3