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!

7 comments:

  1. So cool! Love how expressive the breath controller can be while leaving your hands free Awesome weapon for any sound arsenal

    ReplyDelete
  2. I wish the parts were easier to find and cheapest available links were added... that would make this too easy tho suppose. Thanks for the walkthrough

    ReplyDelete
    Replies
    1. I provided links for the parts. And I provided other options. What more would you like?

      Delete
  3. I wonder if there is any easy way to convert the pressure sensor output to a 0-250k ohm output, like an expression pedal. All of my synths have an expression pedal input, and I hardly use MIDI. I mostly just rum them USB to the computer, or use them stand-alone.

    Thanks for this write-up! I remember being intrigued by breath controllers way back when I worked in a music shop. I thought it would be a great way to control string sounds, for swelling and pulling them back.

    ReplyDelete
    Replies
    1. In another post on this blog, I did a ribbon controller for midi, just like this breath controller. For the ribbon, I then extended it by adding a DAC so that it would control synths via CV (as shown in another post). For this breath controller, I could take exactly the same approach and the breath controller control via CV instead of by MIDI. I would just need to attach a DAC to the Arduino.

      You, however, asked about resistive control. One could easily take the CV approach but replace the DAC with a digital potentiometer. That would do exactly what you're suggesting... It would present a changing resistance depending upon your breath input.

      I have a post here on this blog using a digital potentiometer with an Arduino, if you were super interested and wanted to try it.

      Very cool idea!

      Delete
  4. Hi Chip, wonderful stuff, and thanks for sharing this! I am trying to find the best pressure sensor and I came across this model: ABP2DRRT001PDAA3XX - the pressure sensor is -1PSI ~ 1PSI Differential. I am not sure to understand the differential part (there are 2 ports on the chip), does it means that the sensor can detect suction up to -1PSI? but how would that be represented on the voltage out pin (rated from
    0.33 V ~ 2.97 V) ie: how to interpret that on my micro-controller?

    ReplyDelete
    Replies
    1. A sensor with +/- 1 PSI range will likely be far too large. The sensor that I used was +/- 250 Pascals, which is only +/-0.036 PSI. So, your sensor will be 1/30th as sensitive. Maybe it'll function, but it won't be as very expressive. You should really try to find a sensor with a smaller range.

      As for the differential, yes, it can read positive or negative pressure changes. You plug your breath tube into one of the two ports and you leave the other port open to the atmosphere.

      As for how the negative pressures will appear as a signal, it depends whether you have an analog sensor or a digital one:

      * If you are using an analog sensor, the sensor itself looks like a resistor. You apply your upper voltage on one side and you apply ground to the other. You read the voltage produced by the sensor. Zero pressure will be a middle value. Positive pressure will go higher and negative pressure will go lower.

      * For a digital sensor, you get digital values directly from the sensor. Again, zero pressure will be a middle value with positive pressure going higher and negative pressure going lower.

      Good luck!

      Delete