Monday, September 2, 2019

DIY MIDI Breath Controller

Breath controllers are a difficult subject to bring up.  They have a bit of a bad reputation...perhaps because of synthesized saxophone sounds.  Breath controllers often induce people to roll their eyes dismissively.  It's kinda like how many people respond to keytars.  Are they awesome?  Or are they cheesy?  How can you know, if you've never played one?  Well, a buddy of mine started sending me links about DIY breath controllers (see Mixtela's MK1 and MK2).  He knows I'm a sucker for DIY.  So, with this as motiviation, I pulled together my own plan and made my own DIY MIDI breath controller.


Breath Controller?  The idea of a breath controller is that you use your pressure from your breath to control some aspect of your synthesizer.  The harder you blow, you make your synth louder, or you open its filter more, or you bend its pitch.  Some breath controllers are shaped like wind instruments and include both breath sensitivity and buttons (keys) to change notes.  Other breath controllers (such as mine) are simpler and just have the breath-sensitive part.  With only the breath-sensitive part, you control sound parameters on our synth, like having a breath-controlled mod wheel.

My Approach.  I'm choosing to have my breath controller use MIDI messages to control my synth.  Therefore, I'll need to (1) choose a pressure sensor, (2) connect it to some sort of electronics to read the signal, and (3) write some software to send MIDI messages to my synth.  Let's do it!




The Shopping List.   First, let's go shopping.  There are lots of ways to build this device.  Below are the components that I used:

  • Pressure Sensor: Honeywell NSCDRRN0001NDUNV.  This is a differential pressure sensor whose output voltage changes as pressure (positive or negative!) is applied.  The pressure range of this sensor is +/- 1 inch of water (about +/- 250 Pa).  It can be bought it from Mouser, but it's not cheap.  Cheaper sensors will probably work, too. 
  • Flexible Tubing: I used Tygon clear tubing.  To fit onto the sensor's snout, you need a short length of 1/16" ID tubing (here), but most of your length should be 1/8" ID (here).  You want that larger diameter so that you can push enough air through it to be comfortable.  Bigger tubing might be even better.
  • Electronics:  I used an Arduino Uno because I had one around.  You can probably use any hobbyist microcontroller board (including the Redboard or Metro) but you want one that'll mate to your MIDI Interface.
  • MIDI Interface:  I used the Sparkfun MIDI Shield.  I like that it has built-in pots so that I can adjust things while playing.  Note that it does not come with the header pins, so be sure to buy some...you should definitely buy stackable headers.
  • Prototyping Supplies:  I did my prototyping on a solderless breadboard.  I also used some little jumper wires that are typical in the Arduino world.   
  • Power:  During development, I powered the system from my computer's USB port.  But, when I was done, I wanted to be free from the computer.  So, I've been using USB power wall-wart like this one along with a standard USB cable.

Wiring It Up.  After assembling the MIDI shield and plugging it on top of the Arduino, I needed to figure out how to wire up the pressure sensor. After digging through the datasheet for the pressure sensor, I found the information I needed (copied it below).  It has three types of connections: power pin, ground pin, and two output voltage pins (and you can ignore one of them, if you want).  Easy.



Using the solderless breadboard and my jumper wires, I connected the sensor to the Arduino via the MIDI Shield's stackable headers:
  • Sensor Pin 1 to Arduino 5V
  • Sensor Pin 2 to Arduino analog input A2
  • Sensor Pin 3 to Arduino analog input A3
  • Sensor Pin 4 to Arduino ground
After adding the flexible tubing to the snout of the pressure sensor, the hardware is ready.


Arduino Software.  Once it is assembled, you need to write a software to command the Arduino to read the sensor and to issue MIDI commands.  There are lots of choices here, but at it's core, it is three steps:
  • An "analogRead" to measure the output of the pressure sensor
  • Arithmetic to convert the measurment to a valid MIDI value (usually 0-127)
  • A few "Serial.write" commands to send the MIDI message to the synth
In practice, things are modestly more complicated.  Really, though, the primary question is what MIDI message you want to send.  Everything depends upon that. 

Choose Your MIDI Command!  There are many ways to command your synth via MIDI.  You need to find out what MIDI commands your synth can respond to and what is easy for you to configure (three good choices are shown below).  On my synth, aftertouch is very easy to set up without any menu diving.  So, I chose to have my breath controller send aftertouch MIDI messages.  Later, I made it more complicated, but aftertouch is still what I use most of the time.  My code is available on my GitHub here.

From midi.org
Initial Disappointment.  Once I got my system working, I had to learn how to play a breath controller with my synth.  I quickly become bored because all I could make it do were relative slow filter sweeps or unusable pitch bends.  There was no way to give it articulation because it was simply about lung pressure...and my chest does not have much dexterity for quick motions.  Disappointment.

The Key is Airflow.   After some messing around, I had the idea to poke a hole in my tubing so that some air could flow through the tube and out the hole.  Once I did that, everything changed.  I quickly found that I could use very quick motions like tongue-stops on the tip of the tube (in my mouth).  Suddenly, it could respond quickly, like any other wind instrument.  Without the hole, tongue-stops had no effect because the sealed tube kept the pressure high.  With the hole, however, the air vents out when the tongue stops its end.  Therefore, the sensor sees a quick change in pressure and articulation is achieved.  It's so much more varied and expressive this way.  The vent hole in the tube is the key.

It's Fun.  With this modification, I found myself having fun with the breath controller.  Yes, I could still do slow swells on sustained pads.  But, now I could also articulate fast riffs, giving them a new kind of bounce.  Using the breath controller on repetitive arps, I could literally "breathe" life into them via breath-modulating the filter.  And, for single note work, the breath controller is great for contouring one's phrases in a way that is very difficult to do any other way.  So, while I wouldn't use a breath controller in every situation, it is a good time.  I recommend trying it.  And maybe even making it yourself!