Making a breath controller with maxmsp. Is it feasible?
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?
try [ADC]—->[abs~]—->[rampsmooth~ 0 11000]—->[snapshot]
You can get a breath controller from Interface-Z and connect it to any sensor box (the page is available in French only).
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:
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:
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.
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.
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?
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.
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.
----------begin_max5_patcher---------- 474.3ocyV10aCBBEF9Z8Wggq6V.jn1c29crzrPUVKKJXD5V2ZZ+sOA0z8gs0 sRc8FLdfi799b3C236AlKWyTff6BdHvyaiummMjIfW66dfB55zbpxNLPN6EV dASyp1AlzzOOy1ib9y2fvcAEqJjqz4LsMMTazlP52JYMyIfKzffY6ygK9dJk Tc5RtXwiUrTcSVDbzsvIAgwwlGHbh4QD4VXvLSNa88MMSbiiPihihvMVwINp foTzErNgqYqsSCPokk8YQ3ws3SRgVPKrFDbeEmlCNj426bSRJ961NPFy0CPv GFH3oDaINbeKJw43fVo6gGIWe3f.mZP.oAJjyBGGe8dznrbmXqn3XhKVtKXu Vq7eVdEzR0RotOWRbVI9obIU6r5bHDZASh8.tHaKF5VtTQKJUERod4t.X.BA gvdHTnyHjhuPT28uBQgmDQnoV3fBgWBFQmq5aYC9eEJnSCk1CHhuHLIKs2KH 6mI3+LSl3b5zdYR7zi.G6bAx4hu+6P1umI9WIlRtpJsS4sGoTucpSwYLklKn ZtT7owX98nOMnk7rLls+NGUvyJk0Go1pgCT9FpjPCQRnwURvgnoQURIWcJJb .JJ5pSQjQUQ3Annvqtcamy9+5W15+APVrjRZ -----------end_max5_patcher-----------
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
----------begin_max5_patcher---------- 674.3ocyW00aaBCE8YxuBKdNaB+QHPea+Nlplb.2DGA1HrYKcUM+1GXfT5Jg 5PHz7hs3FG6y4bO9xkWV33tQdfobAO.9Ivw4kENNlPUAbZd1wMkdHJgpLKy8 oDonH0cY8OkQ0Q63hs+JmEoq2Frm228VBvnUUSqLOfJGAO17edRJzBZJyrc+ HmSSZ2MdrIlby9ugPsAKOMtHgoMGOrydn3+0rGPT4QbZsxBc6hQMQqCoeNiU ivJNP0tKAtanhstfGqV1qKVTMrzRYHRllxD5VPpYGLz2Ukw0JP4IBJwxFVtZ .kBt1HQnZMB5sZjRk20KUsQyxYpRZQ0bonOjBql7ZFlTgKlqxRnOq.zhXtb. UiTKW3ZHA8FoACFdyUMBw2fTe+aupYsaC251HiT2Bl.caDJvdUAe.1gZXW8j Ooc7D45RAR6FsWQy2VTorM0.Os7dI26YA7bkWFWEkD1uYIoLMK+3Pteh4JHN DYxhnfAI5vEQsjN7Re2sjQqWanBwJFA+RYTJSonaYerpuVlM3qDCqHEwPML1 vyfK9hW+k4QWxEuI1xdd4flqGJkiL2OWYTELYb5QvcmbXoeekwFfBBsvu6+k Z2Er+TBhOldEzL0No9H3MOYBWvhjEBc2jv46Nromm0jVGvkk6I2vbecygSod kSSyToRod2QfG.V1xh2PEKf08ZAME5g3Q1eCtWIBOIRjhuUTdnSoFQ2nN94h Brojw5Q1o7025xrpIwQG+72pDRtFIAdC+LqFIYY+hiAml5F+22eZnZU72qXJ YQdT6V2TD.7FaiYJMWXZAuyZp5.pyh1wiiYhtstmxiyj7N8+0a5yVHgs.RjY EQVIR2ePBMu4MnMPZVQDxBDgu6719yJhBrwaOu9Hu6OHYChtFHU9vqK9G3S. wZI -----------end_max5_patcher-----------
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"?
Just tried your patch with Max 6 and it works perfectly. Many thanks.
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!
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.
----------begin_max5_patcher---------- 853.3oc0X0zaaBC.8bxuBKzN1LgMFHc2lTuzC6WvT0jC3l3NvFgMcMqp4297 GvZ5JgvVItYGBNXL3264G1OyiymErR7.UF.9D3qfYydb9rY1pLULq87YAkjG xJHRayBxDkkTtJ3B20TzGT15uRzrpftHqfk8cfR.jzBZlBrUzTC9x0WcMHmd OKiBVrXAfTnn0bhhcOsXKP+zn0.0FJnjky5ZGmTRADIf.pH05+qaSWeVv3zL QC21w31J4MkLdAUYQIrsxaEbkj8SpsNzGCetshFUWi6pshnx1v3q+VsF3NII JMReSfjvklBXBzdl9AAto8lX4V1KVc2BTTvdcqA+1K84ZFoHvbgmlO2b3hQp zb5OzO1WIzFQRi9fSIuQKuzwTro.aOAE1OsgoSKsKoRIYM8U7FA9.rWRi9aH cmB4pRssh5XbPvu4Ve9fHqOHFEaJhrpBb4AzC+YCtUTWR52IjNIhBy7N1MG0 mDmZ0EXX3PFkTunKxLRAEDBflenzdEmDO3XhsJCNIwTbIZHgIdZElaKDZF71 me.cHhq6.iqCDrhvWOrJ3bDQt2ahGzdfPSqLbnEpjULkDnIEPS2UzZ4IclTn 6UCji6vv3AkfP+HA4LYUAYqdw0F8ZImT9icDOZTyP.uzy72iNfnNG.dPEX4z p.2IaXcOw6jj50MFAoMv2uAPu7dJlED0xcWQBt6XuTG+uPvBpNCoMc3tfIfM GaAOL1FALxMgNDsbPFg9efQooVpfGEifSYhNoRT8tknKzs9rkttzcGLPWneB 3JUjZ06kdfcQ8coVFNf6DOEku86w1g71jqGwumLkAS4jJ4FgZG3YC0K1IK5z Mz6RrMhjZs4TRwc1f9TErWBxq2zekrTHTa1YhxqiND1q+HZRTHIaMWC+AkHn K7FztD.LZvnL9YSfjUxcu8vKSfn.am3Hcv3s9QSxy1cB27Sqlbw3TG2pLWhO t3.Gm3XuU67F+wWsy16l5eohIEM0YcXucW3fmAPNUpXluDmfuWafurQaX44T 99wbKY4UB1dAI6c3arPx7ESNJlLPB4MHgGAhh8pHEOlwsH+NtMFHA8KjBGCl 7JjVd1gnw75VhWQDZDH57yai7JhFyTRnyOHAwmcda74mH8VF2zm7z7eAP4Wb zA -----------end_max5_patcher-----------
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 :-))))))
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!
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
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…?
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 :-)
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.
Huh? Works fine for me!
You migh be interested in this:
Cool — thanks for bringing it to my attention
Forums > MaxMSP