- 1. Press a key on the computer keyboard. The ASCII code is displayed in decimal format.
- 2. To display the computer key pressed, the ASCII code is drawn using an lcd object.
- 3. MAP TO MIDI PITCHES
The ASCII code is sent to the right inlet of a gate object. The toggle object controls whether the gate is open (On) or closed (Off). If the gate is open, the ASCII code flows out of the gate object’s outlet and through the chained series of number boxes. Many of the ASCII codes are too “high” to map directly to the MIDI pitches (0-127) so a – 12 was added in the chain to achieve a better range of pitches. Finally, each pitch is displayed on a grand staff using an nslider object.
- For example, the ‘a’ key is pressed; the ASCII code is 97; 97 – 12 = 85, which is equivalent to C#6; so C#6 is played with velocity 90 and duration 100 ms.