Forums > MaxMSP

Making a breath controller with maxmsp. Is it feasible?

August 15, 2011 | 1:21 am

I’ve given up trying to find a breath controller through which I could send midi CC event to a synth. I’m wondering how feasible it would be to do this with MaxMSP by having it detect how loudly one blows into a microphone. I don’t know my way around the MSP side of things but I tried to use the levelmeter connected to a snapshot object figuring that if I could get results from that, I could map the data range to midi range….unfortunately I couldn’t get it working….

I suspect this might be really easy but I’d hate to waste hours on it if I’m going down the wrong path. Has anyone done something like this?


August 15, 2011 | 5:50 am

try [ADC]—->[abs~]—->[rampsmooth~ 0 11000]—->[snapshot]


August 15, 2011 | 8:05 am

You can get a breath controller from Interface-Z and connect it to any sensor box (the page is available in French only).

http://www.interface-z.com/produits/cs20_souffle.html


August 15, 2011 | 10:20 am

Hi
Breath control is a very attractive modality/gesture and there are a number of hardware solutions; AudioMatt’s simple suggestion above will work. You could use breath as an ‘additional’ modality in conjunction with a midi keyboard, as in metabog’s fine example here:

http://www.youtube.com/user/metabog#p/u/37/QWmoTFhokEU.

Besides Roald’s suggestion of a DIY approach you might also buy a Freeduino, a flex-sensor and a plastic tube, and build a digital wind instrument? My personal favourite method. The team at mybreathmymusic have designed an excellent consumer breath-controller using simple sensors:

http://www.youtube.com/user/mybreathmymusic#p/u/5/29VSkZSYjXY

Perhaps you could find a secondhand Yamaha WX5?
Just a few examples to whet your appetite.

Good luck, this sounds like an interesting project so keep us all posted on your progress.

Brendan


August 15, 2011 | 12:23 pm

Actually, I have a pretty sophisticated breath controller in my Eigenharp but I’m looking for something simple that I can use to control the filter cutoff of my Minimoog when I’m playing keyboards to emulate some of the playing techniques of Manfred Mann. Since I’m now using Max to completely control my live rig, and I have a wireless mic anyway, it occurred to me that using Max for this purpose might be very effective. I will try AudioMatt’s suggestion today — it looks like it’s exactly what I need. Is there a way to monitor visually the amplitude in real time? As I’ve looked at the various objects, it seems that you have to send them "bangs" to force them to show their current value…that seems awkward.


August 15, 2011 | 1:15 pm

Hi
Eigenharp and a minimoog? Jealous.com!

So you need breath amplitude ===> Max, midiout ===> moog? Well, AudioMatt’s suggestion is the one, though you may have to do some tweaking to rampsmooth and snapshot arguments to get it responsive enough.

As for visualization, do you need something better than [meter~]? And you saw this thread too perhaps?

http://cycling74.com/forums/topic.php?id=34758

Brendan


August 15, 2011 | 4:43 pm

Well, that’s just a piece of my live rig. Here’s a picture of the full rig. (http://imgur.com/Tdawt) The thing is, I used to control my rig with Apple MainStage but I had so much trouble with MainStage, which doesn’t seem to be able to handle a large rig well without glitching, that I replaced it completely with a Max/MSP system last month (http://deskew.com/blog/replacing-apple-mainstage-with-a-custom-maxmsp-implementation-part-1.html) — that has been working perfectly.

But since I was previously using Max to manage my Eigenharp, I’m now at the point where it’s clear that EVERYTHING I do should just be managed by Max, which is what led me to start thinking about the breath control issue.

Not sure what visualization I need — I really just wanted something to confirm it was working during development. Thanks for the ref to the other thread as well.


August 16, 2011 | 4:25 am

So I tried to make a patcher using AudioMatt’s suggestion but it does not seem to want to respond. I have it configured through the DSP status to get input from my iSight mike but no matter how much I "scream", the meters don’t move so I have no sense whether anything is actually happening. Attached is patch — would appreciate any isights.

– Pasted Max Patch, click to expand. –

August 16, 2011 | 5:51 am

There were to problems with your patch. snapshot had no argument so it didn’t know the rate at which to sample from the audio stream you gave it. Also, vu meters only take audio, not numbers

– Pasted Max Patch, click to expand. –

August 16, 2011 | 12:31 pm

This version also doesn’t indicate that there’s any audio going through it. I’m using the iSight camera (which has a mic in it) and have verified that it is working by running the audio check from Skype.

Is there something one has to do beyond configuring the DSP status to make sure the right input is selected (which it is) and ensuring that it’s "ON"?


October 29, 2011 | 9:05 pm

Just tried your patch with Max 6 and it works perfectly. Many thanks.


May 8, 2012 | 4:07 pm

Obviously I came here because I am trying to find a solution for a breath controller. I tried AudioMatts Max 5 Patch and use it with Max 5. So the program opens and it seems to work, at least I see some action when I blow into the microphone. Now I am expecting some sort of Midi Out message which isn’t there, or I don’t see it. What am I missing here? I was looking for a midi out object, but since I just installed Max 5 and the Demo expires in 25 days I feel a bit stressed to deal with this. I would really appreciate if some one could help me or upload a patch with midi out. Thanks a 1000, this looks promising!


May 8, 2012 | 4:26 pm

I just modified the example from AudioMatts to produce MIDI OUT CC events.
Didn’t test it but it should work and will at least give you the idea how to do it. MIDI support is pretty trivial.

– Pasted Max Patch, click to expand. –

May 8, 2012 | 5:03 pm

dhjdhjdhj,

What a prompt response! I gave it a quick test on a Powerbook and used MIDI Monitor. It seems to do what I am looking for. Will have to play with this tomorrow. Thanks for helping, that’s just plain awesome. Didn’t expect anything .. dang, cool, very cool :-))))))


