[ SOFTWARE ]
Our first challenge would be to produce a range of MIDI format signals and elicit the appropriate response from the RS-70 keyboard. We were pleasantly surprised to find that the byte format is identical to USART with a start and a stop bit (no parity). The MIDI data rate at 31.25 kbps corresponds to:
UCSRB = 0x18 ; UBRRL = 31 ; // when using a 16MHz Crystal
Starting with a simple “note on” and “note off” messages, we were then able to gradually learn how to change volume, and produce MIDI Exclusive Format messages specific to the Roland RS-70.
Another software challenge is to calibrate and “debounce” the accelerometers for volume control. In addition, we find that if we hit a drum with moderate strength, we can accidentally trigger the other drums due to vibrations through the common platform. On the other hand, we would like to be able to have two drums sound at the same time.
Ultimately, the following simple algorithm works well as the first peak corresponding to the hit is the strongest and relatively noise-free (less jagged). The software will track the voltage as it climbs up and record the primary peak. A hit is registered, when the adc values falls below 10 of the peak ( to accommodate for noise while the signal is rising) and the peak value is above a certain minimum. The adc will then wait for the voltage to die out before sampling that drum again.
We find that this algorithm, together with a more stabilized structure, essentially decouples the drum pads and allow the drum machine to recognized consecutive two hits on the same drum within 300 ms of each other. The peak value of the “hit” is translated into three volume levels. The most appropriate quantization levels are determined experimentally.