lejos.nxt
Class Sound

java.lang.Object
  extended by lejos.nxt.Sound

public class Sound
extends java.lang.Object

Sound class. Usage: SoundSensor.playTone(500, 1000); This version of the Sound class supports remote execution.

Author:
Brian Bagnall

Field Summary
static int C2
           
 
Method Summary
static void beep()
          Beeps once.
static void beepSequence()
          Downward tones.
static void beepSequenceUp()
          Upward tones.
static void buzz()
          Low buzz
static void pause(int t)
           
static byte playSoundFile(java.lang.String fileName)
          Plays a sound file once from the NXT.
static byte playSoundFile(java.lang.String fileName, boolean repeat)
          Plays a sound file from the NXT.
static void playTone(int frequency, int duration)
           
static int stopSoundPlayback()
          Stops a sound file that has been playing/repeating.
static void systemSound(boolean aQueued, int aCode)
          Play a system sound.
static void twoBeeps()
          Beeps twice.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

C2

public static int C2
Method Detail

systemSound

public static void systemSound(boolean aQueued,
                               int aCode)
Play a system sound.
aCodeResulting Sound
0short beep
1double beep
2descending arpeggio
3ascending arpeggio
4long, low buzz


beep

public static void beep()
Beeps once.


twoBeeps

public static void twoBeeps()
Beeps twice.


beepSequence

public static void beepSequence()
Downward tones.


beepSequenceUp

public static void beepSequenceUp()
Upward tones.


buzz

public static void buzz()
Low buzz


playTone

public static void playTone(int frequency,
                            int duration)

playSoundFile

public static byte playSoundFile(java.lang.String fileName,
                                 boolean repeat)
Plays a sound file from the NXT. SoundSensor files use the .rso extension. The filename is not case sensitive. Filenames on the NXT Bricks display do now show the filename extension.

Parameters:
fileName - e.g. "Woops.rso"
repeat - true = repeat, false = play once.
Returns:
If you receive a non-zero number, the filename is probably wrong or the file is not uploaded to the NXT brick.

playSoundFile

public static byte playSoundFile(java.lang.String fileName)
Plays a sound file once from the NXT. SoundSensor files use the .rso extension. The filename is not case sensitive. Filenames on the NXT Bricks display do now show the filename extension.

Parameters:
fileName - e.g. "Woops.rso"
Returns:
If you receive a non-zero number, the filename is probably wrong or the file is not uploaded to the NXT brick.

stopSoundPlayback

public static int stopSoundPlayback()
Stops a sound file that has been playing/repeating.

Returns:
Error code.

pause

public static void pause(int t)