Home -> Magazines -> Issues -> Articles in this issue -> View
Lab Notes: Potpourri & The Apple Connection | |
Article from Polyphony, November 1977 |
At last, our computer is in production.
It took longer than most because it's a more complex thing than most (The amazing PAIA Do-All machine - you may substitute any manufacturer's name for ours). The Assembly And Using manual, for instance, is 64 pages. The programming manual (supplied by MOS Technology) another 200. Lots of detail, lots of drawings and stuff.
Yes it took a while; but it's one of our best efforts and one of the first things that we handled as a team. A very gratifying experience.
I really don't want to rave too much because this is not what we came here for this time. A simple statement - it's slick, it's a bargain, I like it.
Because of the effort devoted to getting this product out of the doors I am caught with my literary pants down (so to speak); I don't have any one thing to do a column on this time. Let's just roam, there are a number of things we can look at.
F'RINSTANCE
I saw a thing the other day, a re-print of Marvin's Radio-Electronics Phlanger story. Someone was selling it as an applications note for analog delay lines(!) Now it's flattering, in a way, to have this happen (when people quote you, you kind of figure that you did something worth noting, anyway) but it also has its frustrating aspects.
LIKE
One of the things that was appended to this off-print (our mention had naturally been deleted from the parts list) was a statement that 566 type VCO IC's are near useless in music applications because of their limited range, less than perfect linearity, and like that. Let's look at this some.
For those of you not familiar with the 566 VCOs, they look like this:
The world is beginning to fill with micro-computers. PETs, TRS-80s, H-8s and H-11s; everybody wants to get into the act. The amazing part of this is:
IT HASN'T REALLY EVEN STARTED YET
The personal computer is as fundamental an addition to mankind's bag of technological tricks as any that has ever happened. As basic as television and radio. A recent issue of Scientific American pointed out that just as the industrial revolution freed men's bodies the personal computer will free their minds. We will keep our fingers crossed that this "freedom" doesn't lead to atrophy. Or worse yet, some sort of intellectual anarchy. The basis for freedom is, after all, discipline.
And, before we get off the subject (what is the subject?) why has no one yet done research on the subjective aspects of computers - their psychological impact. The narcissistic implications of sitting (by choice) at the terminal of a computer hour after hour. Isn't it this "self-love" that is the basis for our fascination with these things? A very sophisticated window into our souls. The ultimate slave. Mental masturbation.
That was somehow supposed to lead us into the Apple II interface card (though I now have forgotten how). Oh well, damn the non-sequitur, full speed ahead.
The Apple II is nice. One of the nicer things about it is that it really exists - and has for at least six months. You can really go into your local computer store and see one. And play with it. Don't buy it there, though, buy it from us.
Another nice thing about them is that they are easy to interface to. Inside the case, along the back edge of the circuit board, is a row of eight 50 pin edge connectors. I don't know what all Apple has in mind to go to these connectors (you would probably be safe guessing things like printers and disk drives) but they absolutely could not have made them any easier to use with our synthesizer stuff. Here's ALL the circuitry you need:
(1) | (2) | (3) | (4) | (5) | (6) | (7) |
-12311 | -12567 | -12823 | -13079 | -14335 | -14591 | -14847 |
. | . | . | . | . | . | . |
. | . | . | . | . | . | . |
. | . | . | . | . | . | . |
-12056 | -12312 | -12568 | -12824 | -13080 | -14336 | -14592 |
I didn't list the address range of slot #0 because it's reserved for something that the Apple folks have in mind.
If I have some note N that I want to play, I can do it with the statement: POKE (-14592, N) which assumes that I'm outputting the data to the first output location slot #7.
Simple.
But there are also some tricks involved in determining what N is going to be, and to discuss these I must remind you that of the 8 bits of data that the 8780 accepts, six (the low-order 6) are converted to a control voltage while the high order 2 are used as control flags. Since 6 binary digits can express a decimal number between 0 and 63 (64 numbers), this is the range of the D/A in semi-tones. 64 is the magic number, remember it.
In binary, the decimal numbers 0-63 will "count" like this:
decimal | binary |
0 | 00000000 |
1 | 00000001 |
2 | 00000010 |
3 | 00000011 |
. | ... |
. | ... |
63 | 00111111 |
Notice that in this sequence the two most significant bits of the binary number remain both zeros. Since these are the "trigger" bits, the trigger flags never get set.
I'd really like to impress you with a lot of snappy digital magic, but don't feel that I could get away with it. It's pretty obvious that setting the flags is a simple addition process. If we want to play note #3 with the low order trigger bit set we simply add:
decimal | binary |
3 | 00000011 |
+64 | +01000000 |
67 | 01000011 |
and do a POKE (-14592,67). To set the most significant trigger bit we can add 128 (2 x 64) to whatever note is to be played. To set both flags add 192 (128 + 64).
Clearing flags is the reverse procedure. If we're playing a note with a specific flag set and want to clear it we can subtract:
64 for low order flag
128 for high order flag
192 for both flags.
We need to keep track of what's going on, of course, particularly when clearing flags with a subtraction - otherwise we might actually wind up with a negative number as our output. That won't work.
Usually, it is easiest when programming to use the flag-setting addition as an expression directly in the POKE statement's data argument.
This:
100 POKE (-14592, N+128)
110 FOR R=1 to 20 : NEXT R
120 POKE (-14592, N)
...
...
for instance, is a short program that will cause some note N (determined in previous programming steps) to be played first with the high order trigger flag set and then - after a delay determined by how long the FOR-NEXT loop at statement 110 takes to execute - again with the flag lowered. This would be like playing a note from the keyboard and holding the key down for the duration of the FOR-NEXT before releasing it.
Transposing things into a new key signature is no big problem. To transpose a note up an octave simply add 12 (the number of semi-tones in the equally tempered scale) and to transpose down an octave subtract 12. To transpose up by an interval of a third add --. Down by a third subtract --.
You get the idea.
Suppose that we wanted to write a short program that would play only the whole tones in an octave - how can we do it? One thing that we can't do is simply count because that would play all the notes and playing just whole notes there will be some we want to skip: specifically, the 2nd, 4th, 7th, 9th and 11th.
Here's a way to do it (an OK way, there are probably better) that will also be useful for converting letter-name entries from an ASCII keyboard into the decimal number required to produce the desired note.
First, we define a literal (text-string) variable as follows:
20 LET N$="C-D-EF-G-A-B"
The spacing of the note names within this variable, you will note, is the same as the distribution of the whole notes on an AGO keyboard with the hyphens replacing the accidentals. Now the Program:
100 FOR N=1 TO 12
120 IF N$(N, N)="-" THEN 150
130 POKE (-14592, N+D+128)
140 FOR R=1 TO 200: NEXT R
150 NEXT N
160 END
And since the Apple BASIC is slightly different from most I should point out that the "IF N$ (N, N) ..." business is this language's way of dissecting a string.
It says, "if the constituent characters of the string N$ between the Nth character and the Nth character (in other words, the Nth character) ... etc. ". Various BASICs will have various ways of accomplishing this same thing, most of them. Some have no provisions for "string manipulations" at all - avoid them.
When the little block of code above [runs] it sets N first equal to 1 (statement 100), checks to see if the first character in the string is a hyphen (120), finds that it is not so does not take the branch to statement 150 and instead POKEs the first note (plus some transposing displacement D-plus the flag-setting 128) to the D/A (130), decays (140) and then goes to get the next value for N (150- 100). With N now equal to 2, the second character N$ is found to be a hyphen so the branch at statement 120 is taken to statement 150 (NEXT N) without playing the corresponding note. The variable N increments again (it is now 3) and on going through the program finds that this represents a valid note and plays it.
With a couple of minor changes to this program, it can also be used to convert ASCII keyboard entry of note names into the required decimal numbers. The stages consist of adding a new instruction:
90 INPUT "ENTER A NOTE", A$
changing statement number 120 so that it is now:
120 IF N$(N, N)#A$ THEN 150
and here I need to explain that in Apple BASIC "#" is a symbol for "different from" (most other BASICs use back-to back "greater than" and "less than" signs - <>).
There isn't an appropriate symbol on an ASCII keyboard for flats, so you may want to play every flat at the corresponding sharp and use the "#" symbol. From a programming standpoint, you may want to calculate the decimal equivalent of the sharp by noting if the sharp symbol is part of the note that was input and adding 1 to N if needed. A single statement will do it:
IF A$(2, 2) = "#" THEN N=N+1
The Apple II interface card is available from PAIA for $14.95 postpaid.
4780 Sequencer Modification |
Universal Bass Pedal Synth |
Musical Micro - The Power of the Floppy |
Card Tricks - Music On The PC |
Amiga Notes |
An Ultra VCO From The 4720 |
Enhancing Your Computer |
Amdek DMK-200 Delay Machine Kit |
Software Support - Hints, Tips & News From The World of Music Software |
Hands On: Apple Macintosh Computers |
Starting Point (Part 1) |
Atari Notes |
Browse by Topic:
Feature by John Simonton
Previous article in this issue:
> Patches
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!
Please note: Our yearly hosting fees are due every March, so monetary donations are especially appreciated to help meet this cost. Thank you for your support!
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!