Software sound facilities

Sound facilities are an essential ingredient of a framework supporting multimedia. Sound may be produced from a stored audio file or, provided that real-time sound synthesis facilities are available, from some high level representation in a sound or music description language. Apart from a reduction in the storage capacity needed (and correspondingly, the network traffic load in a distributed environment), employing a high level music/sound description language has as an additional advantage that improved synchronization and linking facilities may be offered.

The DejaVu framework supports both MIDI and the sound synthesis facilities offered by Csound [XX]. The public interface of the class encapsulating Csound looks as follows:

  interface icsound : public wrapper {

     void event( char* e );
     ...
  };
When creating an instance a process is created which is capable of receiving sound events, as defined by the Csound numerical score language, and converting these events to data for the audio device. (The wrapper class provides the functionality for spawning of a new process that communicates with the original process via pipes.) Care is taken that the audio device is connected only once. However, multiple instances of the icsound class may exist.

In addition to the icsound class, which accepts only low level sound events, instances of player may be used which accept musical events defined in the high level music description language Scot, that comes with Csound. The public interface of player looks as follows:

  interface player : public event {

    int operator()();         // defines Scot interpreter
    void orchestra( char* filename );
    ...
  };
The function orchestra may be used to read in orchestration files, defining instruments and other defaults. Notice that the player class is also an event. This allows instances of player to be embedded in scripts, as well as being activated as user-defined events.