May 9, 2012 | 9:07 pm

dhjdhjdhj,

Your patch works almost perfectly, tried it with the demo of Max 5 on a Powerbook. Now there is one problem: If you blow too hard into the mcirophone the message stream gets stuck at "Invalid 1bytes" and it wont respond to my breath anymore. If you know how to fix this please let me know or upload a patch. Meanwhile I play with what it does so far. I was looking for something like this for Pure Data but looks like Max/MSP is the route to go.

Cheers, great work, thanks a lot!


May 9, 2012 | 9:20 pm

It’s not my patch. AudioMatt did the hard part. Don’t blow too hard -:)

Seriously though, I didn’t look that closely at the actual output coming from the breath part. If it is going higher than 1.0 then the scale object will also put out values higher than 127 and that might very well screw up the midi data.
There is a version of scale that actually doesn’t allow values through if they are outside the expected range but I don’t remember where it is….maybe part of zl object. You could also use a [split] to constrain the values to within the desired range.

I’m not at a computer right now and since cycling74 doesn’t have an iPad version (yet?) I can’t help any more right now


May 9, 2012 | 9:46 pm

try running the input signal from adc~ through
[clip~ -1. 1.]
*before anything else* including the meter~ or snapshot~. this will eliminate extreme values in the signal and might solve the issue. you can adjust the clip~ values inward if needed, but they should always be between -1. and 1.

Some tweaking of the level of input will probably be necessary to get the levels you want—how hard the air has to flow to get the right response. You can always run the signal through a [gainfader~] before any [snapshot~]. (Note that gainfader~ can overdrive the signal, so you should clamp the fader’s values to 0-127.) This way you can set the mic level in the OS to a reasonable average level, and adjust the secondary gain~ within the patch in realtime—maybe with a MIDI footpedal? :)

Just saw dhj’s post, the scale-like object that clamps values is [zmap]. I do think that the out-of-range values are what is causing your error. So, you could ignore the advice I put above if you want :) and just use [zmap], that way even with overloaded signals you’ll still get valid values in the output. Try both ways maybe, they might work differently and one might be better musically…?


May 11, 2012 | 1:04 am

Thanks for the tips. I exported the Patch as an app and tried it on another Mac. It works actually just fine without giving me any errors. It seems to be a bit CPU hungry, needs about 35% of what I have :-|
I use it with a condenser Mic that pics up any background noise around me (which isn’t good for that purpose) I also increase the minimum velocity from 1 to values like 5 10 or 15, that would eliminate such background noise.

In fact such a breath controller, no matter what technique you use, helps you as a producer to compose more natural phrasing that are just as long as you can exhale (unless you are really good with circular breathing). Using a microphone for this purpose seems, with this patch, pics up more detailed modulation of the airstream then you may want. So, perhaps, implementing a function simplifies fluctuation may be good. I also found a VST from Pizmidi "midiAudioToCC" but couldn’t get this to work because I use Motu DP which does not read VST on Mac #*#%^!

So, it looks like it does what I am looking for. Maybe removing the three VU meters may help towards better CPU efficiency. Last but not least I was trying to convert it for use with Pure Data but I got stuck here and I guess I have to read the manual to understand what I have in front of me. Thanks, again. It’s nice to find such prompt support as a newbie :-)


May 11, 2012 | 2:26 am

blowing into a microphone wont work i think, not even with a 300Hz highpassfilter attached.

but if you use one of the above recommended controllers, or one from yamaha if you like,
some clever max patching (nonlinear scaling, smoothing, limiting) will definetly help to
make more use of such controllers.

-110 *breathless*


May 11, 2012 | 2:34 am

Huh? Works fine for me!


May 9, 2013 | 4:10 pm

You migh be interested in this:

http://www.kvraudio.com/product/usb-midi-breath-controller-by-tecontrol


May 9, 2013 | 6:05 pm

Cool — thanks for bringing it to my attention


Viewing 22 posts - 1 through 22 (of 22 total)