com.jsyn
Interface Synthesizer

All Known Implementing Classes:
SynthesisEngine

public interface Synthesizer

A synthesizer used by JSyn to generate audio. The synthesizer executes a network of unit generators to create an audio signal.


Field Summary
static int FRAMES_PER_BLOCK
           
 
Method Summary
 void add(UnitGenerator ugen)
          Add a unit generator to the synthesizer so it can be played.
 TimeStamp createTimeStamp()
          Create a TimeStamp using the current audio time.
 AudioDeviceManager getAudioDeviceManager()
          An AudioDeviceManager is an interface to audio hardware.
 double getCurrentTime()
           
 double getFramePeriod()
           
 int getFrameRate()
           
 double getUsage()
           
 java.lang.String getVersion()
           
 int getVersionCode()
           
 boolean isRealTime()
          Is JSyn running in real-time mode?
 void queueCommand(ScheduledCommand command)
           
 void remove(UnitGenerator ugen)
           
 void scheduleCommand(double time, ScheduledCommand command)
           
 void scheduleCommand(TimeStamp timeStamp, ScheduledCommand command)
          Send a command to be processed in the background audio thread.
 void setRealTime(boolean realTime)
          If set true then the synthesizer will generate audio in real-time.
 void sleepFor(double duration)
          Sleep for the specified audio time duration.
 void sleepUntil(double time)
          Sleep until the specified audio time is reached.
 void start()
          Begin generating audio using default frame rate of 44100 and two stereo output channels.
 void start(int frameRate, int inputDeviceID, int numInputChannels, int ouputDeviceID, int numOutputChannels)
           
 void startUnit(UnitGenerator unit)
          Start a unit generator now.
 void startUnit(UnitGenerator unit, double time)
          Start a unit generator at the specified time.
 void startUnit(UnitGenerator unit, TimeStamp timeStamp)
           
 void stop()
          Stop generating audio.
 void stopUnit(UnitGenerator unit)
           
 void stopUnit(UnitGenerator unit, double time)
           
 void stopUnit(UnitGenerator unit, TimeStamp timeStamp)
           
 

Field Detail

FRAMES_PER_BLOCK

static final int FRAMES_PER_BLOCK
See Also:
Constant Field Values
Method Detail

start

void start()
Begin generating audio using default frame rate of 44100 and two stereo output channels.


start

void start(int frameRate,
           int inputDeviceID,
           int numInputChannels,
           int ouputDeviceID,
           int numOutputChannels)

getVersion

java.lang.String getVersion()
Returns:
version as a string.

getVersionCode

int getVersionCode()
Returns:
version as an integer that only gets bigger.

stop

void stop()
Stop generating audio.


getAudioDeviceManager

AudioDeviceManager getAudioDeviceManager()
An AudioDeviceManager is an interface to audio hardware. It might be implemented using JavaSound or a wrapper around PortAudio.

Returns:
audio device manager being used by the synthesizer.

getFrameRate

int getFrameRate()
Returns:
the frame rate in samples per second.

add

void add(UnitGenerator ugen)
Add a unit generator to the synthesizer so it can be played. This is required before starting or connecting a ugen into a network.


remove

void remove(UnitGenerator ugen)

getCurrentTime

double getCurrentTime()
Returns:
the current audio time in seconds.

startUnit

void startUnit(UnitGenerator unit,
               double time)
Start a unit generator at the specified time. This is not needed if a unit generator's output is connected to other units. Typically you only need to start units that have no outputs, for example LineOut.


startUnit

void startUnit(UnitGenerator unit,
               TimeStamp timeStamp)

startUnit

void startUnit(UnitGenerator unit)
Start a unit generator now.


stopUnit

void stopUnit(UnitGenerator unit,
              double time)

stopUnit

void stopUnit(UnitGenerator unit,
              TimeStamp timeStamp)

stopUnit

void stopUnit(UnitGenerator unit)

sleepUntil

void sleepUntil(double time)
                throws java.lang.InterruptedException
Sleep until the specified audio time is reached. In non-real-time mode, this will enable the synthesizer to run.

Throws:
java.lang.InterruptedException

sleepFor

void sleepFor(double duration)
              throws java.lang.InterruptedException
Sleep for the specified audio time duration. In non-real-time mode, this will enable the synthesizer to run.

Throws:
java.lang.InterruptedException

setRealTime

void setRealTime(boolean realTime)
If set true then the synthesizer will generate audio in real-time. Set it true for live audio. If false then JSyn will run in non-real-time mode. This can be used to generate audio to be written to a file. The default is true.

Parameters:
realTime -

isRealTime

boolean isRealTime()
Is JSyn running in real-time mode?


createTimeStamp

TimeStamp createTimeStamp()
Create a TimeStamp using the current audio time.


getUsage

double getUsage()
Returns:
the current CPU usage as a fraction between 0.0 and 1.0.

getFramePeriod

double getFramePeriod()
Returns:
Inverse of frameRate

scheduleCommand

void scheduleCommand(TimeStamp timeStamp,
                     ScheduledCommand command)
Send a command to be processed in the background audio thread.


scheduleCommand

void scheduleCommand(double time,
                     ScheduledCommand command)

queueCommand

void queueCommand(ScheduledCommand command)