Reading Volume Through the Analog Pins

I'm toying around with the idea of an Arduino based musical instrument and I have an odd idea for a breath controller...

I would like to take a microphone (any type that would be easiest) and read the intensity/volume through one of the analog inputs. The idea is to create a responsive "solid state" breath controller that could be easily protected from the moisture in your breath (those of you who play wind instruments know what I'm talking about) by isolating the microphone behind a sounding membrane that your breath would be funneled to. What the microphone should pick up behind that sounding membrane would be more or less white noise. I think the steps would look something like this:

Microphone picks up white noise
Amplify
Rectify
Filter/smooth
Scale to 0-5V range
Read through the analog pin and convert to 10bit digital value.

The "filter/smooth" step is the one I'm not sure about. I do have an oscilloscope, so I can experiment around with filters, but I want to know if I am basically on the right track before I get started and my analog electronics skills are lacking. Am I making this too complicated?

Does it have to be a microphone ?

I know that preassure sensors exist that would probably make your project a lot easier.

Actually, I do have a pressure sensor that I bought for that purpose, but I haven't got around to playing with it yet either. I got interested in the microphone type circuit as an alternative because I think that ultimately it would have a better response. In fact, I've also thought about not digitizing the volume curve but using it as an analog gain to modulate the audio output. I would like to be able to expressively control the musical output with breath, tonguing, humming or growling. The transducer may or may not work for that.

I saw an electronic wind instrument that used a pressure transducer in a sealed cavity where you didn't blow air through a mouthpiece, you just compressed the air in the mouthpiece cavity using your lungs and cheeks.

I second the pressure sensor. Freescale (formerly Motorola) has a model with an integrated amplifier (part number 6115, IIRC) that's pretty easy to hook up to the Arduino since the output is already scaled 0-5V. I think I used one cap and one resistor in addition to the sensor (whatever the example circuit on the data sheet shows), and could see the value change when I blew at the sensor.

no idea what it would take for a mic. probably an op-amp at least.

-j

a few weeks ago i built a simple "light flute" using an electret microphone. i pumped up the signal using a bc-377 npn transistor. just blowing onto the mic gives some good white noise as you expect (still it's a microphone and you could as well sing into it, it's not nearly effective/LOUD as blowing air though, using the single transistor amp. not mentioning quality) i read the signal into an atmega using an analog input.
what i didn't like about my prototype was "blowing against no resistance", which in my opinion makes it quite hard to control your breath. but that could be solved i guess. The microphoe approch works at least.

Cool! That is very encouraging. I was thinking of drilling out a small diameter bore in the mouthpiece to provide a realistic amount of resistance.

Hi, I'd be very interested in how you get on.

Following my current Arduino project (a 10-string laser harp!) I want to build a wind controller too, and will be using a microphone for breath sensing.

I'm taking a slightly different tack though, as I want to use the audio output of the mic as the driver for a physical model running in NI Reaktor. This should make the instrument models much more lifelike and responsive, as hopefully the 'shape' of the breath noise from the mic will be able to represent the player's embouchre, so the player has much more control over tonality (particularly techniques like tonguing and flutter).

Anyways, will be later this year before I get round to it, but would be very interested in how you get on with using the mic as breath sensor.

Dave

Maverick, it sounds like we're on the same sheet of music (no pun intended).

I was thinking of keeping the Arduino sketch as simple as possible and just dumping out the button inputs, breath sensor, and whatever else I can think of through the serial port as fast as possible. I found a C# library for sending and processing MIDI, so I think I'll write a PC based app to read the serial data and convert to MIDI.

I've thought about doing something like this for a long time (pretty much ever since I found out how much a really good MIDI wind controller costs), but I would usually get hung up on the hardware design, fingering plans, etc. Then when I got my first Arduino, I started looking at sending MIDI from it, but I was still stuck on fingerings, the complexity of the sketch, and so on. The other day I decided that I would just use a saxophone/recorder type arrangement of eight switches, a rocker switch or a couple of buttons for the left hand thumb/octave key position, and a button near the right hand thumb - they would use the digital input lines on the Arduino. The sketch would stay simple because I would just read the switch matrix and dump it up the PC to translate to MIDI. That way I can easily experiment with mapping fingerings to notes without sending new sketches.

The breath control is the trickiest part. A simple on/off/volume/aftertouch wouldn't be hard with a microphone or a pressure transducer, but, like you, I am more interested in making it as expressive as possible. Another idea I may play with is to "split" the microphone output and use the ADC to just do the note start, volume, and limited aftertouch. Then I would send the analog signal out either to the PC's mic input to do signal processing to shape the ADSR envelope, or maybe to an analog mixer/amp where the shape of the "noise" would shape the synth audio.

Either way, I think that keeping the instrument hardware and Arduino portion as simple as possible would give me the most flexibility in designing a personalized and responsive instrument.

Keep us informed of your progress and I will do the same.

I'm still working on the laser harp (getting a frame made) so haven't made a start on the wind controller yet... at this rate it'll be at least May before I get to it.

I did pick up some interesting 'quantum tunnelling compound' pads though ( http://www.maplin.co.uk/module.aspx?ModuleNo=44202&doy=29m2), which I thought would be neat for aftertouch sensors on the keys of a wind controller. I love real-time-controllers so want as many as possible on the instrument!

I like the idea of using the PC to do most of the brute force processing. I wonder if it would be feasible to write a Reaktor module to interface directly with the controller via USB serial link. If so, it could run at a faster baud rate than MIDI, which would be good for getting lots of controller info across.

Those pads look cool - let us know how well they work. The laser harp is very cool, BTW.

I've been too busy at work to start on my wind controller, but I'm still thinking and collecting parts. I found some really nice switches the other day at a surplus store for $0.25 each. They have a great feel and a very low activation force, but they are a bit "clickier" than I wanted. I may use them for the octave keys. I'm also thinking about putting a 2-axis accelerometer on the instrument to play around with using the horn angle to control overall volume (straight down would be pianissimo, raised up high would be forte) and maybe using the other axis for pitch bend or vibrato (I'll have to really average out or dampen the response, but that's the cool thing about having a mostly software instrument).

I'm going to try to dump the sensor data to the computer as compactly and as quickly as I can to give me more opportunity to process it without lag and to get as much responsiveness as possible.

I have one of those really old "toy" Casio MIDI saxophones (the ones with an onboard synthesizer as well as MIDI out) and it was always pretty fun to play around with, but it had some really annoying characteristics, like an auto vibrato in the onboard synth. The breath control and aftertouch was pretty good and you could transpose it and switch MIDI channels, but it was a far cry from a pro wind controller (or a real instrument, for that matter). I know that you really need a good MIDI synth/sampler to get the best sound (with the sampled breath sounds and stuff), but I'm using the Casio as my target to beat - if I can build a wind controller that good or better, I'll be happy.

There are also some other cool things to experiment with in a mostly software instrument. One of my first thoughts was just to use four finger controls and binary fingering since you can cover one octave chromatically that way. Then you could combine that with two closely spaced octave keys to get a four octave range. Of course, I know the saxophone fingerings (and derivative/similar ones like recorder or Xaphoon) best, so I decided to go with eight keys, but I'm still going to do the two octave key arrangement for extended range. Of course, since I can re-map the keys in software and generate multiple MIDI messages, I can configure it to saxophone style fingerings and still experiment with the binary fingerings on the left or right hand. Theoretically, you could play two notes at once. You would only have breath control over one, but you could play root chord notes like a bagpipe drone. You could also use the binary fingerings and octave keys to select chords, so you could play it like an old chord organ - selecting chords with one hand and fingering the melody with the other.

Maybe I'll get a chance to start actually building something on it this weekend...

I like the idea of the alternative fingerings and the accelerometer. I have a Yamaha WX5 which uses four octave buttons, two above (octaves up) and two below (octaves down) a thumb rest. By covering either or both of the octave buttons it gives a range of +- 3 octaves, but it can be difficult to play and glitches if you accidentally slip off one. I believe the Akai EWS controllers use an octave wheel, but haven't played one.

If you haven't seen it then Patchman Music http://www.patchmanmusic.com/ has some great wind controller ideas and resources, and some absolutely stunning audio demos Patchman Music TURBO VL Upgrade Chip for Yamaha VL70-m (scroll down a bit).

Good luck with the project!