Home -> Magazines -> Issues -> Articles in this issue -> View
Technically Speaking | |
Article from Making Music, August 1987 | |
ANDY HONEYBONE tries to make FM simpler by seeing it all at once. This month he starts a software two-parter to LIST DATA for the DX21 in understandable lumps.
You may remember that last month's epistle was the first in an occasional series in which I attempt to bring together four and six operator FM synthesis in a compare and contrast exercise for our mutual benefit. In this second installment I'm going to detour to begin a two-parter in which I'll describe a software tool to generate a voice/function data listing for the DX21.
It is generally agreed that the biggest barrier to understanding FM is that without the type of listing to be described in this article, the programmer is deprived of the 'helicopter view' of the voicing, and is forced to glean single parameter information from two line screens of miniature proportion. Let's attack the problem at the source.
The requirement is to extract the voice data from the DX21 over MIDI and then present the edit buffer information in the form of the official Yamaha chart. The first problem is that the official chart is too wide for our 80 column BBC screen to accommodate. An Epson compatible printer however (I used a Centronics GLP II) can print in condensed mode and this gives a width which is more than sufficient for the job. But hard copy isn't always required and so it is necessary also to present a cut and paste version of the chart screen by screen on the monitor.
Voice dump programs tend to be large unstructured pieces of code which call machine code segments when forced. The other criticism is that they often contain too many literal strings of the characters used to draw the box sections and this presents a nightmare for anyone trying to type the program into a machine from the listing. In trying to address these problem areas, I may have created a monster. The FORTH language forces structure even if the subject to be coded appears to possess little. It is my hope that the definitions I have created will allow easy modification for the DX27/100 and TX81Z voice parameters.
The first step in the design of the program was to use a word processor to generate the layout of the chart. Having identified repeating units and themes, the coding was started. The program listing begins with the declaration of many of the constant values used in the program and this greatly improves readability. Note that in a volume of source code which fully fills the VIEW word-processor, only one variable is used. Three execution vectors are also declared which are words whose function can be altered at any further stage in the program. They are used to define lefthand margins which are of different width depending on screen or printer output.
Two arrays are then created which are the nearest thing that FORTH has to DATA statements. The first, 'scale', contains the hexadecimal ASCII representations of the chromatic scale for use in decoding the transposition function value. The second array comprises the decimal frequency ratios available for the operators. Each value is multiplied by 100 so that all the values are integer — FORTH doesn't handle floating point numbers. The commas cause the values to be stored into memory — don't think that they're just separators. Beware the current number base — the base changes from hex to decimal several times.
The next two definitions are machine code and deal with data reception and transmission. The interrupt routine is called whenever a MIDI byte arrives at the interface. The byte is stored sequentially in a buffer and the process terminates when an end of system exclusive status byte is received. The routine xmit (transmit) it used to send the command to the DX21 to entice it to send a single voice dump.
The definitions jmp.nmi, setupbuf, prepare, setup, tidy.up, dump.req, chksum, fill.buf and get.dx have appeared in various guises on these pages before and suffice it to say here that they are concerned with the housekeeping duties of interrupt handling.
The next section comprises printer and heading definitions. The title page uses the Teletext double height feature and then describes the two red function keys which select either screen or printer output. The definition '>LP' (to line printer) passes characters to the printer only and prevents occurrences such as the VDU drivers receiving the enlarged character command and turning page mode on! Because the output to the printer exceeds 80 characters, it is necessary to prevent its display on the VDU. The output stream is selected by the *FX3 command which is passed by FORTH directly to the operating system. The hard copy is centred on the page by resetting the left margin of the printer.
Now we begin the voice chart proper. This section begins by generating aliases for the plus and minus arithmetic symbols prior to their redefinition. The plus symbol thereafter causes a plus symbol to be printed. If you require two numbers to be added, it is necessary to use the keyword 'PLUS'. Similarly, the minus symbol and the vertical bar character are redefined.
The word 'dashes' prints a number of minus signs according to the value it finds on the stack — the comment ( n --- ) means that it expects one number to be on the stack and removes it when it executes. The definition 'edge' prints a number of box edges of the repeating pattern '-----'. The sides of the display boxes are drawn by 'side' which prints the vertical bar character at suitable intervals. The definitions lm1, La, Lb, Lc are all lefthand margin widths. The definition 'null' is a no operation word which the execution vectors may be assigned to do when no margin is required.
More dogsbody words follow: 'get.param' returns the indicated value from the received edit buffer; 'calc.offset' calculates the relative position of the start of the parameters associated with a given operator; '.2_digits' (print two digits) formats a supplied value into a righthand edged box section. The definition 'op.param' causes the operator parameters to be printed given the operator number and the relative parameter number. It has to unscramble the awkward 4,2,3,1 storage order that Yamaha have imposed. Finally, 'gen.param' (general parameter) combines 'get.param' and '.2.digits' to display a buffer parameter value directly with no conversion.
You'll have to wait until next time to see the routines to translate the less straightforward parameters.




Topic:
Gear in this article:
Synthesizer > Yamaha > DX21
Gear Tags:
Feedback by Andy Honeybone
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!
New issues that have been donated or scanned for us this month.
All donations and support are gratefully appreciated - thank you.
Do you have any of these magazine issues?
If so, and you can donate, lend or scan them to help complete our archive, please get in touch via the Contribute page - thanks!