|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.Sound
public class Sound
NXT sound routines.
Field Summary | |
---|---|
static int |
C2
Play a system sound. |
static int[] |
FLUTE
|
static int[] |
PIANO
|
static int |
VOL_MAX
|
static String |
VOL_SETTING
|
static int[] |
XYLOPHONE
|
Method Summary | |
---|---|
static void |
beep()
Beeps once. |
static void |
beepSequence()
Downward tones. |
static void |
beepSequenceUp()
Upward tones. |
static void |
buzz()
Low buzz |
static int |
getTime()
Returns the number of milliseconds remaining of the current tone or sample. |
static int |
getVolume()
Get the current master volume level |
static void |
loadSettings()
Load the current system settings associated with this class. |
static void |
pause(int t)
|
static void |
playNote(int[] inst,
int freq,
int len)
Play a note with attack, decay, sustain and release shape. |
static int |
playSample(File file)
Play a wav file |
static int |
playSample(File file,
int vol)
Play a wav file |
static void |
playTone(int freq,
int duration)
|
static void |
playTone(int aFrequency,
int aDuration,
int aVolume)
Plays a tone, given its frequency and duration. |
static void |
setVolume(int vol)
Set the master volume level |
static void |
systemSound(boolean aQueued,
int aCode)
|
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 |
---|
public static final int VOL_MAX
public static final String VOL_SETTING
public static final int[] PIANO
public static final int[] FLUTE
public static final int[] XYLOPHONE
public static int C2
aCode | Resulting Sound |
---|---|
0 | short beep |
1 | double beep |
2 | descending arpeggio |
3 | ascending arpeggio |
4 | long, low buzz |
Method Detail |
---|
public static void systemSound(boolean aQueued, int aCode)
public static void beep()
public static void twoBeeps()
public static void beepSequence()
public static void beepSequenceUp()
public static void buzz()
public static void pause(int t)
public static int getTime()
public static void playTone(int aFrequency, int aDuration, int aVolume)
aFrequency
- The frequency of the tone in Hertz (Hz).aDuration
- The duration of the tone, in milliseconds.aVolume
- The volume of the playback 100 corresponds to 100%public static void playTone(int freq, int duration)
public static int playSample(File file, int vol)
file
- the 8-bit PWM (WAV) sample filevol
- the volume percentage 0 - 100
public static int playSample(File file)
file
- the 8-bit PWM (WAV) sample file
public static void playNote(int[] inst, int freq, int len)
inst
- Instrument definitionfreq
- The note to play (in Hz)len
- The duration of the note (in ms)public static void setVolume(int vol)
vol
- 0-100public static int getVolume()
public static void loadSettings()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |