This is brilliant — a program that'll generate random patches for the DX21. Well weird!
Randomise your DX21, and produce utterly, utterly... er... different sounds. Andy Honeybone says so, and programs as much.
AN INFINITE number of DX21 voices for free? Sounds like advertising copy I know but that's what this month's listing will give you. The idea of computer generated random patches isn't original but the convenience of having the voice automatically loaded ready for playing at the dab of a key makes this implementation highly attractive.
Not only attractive but also addictive. In fact it's a wonder that I ever managed to drag myself away from using the program to write this breathlessly exciting description. You know what it's like exploring voice banks — well, just imagine the struggle that you'll have to turn the thing off without knowing what the next patch will sound like.
Of course, no random number generator is truly random but it does produce a sequence of apparently unrelated values which does not repeat for a very long time. In order to vary the order in which the patches appear, the random number generator can be seeded with a random value of your own choosing.
Before I wrote the program I had severe reservations that the results would be like those of monkeys at typewriters when they weren't producing Shakespeare. With a little selective biasing here and there the patches have proved very useable. OK, some have ridiculously long fade-ins and some drone on forever, and, for that matter, the odd one won't even sound at all. What characterises many of the voices is that they are the sorts of sounds that you write tracks around — the sort that you don't find as presets.
In operation the program is dead simple. You keep pressing the space bar until you arrive at a sound you think has promise. Next, you press the tab key and a prompt appears which asks you to name the patch. After your entry, the named patch is fed to the DX21 again for you to store in a vacant memory slot. This done, function key fO is pressed and off you go again.
As if this was not enough, the voice parameters for each operator are displayed in tabular form for your further pleasure. The combination of the sound and the main parameters simultaneously displayed gives a far better insight into the world of FM programming than can be gleaned from the tiny window of the DX21's LCD.
The program is written, as ever, in Acornsoft FORTH for a BBC 'B' micro equipped with a Making Music MIDI interface. Don't let this put you off — the program is easily adaptable and I'd really like to hear from anyone who's ported any of the code presented in this column to other machines.
Firstly, a block of memory is reserved which is then filled with values corresponding to the Yamaha MIDI system exclusive header and INIT VOICE parameter values. The random number generator then fills the operator block locations with numbers in the correct range. The algorithm and feedback values are similarly randomised and then, after calculating the checksum, the assembled dump is sent to the DX.
The program starts with constant and variable declarations and attempts to impose some structure to the DX21 VCED format voice dump. Next, the seed value is initialised to a number which you can pluck from the air. This same line can be entered from the keyboard to change the seed value once the program is loaded. A machine code MIDI transmit definition (xmit) follows.
Random number generation is handled by (RND) — a routine borrowed from the Acornsoft FORTH manual. The random number is scaled to a supplied limit by the word RND. An array holds the various limits but a degree of bias is applied by generating the random number over a bigger range and then selecting the limit if it was exceeded by the random value. For example, the attack rate is biased toward faster attacks (higher numbers) by generating numbers in the range 0 to 50 and then chopping anything over 31 down to 31. Similarly, extreme keyboard scaling levels and frequency ratios are depressed. Operator output levels are unashamedly biased high. There is plenty of room for experiment by changing the values of the bias array.
The voice buffer vox.buf is initialised in stages by getting the "upside down" value on the stack and using a loop to store them sequentially in memory. The random values for each operator block are inserted by the routines fill_md and 4_ops. This last definition also invents the algorithm and feedback values and sets the frequency ratio of operator 1 to 1.0 to ensure the generated sound will be at a sensible pitch.
Every DX voice has a checksum which is the last seven bits of the 2's complement of the summation of the constituent data bytes. The sum of the data bits and their checksum should therefore equal zero and this fact is used to check corruption in transmission. The definition chk calculates the checksum — the 2's complementing painlessly achieved by the FORTH word NEGATE.
The remainder of the code is concerned with displaying the parts of the voice data which are affected by the program. The parameter names are written by the definition legend 1, ably assisted by the cursor positioning word move. Little can be said about disp.vall other than that it extracts the values from the buffer and prints them in columns on the screen. It also works, which was surprising.
So there it is. Type it into your word processor (don't use tabs, rulers, etc) and use OS' EXEC filename to spool it into FORTH. Alternatively, use FORTH screens as is right and proper.
Of all the MIDI software I've written, this is the one that gives me the greatest sense of something for nothing. And what better than the Xmas ish to lay it on you. Happy New Year.
Gear in this article:
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!