Digital Sound & Music: Concepts, Applications, & Science, Chapter 6, last updated 6/25/2013
the value in the following seven bits of the byte make up the full value of the timestamp. If the
bit is a 1, then the next byte is also to be considered part of the timestamp value. This ultimately
saves space. It would be wasteful to dedicate four bytes to the timestamp just to take care of the
few cases where there is a long pause between one MIDI event and the next one.
An important consideration in writing or reading SMF files is the issue of whether bytes
are stored in little-endian or big-endian format. In big-endian format, the most significant byte
is stored first in a sequence of bytes that make up one value. In little-endian, the least
significant byte is stored first. SMF files store bytes in big-endian format. If you're writing an
SMF-interpreting program, you need to check the endian-ness of the processor and operating
system on which you'll be running the program. A PC/Windows combination is generally little-
endian, so a program running on that platform has to swap the byte-order when determining the
value of a multiple-byte timestamp.
More details about SMF files can be found at www.midi.org. To see the full MIDI
specification, you have to order and pay for the documentation. (Messick 1998) is a good source
to help you write a C++ program that reads and interprets SMF files.
Shaping Synthesizer Parameters with Envelopes and 6.3.2
Let's make a sharp turn now from MIDI specifications to the mathematics and algorithms under
the hood of synthesizers.
In Section 18.104.22.168, envelopes were discussed as a way of modifying the parameters of
some synthesizer function – for example, the cutoff frequency of a low or high pass filter or the
amplitude of a waveform. The mathematics of envelopes is easy to understand. The graph of
the envelope shows time on the horizontal axis and a "multiplier" or coefficient on the vertical
axis. The parameter is question is simply multiplied by the coefficient over time.
Envelopes can be generated by simple or complex functions. The envelope could be a
simple sinusoidal, triangle, square, or sawtooth function that causes the parameter to go up and
down in this regular pattern. In such cases, the envelope is called an oscillator. The term low-
frequency oscillator (LFO) is used in synthesizers because the rate at which the parameter is
caused to change is low compared to audible frequencies.
An ADSR envelope has a shape like the one shown in Figure 6.25. Such an envelope can
be defined by the attack, decay, sustain, and release points, between which straight (or evenly
curved) lines are drawn. Again, the values in the graph represent multipliers to be applied to a
The exercise associated with this section invites you to modulate one or more of the
parameters of an audio signal with an LFO and also with an ASDR envelope that you define
Table-Lookup Oscillators and Wavetable 22.214.171.124
We have seen how single-frequency sound waves are easily generated by means of sinusoidal
functions. In our example exercises, we've done this through computation, evaluating sine
functions over time. In contrast, table-lookup oscillators generate waveforms by means of a set