Projects

JSyn - modular synthesis API for Java.
JMSL - Java Music Specification Language
PortAudio - cross platform audio I/O API for 'C'

WARNING - This tutorial describes the old original JSyn API. Please refer to the current docs for more up-to-date information.

JSyn Tutorial

Catching SynthException

If a JSyn class detects an error, it throws a SynthException which tells you what error occurred. If you want to catch the SynthException then you should bracket your calls to  JSyn methods with try and catch. I recommend that you catch the SynthExceptions at the highest level of your program. For example:
try
{
/* Make various calls to JSyn between these brackets. */
    Synth.startEngine();
    sineOsc = new SineOscillator();
    sineOsc.frequency.set( 440.0 ); /* Set frequency to 440 Hz, "Concert A". */
// etc.
} catch (SynthException e) {
    SynthAlert.showError(this,e);
}
To learn more about catch and throw, please refer to a Java Language reference.