Playing a note on the synthesizer

Purpose. Plays a single note on the synthesizer.

Usage. 

java SynthNote keynumber velocity duration

Parameters. 

keynumber

the MIDI key number

velocity

the velocity

duration

the duration in milliseconds

Bugs, limitations. The precision of the duration depends on the precision of Thread.sleep(), which in turn depends on the precision of the system time and the latency of th thread scheduling of the Java VM. For many VMs, this means about 20 ms. When playing multiple notes, it is recommended to use a Sequence and the Sequencer, which is supposed to give better timing.

Source code.  SynthNote.java