22.09.2015 Views

of Microprocessors

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

294 MUSICAL ApPLICATIONS OF MICROPROCESSORS<br />

effect, a sample-and-hold function is needed. S1 and C2 form the sampleand-hold,<br />

which is updated whenever a trigger is generated. C2 should be a<br />

low-leakage low-dielectric absorption type (polystyrene) and A3 should be a<br />

low-bias type so that the control voltage output does not audibly drift during<br />

long decays. R2 and C3 provide adjustable portamento, which is a gliding<br />

effect between notes.<br />

The timing diagram illustrates a typical playing sequence on the<br />

keyboard. For an isolated key closure, the gate goes high during the closure<br />

time and the trigger is coincident with the rising edge <strong>of</strong> the gate. The<br />

control voltage output goes from whatever it was to the level corresponding<br />

to note G5. The next case is a three-note sequence in which the key closures<br />

overlap somewhat. The first note (A5) starts the gate and trigger as before.<br />

When B5 is initially struck, nothing happens because A5, being lower than<br />

B5, takes precedence and no voltage change occurs on the keyboard bus.<br />

When A5 is finally released, the change in bus voltage is detected and<br />

another trigger is generated and updates the control voltage output. Response<br />

to the following G5 is immediate, however, since it is lower than B5.<br />

At the end <strong>of</strong> the sequence, when G5 is released, the trigger is suppressed<br />

and the control voltage output remains at the G5 level. Also shown is a<br />

typical ADSR envelope that might be generated in response to the illustrated<br />

gate and trigger sequence.<br />

Computer Interface<br />

Interfacing such a keyboard to a computer is fairly simple. Basically, all<br />

that is needed is an ADC connected to the control voltage output and two<br />

input port bits connected to the trigger and gate signals. Whenever a trigger<br />

occurs, an analog-to-digital conversion would be initiated. If keyboard operation<br />

is restricted to the 12-tone equally tempered scale, then the ADC need<br />

only be accurate enough to determine which key is pressed. Thus, a 6-bit<br />

ADC is sufficient for a five-octave keyboard provided that the voltage step<br />

from key to key is matched to the ADC step size.<br />

Once interfaced, it is a simple matter to write a program loop that<br />

looks at these inputs and controls the synthesizer in response to them. If<br />

keyboard activity is to be stored for later editing and recall, a real-time clock<br />

is needed. The program would then note the time and the keyboard vQltage<br />

whenever a trigger occurred or the gate changed. Maximum program flexibility<br />

is attained if triggers and gate changes are connected to the interrupt<br />

structure on the computer. Then the program may do other tasks and still<br />

respond to the keyboard quickly when necessary.<br />

Figure 9-2 is a simplified diagram <strong>of</strong> a suitable interface. The gate,<br />

trigger, and ADC output data enter through an input port. The flip-flop is<br />

set whenever a trigger pulse or trailing gate edge occurs, which signifies a<br />

significant keyboard event. When set, this flip-flop may request an interrupt<br />

via the 7405 open-collector inverter. The interrupt service routine can de-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!