micinput.getLevel() returns values larger than 1 in Simulator

The documentation for playdate.sound.micinput.getLevel() reads:

Returns the current microphone input level, a value from 0.0 (quietest) to 1.0 (loudest).

On device, the range is as described. However running the following in the Windows Simulator and tapping on my mic results in values larger than 1.

playdate.sound.micinput.startListening()
function playdate.update()
  local micLevel = playdate.sound.micinput.getLevel()
  print(micLevel)
end

Output:

0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
3.051758e-05
6.103516e-05
0.0003356934
0.0002441406
0.0
0.0
0.0001220703
0.08340454
0.03421021
0.001403809
0.0002441406
0.0
0.0
0.02850342
0.01516724
0.001556396
0.0002441406
9.155273e-05
0.0006408691
0.007568359
0.005401611
0.0002441406
0.0002746582
0.0004882812
0.0005187988
0.0004272461
0.0003051758
0.000213623
0.0001525879
0.0001831055
9.155273e-05
9.155273e-05
0.0001220703
0.0001525879
9.155273e-05
9.155273e-05
9.155273e-05
3.051758e-05
0.0

Those values aren't greater than one. The e represents scientific notation:

9.155273e-05

means

9.155273 × 10-5

which equals

0.00009155273

So they're all within range, just displayed in a way that can be misleading.

1 Like

Oh right :man_facepalming: Clearly I should not be programming this late!

1 Like