The ReadSoundSensor function reads the sound pressure level (loudness) of the sound currently being 'heard' by the sound sensor (Note: Sound sensors are not included with the standard NXT kit)
The input parameter should be an NXT input port number between 1 and 4 (which the sound sensor is plugged into).
The mode parameter should be one of the following values: “DB” or “DbA” depending if you want the returned value in standard Decibels or A-weighted Decibels.
spl = nxt.ReadSoundSensor( input, mode );
function OnStart() { nxt = app.CreateNxt(); app.SetMenu( "Connect,Sound Level" ); } function OnMenu( name ) { if( name=="Connect" ) nxt.ShowDevices(); else if( name=="Sound Level" ) { spl = nxt.ReadSoundSensor( 1, "dB" ); app.ShowPopup( spl ); } }