What is JSyn?JSyn is a Java API for synthesizing audio. (API stands for "Application Programmer Interface"). This means that Java programmers can use JSyn to add sound to their programs. Java also has APIs that provide other services like 3D graphics, network connections, user interface tools, etc. The API is the set of classes and their methods that are used directly by the programmer. Internally, the underlying classes may change but if the change is not visible to the programmer then the API has not changed. A programmer will only have to change their source code if the API changes.
JSyn consists of many layers. Starting from the top we have:
- JSyn API
- Contains the documented Java classes that the programmer calls directly.
- JSyn to CSyn native interface
- This layer bridges the gap between the high level Java code and the underlying 'C' code using JNI (Java Native Interface), or a Plugin interface.
- CSyn API
- 'C' code for managing audio synthesis units, samples, envelopes, etc. Handles creation, deletion, etc. This could be called directly by a 'C' programmer without using Java.
- CSyn Engine
- The guts of JSyn/CSyn where the actual audio is synthesized. This runs as a high priority process or interrupt to ensure real-time operation. If this doesn't run fast enough then you will hear big gaps and pops.
- Host Audio Driver
- This layer communicates directly with the computers audio device to output the sound. On Windows machines, we normally use MME. A DLL that uses DirectSound is available to registered developers. On Macintosh, we use the SoundManager.