Skip to content

Commit 2976842

Browse files
committed
Update midi-instrument.md
1 parent 5cfa05a commit 2976842

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/midi-instrument.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,19 @@ Finally, add the `midiCommand()` function from above. Then upload the sketch and
232232

233233
## Other Instruments
234234

235-
You can build many other instruments by combining analog and digital inputs and changes in programming like this.
235+
You can build many other instruments by combining analog and digital inputs and changes in programming like this. The principle behind them all is the same:
236+
237+
1. read sensors
238+
2. determine when something important has happened (like a state change, or an analog sensor crossing a threshold)
239+
3. Generate a MIDI message from the sensor event
236240

237241
Here's an example that uses [eight pushbuttons to generate a piano](https://github.com/tigoe/SoundExamples/blob/master/MIDI_examples/MIDIUSBJoystick/MIDIUSBJoystick.ino). The eight pushbuttons are attached to pins 0 though 7 just as the one shown above. The pushbutton is connected to +Vcc on one side, and to the pin on the other, with a 10-kilohm pulldown resistor from the pin to ground on each one.
238242

239243
![Figure 2. Eight pushbuttons attached to pins 0-7 of a MKR Zero](img/pushbuttons-8-input_bb.png)
240244

241245
*Figure 2. Eight pushbuttons attached to pins 0-7 of a MKR Zero. This uses the same digital input configuration as Figure 1 above.*
242246

243-
Here's another example that uses a joystick to generate a note. A joystick has a built-in pushbutton and two potentiometers. This example uses the pushbutton to start or stop a note, and the joystick to generate a pitch bend on the note. Pitch bend is a controller type in MIDI that lets you bend a note up or down from its original pitch. The joystick's X axis pin is attached to pin A0 and the pushbutton pin, marked SEL, is attached to pin 5. Note that the pushbutton does not have a pulldown resistor because it is using the Arduino's internal pullup resistor. In this case, the pinMode is `INPUT_PULLUP`, and pressed is LOW and unpressed is HIGH.
247+
Here's another [example that uses a joystick to generate and bend the pitch of a note](https://github.com/tigoe/SoundExamples/blob/master/MIDI_examples/MIDIUSBJoystick/MIDIUSBJoystick.ino). A joystick has a built-in pushbutton and two potentiometers. This example uses the pushbutton to start or stop a note, and the joystick to generate a pitch bend on the note. Pitch bend is a controller type in MIDI that lets you bend a note up or down from its original pitch. The joystick's X axis pin is attached to pin A0 and the pushbutton pin, marked SEL, is attached to pin 5. Note that the pushbutton does not have a pulldown resistor because it is using the Arduino's internal pullup resistor. In this case, the pinMode is `INPUT_PULLUP`, and pressed is LOW and unpressed is HIGH.
244248

245249

246250
![Figure 3. Joystick attached to pins 5 and A0 of a MKR Zero](img/joystick-input_bb.png)

0 commit comments

Comments
 (0)