EXOS 2.1 Sound Driver Specification

3. Envelopes

3.1 General Description of Envelopes

An envelope consists of a series of between 1 and 40 phases each of which will be executed in turn when the envelope is used. Each phase is defined by four numbers:

PD - 16 bits, duration of this phase in ticks
CP - 16 bits, change value for pitch in 1/512 semitones
CL - 8 bits, change value for left amplitude
CP - 8 bits, change value for right amplitude

The change values are signed numbers to allow a change in either direction, up or down in pitch and louder or softer in amplitude. The pitch change can be any signed 16 bit number (-32768.. +32767). The amplitude change values must be in the range -63.. +63. They specify the total change in the appropriate parameter which is requires during this phase. The specified change in pitch or amplitude will be spread evenly over the duration of this phase.

One particular phase of the envelope may be distinguished as the start of the release phase. The effect of this will be described in detail later but basically controls the dying away of the sound after the note has really finished.

3.2 Format of Envelope Definition

Envelopes are defined by an escape sequence sent to the sound channel:

      esc E en ep er [ cp cl cr pd ]*

where : en - (8 bits) Envelope number (0..254)
        ep - (8 bits) Total number of phases 1 .. 40
        er - (8 bits) Number of phases before release.

             If no release phase is required then this should
             be 0FFh which will result in the sound finishing
             as soon as the sound duration is expired.

        Repeat These ep times, once for each phase:

        cp - (16 bits) Pitch change.
        cl -  (8 bits) Left amplitude change.
        cr -  (8 bits) Right amplitude change.
        pd - (16 bits) Phase duration.

When an envelope definition is received, if there is an existing definition of that envelope then it is deleted. The new definition is then added to the list. If there is insufficient space to store the new one then an error code (.SENBF) will be returned. If this happens then the old definition of that envelope will be lost.

Next Chapter: Sound Production.

David Bouman. (dsbouma@cs.vu.nl)