Table of Contents

PlaySoundFile

The PlaySoundFile function commands the NXT brick to play a sound file (.rso) file which is available on the brick.

The file parameter should be the name of the sound file and the repeat parameter should be number of times you want the sound to repeat. Format for file: ASCIIZ string with maximum size [15:3 chars].

nxt.PlaySoundFile( file, repeat );

Example - Play the 'Woops' sound file

function OnStart()
{
  nxt = app.CreateNxt();
  app.SetMenu( "Connect,Play Sound" );
}
 
function OnMenu( name )
{
  if( name=="Connect" )
    nxt.ShowDevices();
  else if( name=="Play Sound" )
    nxt.PlaySoundFile( "Woops.rso", 0 );
}