Midi Theremin ADVICE exit status 1 'MIDI' was not declared in this scope

Hello guys, i am a newbie to Arduino. I will try my best to explain my problem and will listen and act on your advice. I am keen to learn.

I have built a Ultrasonic Midi sensor using this guide from instructables.

It works fine and i have been fairly pleased with the results.

But i am keen to make it more like the Midi Theremin, like the version Sonic Robots have made Midi Theremin with arduino and ultrasonic sensor HC-SR04 – Sonic Robots – Learning

I have followed the Sonic robots guide and loaded in the code. But when i try to upload it to the Arduino Uno it gives me an error message.

Arduino: 1.8.1 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/davidyoung/Documents/Documents/InterACT/interact & connect LTD/Hack Space/Arduino Stuff/Midi-theremin-master/Midi_theremin_v1/Midi_theremin_v1.ino: In function 'void loop()':
Midi_theremin_v1:48: error: 'MIDI' was not declared in this scope
MIDI.sendNoteOff(cm_old,0,1); // Stop the old note
exit status 1
'MIDI' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Would anyone be kind and patient enough to give me some much needed advice.


Add the following line at line 21 of the sketch: