Early electronic instruments like the RCA Synthesizer Mark II or Siemens Synthesizer (above) from 1950s were built by one manufacturer with proprietary interconnections. The advent of modular synthesizers led to a simple interface with analogue signals in the form of a control voltage and gate signal pair which could connect keyboards (a controller) and sequencers to other electronic instruments.
In the early 1980s, manufacturers collaborated on the first MIDI standard which was published in 1983. From www.midi.org:
MIDI is an industry standard music technology protocol that connects products from many different companies including digital musical instruments, computers, tablets, and smartphones. MIDI is used every day around the world by musicians, DJs, producers, educators, artists, and hobbyists to create, perform, learn, and share music and artistic works.
MIDI Manufacturer's Association
Colin's Lab: MIDI is a great video introduction to MIDI. There is also a transcript of the video.
Some instruments allow more variation (modulation) of the note than others. For example, the main variation a pianist can achieve is through the velocity of the key strike which determines how the hammer hits the strings. Other instruments like the violin have more possibilities for continuous modulation, i.e. variation of the note while it's being played.
For electronic instruments, the key-less theremin is perhaps the most well-known, expressive one. A less well-known early electronic instrument is the remarkable ondes Martenot which had a continuous pitch ring, lateral movement for pitch on later keybeds and a pressure sensitive button ("lozenge") for varying volume (amplitude modulation). The pre-MIDI Yamaha CS-80 was first synthesizer with polyphonic aftertouch, modulation achieved by placing additional pressure on the depressed key(s) after the initial strike.
ROLI make the most common, modern, highly expressive keyboards using the relatively new MIDI Polyphonic Expression (MPE) standard. Another example is the MI.MU Glove controller and its simpler cousin the (non-MIDI) MINI.MU Glove.
adafruit_midi CircuitPython library includes support for sending and receiving MIDI messages (sometimes called events) over USB. This library is used by the two programs in this guide.
The first program creates a MIDI controller using the 7 capacitive touch pads on the CPX as keys and the onboard accelerometer to apply expressive effects by measuring tilt to control the pitch bend and modulation wheels. The two CPX buttons are used to change octave/semitone offset and the keyboard scale. The switch inhibits the tilt control and selects between octave and semitone change.
The second program creates a MIDI-enabled synth on the CPX which plays a sawtooth wave of the appropriate pitch and volume for the incoming notes. Pitch bending and a limited form of amplitude modulation are implemented.
Both programs uses the NeoPixels to represent the note pressed/played.