MTU Instrument Synthesis
A computer may produce musical sounds either by controlling the operation of external analogue modules or by computing the sound waveform itself and outputting binary data to the outside world using a digital-to-analogue (D/A) converter to make it audible. The Microtan-based system 'Alphadac' featured last month in E&MM as a constructional project uses the former mode of operation and will probably offer some of the most sophisticated control options possible from a marriage between digital and analogue systems.
However, there is much satisfaction, of both a practical and aesthetic nature, to be gained from actually computing waveforms without the cost and complexity of patching the computer to analogue modules. Because of the difficulties in computing waveforms fast enough for real-time performance, the application of D/A converters and attendant software to single-board computers and the lower-price home computers has been somewhat limited. One problem is that the theoretical bandwidth (Nyquist frequency) of D/A conversion is approximately half the sampling rate, the frequency with which the output of the converter is updated. To get an acceptable frequency range with currently available 8-bit microprocessors requires highly efficient programs and, generally speaking, a few compromises as well. Micro Technology Unlimited first produced a high quality 8-bit D/A converter with filter and output amplifier in 1979. This hardware peripheral comes in two versions: one for the Commodore PET and the other for any computer having an 8-bit parallel output port. The principle of the D/A converter is perfectly straightforward and, in its simplest form, can take the form of a R/2R ladder converter that outputs a particular voltage in response to a particular numerical value sent along data lines. If the computer is outputting data from a list of numbers (waveform table) that has been calculated on the basis of a sine wave, then the waveform emerging from the basic converter would look something like that in Figure 1. If heard in this raw state, the waveform would appear 'rough' or distorted as the D/A converter is generating a stair-step approximation to the normal smooth audio waveform. To fill in these gaps and smooth-out the output waveform, a low-pass filter is mandatory. All multi-section filters with a sharp cutoff oscillate or "ring" when given the edge of a pulse wave, and it's this ringing that fills in the gaps between the samples outputted from the D/A converter. More trouble arises from the approximation or quantisation applied to the amplitude of the waveform (the so-called "round-off error") which produces quantisation noise throughout the audio spectrum. This limits the S/N ratio of the system, and, in the case of an 8-bit resolution system, is approximately 48dB.
MTU use a sampling rate of approximately 8 kHz, which gives a theoretical frequency response of 4 kHz, and, in practice, since no filter is 100% perfect, a usable response of 3.5 kHz. This is obviously fairly restrictive and represents one of the compromises that is necessary in implementing real-time digital synthesis in a low-cost system, but it's worth remembering that AM radio rarely goes beyond a bandwidth of about 5 kHz.
The original music software package produced by MTU in 1979 had the capacity to calculate a single waveform table, given the desired harmonic composition of a voice, and then use that table and three others as the instruments with which to play a 4-part musical score. Photo A shows the list of MTU files in present software. The first group of files, Mus Monitor / Mus Entertainer / Mus 76 Trombones, refers to the original 'Advanced Music Software', with the Monitor program including the machine language monitor (MLM), music playing routines, Fourier synthesis routines, and four voice tables. The remaining two files provide music data.
The synthesis routine is fairly simple and allocates 3 bytes of data to particular memory locations representing harmonic number, amplitude and phase shift. The Fourier coefficients provide the conditions needed to set-up an unsealed waveform, which, after construction, has to be 'scaled' so that the sum of amplitudes of all harmonics at any point on the waveform does not exceed a certain value, as this overflow can lead to gross distortion of the audio output. The music playing routine incorporates a sequencer subroutine that interprets a string of commands relating to the use of refrains, dynamic tempo changes, voice assignments, and so on.
Putting all this into practice demands a considerable amount of time and patience, and the manual accompanying this original software package doesn't make any concessions to the interested non-musician unfamiliar with harmonic synthesis and the like. Hexadecimal is also required for the creation of music files with pitches and duration entered according to the coding shown in Figure 2. Taking the first few measures of J. S. Bach's Chorale No. 2, this is inputted using a hexadecimal sequence as follows:
With the '79 software, the duration of an event is set by the shortest note; thus a group of two quavers played against crotchets requires all four parts for that event to be repeated as groups of quavers, with the result that the Bach in Figure 3a gets transmogrified into something like that in Figure 3b. Such decomposing is best left for Bach to get on with (sorry), and, with this brief 'historical' survey completed, it's time to look at MTU's latest software packages.
MTU's Instrument Synthesis Software Package was released in October, 1980 and really represents a considerable evolutionary step up the digital synthesis ladder. Like the 79 incarnation, the synthesis program acts as an interpreter in that it looks at binary coded strings of bytes in memory for instructions about what to do next. Also, implementation of the system requires some knowledge of memory mapping, hexadecimal coding of data, and use of the machine language monitor in whatever computer you're using.
The early MTU software, like that of Mountain Hardware (Apple Music System) and Syntauri (alphaSyntauri System) constructs waveforms on the basis of a 256-byte waveform table that is repeatedly scanned for the duration of a particular pitch. The sound is harmonically static in all three cases, but Mountain and Syntauri get around this to some extent by applying a sequence of amplitude and frequency offsets to each note's envelope which tricks the ear into thinking that harmonics are changing dynamically. These variations are all applied to the data once it has been accessed from the waveform table and each note is still described by only a single table. At present, to my knowledge, there are only three systems which provide dynamic harmonic changes: the Fairlight CMI, the Synclavier III (version 2.0) and this new MTU package. To get this 'timbral envelope' it's necessary to use a sequence of waveform tables. If the waveform tables are used properly, the envelope sampling need not be uniform over the required duration of a note; for instance, a number of waveform tables can be compressed into a short period of time ('squashed') when there's a lot of harmonic change, or expanded over a longer period of time ('stretched') when there's little harmonic movement. Sequenced tables actually kill two birds with one stone, as prescribing harmonic amplitude levels determines the amplitude envelope (ADSR equivalent) as well as the timbral envelope. In setting up a waveform sequencing routine, MTU use a waveform-sequence table holding 256 entries with each number corresponding to the page address of a waveform table (a typical instrument configuration uses around 20 tables). While notes are being played, a waveform-sequencer pointer moves through the sequence table, and, according to whether entries are stretched (lots of duplicate entries for a particular waveform table) or squashed (rapid movement from one table to another), the end product should be a reasonable approximation of 'real' instruments. However, the proof of the pudding is in the eating, and some price is paid for using such expensive ingredients. These harmonic subtleties take time to turn into sound generation, and, using a clock frequency of 1 MHz on the 6502 processor, the waveform sequencing sample period takes about 128 microseconds, a sample rate of 7.81 kHz, which limits the upper frequency response to something less than 3.9 kHz.
The inevitable consequence of this upper limit is a restriction on the harmonic input to a particular sequence of waveform tables. Taking A above middle C as an example, you'd be restricted to the fundamental (880 Hz), the 2nd (1760 Hz), 3rd (2886 Hz) and 4th (3520 Hz) harmonics. Obviously, then, the limited high-frequency response limits the notes playable by instruments that have a reasonably complex harmonic spectrum, and these limitations have to be assiduously born in mind when orchestrating a piece.
With a system like this that's totally honest about its limitations, I wasn't really prepared for the surprising quality of the two examples (Bach: Sinfonia No. 14; Tchaikowsky: Dance of the Reed Flutes) that come with the present software. These are included on the 3rd E&MM demonstration cassette.
Of course, there's quantisation noise and noise resulting from waveform-pointer truncation and waveform-table switching, but the real point is that the sounds are interesting and that's really half the battle in additive synthesis!
Putting Theory Into Practice
The construction of a timbral envelope is performed bya number of different command strings. Firstly, there's the Construct Waveform Set Command which specifies the envelope of each harmonic as a piece-wise linear approximation. This avoids having to define the harmonic make-up of each waveform in the set individually. The format of this command string goes as follows:
F5 SS EE HN (PG AM), (PG AM),...FF
HN (PG AM), (PG AM),...FF
where F5 is the operation code byte, SS is the 'start' byte specifying the address of the first waveform, EE is the 'end' byte specifying the address of the last waveform in the set, HN specifies the harmonic number in binary code, and (PG AM) are pairs of bytes used for specifying, respectively, the X-coordinate of the harmonic breakpoint as a waveform address relative to SS, and the Y-co-ordinate of the breakpoint which corresponds to the harmonic amplitude at that moment in time. Once a waveform set has been constructed in this way, it's then necessary to construct a companion waveform sequence table. The music interpreter program provides three different commands for implementing this in a less laborious fashion than actually filling in the 256 entry waveform sequence table by hand (so to speak) with the addresses corresponding to the components of a waveform set.
The first, the Arbitrary Waveform Sequence Table Command, simply uses the waveforms in sequential order but compresses the time scale at the beginning and end whilst expanding it in the middle. The second, the Build Waveform Sequence Table Command, moves away from the linear time scale in the previous command, and allows a much more dramatic sort of time warping with a couple of nibbles specifying the amount of stretch or squash (real Einsteinian time dilation stuff, this!). Finally, the Modify Waveform Sequence Table Command can be used to modify an existing 'source' table by copying a waveform sequence table into a 'destination' table but only for the first 50 or so entries in order to produce percussive sounds of limited duration.
The MTU software includes a very decent library of instrument definitions produced using the commands outlined above. Those relevant to the two examples on the demo cassette are listed below:
Sinfonia No. 14
1. Plucked catgut string instrument: harmonics 1,2,3,4,5,6,7.
2. Plucked metallic string instrument: harmonics 1,3,5,7,9,11,13.
3. "Watery" instrument: harmonics 2,3,4,5,6,7.
Dance of the Reed Flutes
1. Flute-like instrument: harmonics 1,2.
2. Reed instrument: harmonics 1,2,3,4,5,6,7.
3. String bass-like instrument: harmonics 1,2,3,4.
4. Clarinet-like instrument: harmonics 1,3,5,7,9.
Music Files are created in the form of a Note String which the music interpreter uses in conjunction with the Command String and Instrument Codings to produce music. A processing loop (SOUND) is constructed during which the duration and pitch bytes of the next event are interpreted and various pointers are set up. The finite time taken to execute this loop actually introduces a gap in the sound generation and can be heard occasionally as a click, particularly when there's a change in tempo or voicing. This is where it would be ideal to have two processors sharing memory, with one generating the sound and the other interpreting the note and command strings (cf. the back-to-back 6800s in the Fairlight CMI).
Entering music is a rather more demanding operation than with the '79 software. As before, each event in the note string has a duration byte and as many pitch bytes as there are active voices. Where things really start to get complicated is in the coding of pitches; this time there's a choice of four different hexadecimal codings corresponding to three different attack modes and a sustain mode. The selection of certain attack modes allows a tone envelope to be continued from a previous event into a current event thereby tying notes and producing a more musical counterpoint of different duration values between parts.
On the music entry side, a music compiler, or "human interface", is promised by MTU in the very near future. We hoped to have this update for the present review, but development problems appear to have put its launch rather behind schedule. However, it will probably allow two methods of music entry: a graphical entry mode and a more conventional alphanumeric entry mode for large pieces. This software should also fully implement a stereo facility, whereby, at the top of the SOUND processing loop, voices 1 and 2 are averaged together and sent to one D/A converter, and, later on in the program, voices 3 and 4 are sent to another D/A converter. There's still the problem of the limited bandwidth to be considered, and it's difficult to see how MTU can significantly improve on this in an 8-bit system if they stick to their guns in using a time-consuming waveform-sequencing program for timbral variety.
The Instrument Synthesis Software Package was developed and written by Frank Covitz and Cliff Ashcraft, though much of the praise due to them should also go to their associate, Hal Chamberlin, who has probably made a greater contribution than anyone else to this exciting field. His superb book, "Musical Applications of Microprocessors" (Wiley, 1981), demonstrates this (reviewed last month) and should be required reading for every contemporary musician!
Acknowledgements: to Baroness International for loan of the Pet 3032, to Commodore for the 3040 Disk Drive, and to IJJ Design Ltd. for the MTU D/A converter and software packages.
Cost and availability: the Advanced Synthesis Software (1979) and D/A converter is priced at £57 + VAT, and the Instrument Synthesis Software (1980) at £30 + VAT. This pricing is likely to change (for the better) in the near future and enquiries should be directed to IJJ Design Ltd., (Contact Details).
Review by David Ellis
mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.
If you value this resource, you can support this project - it really helps!