MIDI Generating LFOs - maxBreakwell.com

MIDI Generating LFOs

3 LFOs summed togetherA few weeks ago, I finally got around to thoroughly reading a very dense tutorial on the Max/Msp website about using LFOs as semi-Random number generators. I’m always looking for newer and hipper ways of adding an amount of randomness to computer music – so why not use MIDI generating LFOs?

The tutorial by Greg Taylor starts here, and in its three parts contains a wealth of know-how on MAX.

I agree with his statement that,

Max is really just about messages, numbers, and lists and how you move them about;

As a newcomer to Max/Msp this article answered many of my questions. It also did a good job of plugging some of the advantages of MAX 5 at the same time. Specifically, the ability to link different elements to MAX’s global transport, and the new presentation view, which although it is cool, I usually put off spending time on.

You can download all of Greg’s examples at various stages of development through the tutorials, but considering how enlightening this tutorial was for me I decided to create my own, somewhat pared-down version, as a learning aid.

LFOs_generating_numbers

The first thing that I did was create 3 LFOs and add them together. What I did was pretty similar to the tutorial, except I added a [umenu] object that that allows you to choose between sine, saw, triangle, and square waves. The three are summed together and displayed below. The fourth LFO, all the way on the right I use to separately generate the velocity for each midi note that gets sent out. I thought this was a nice addition to explore for generating some variety in velocity values. I’ve also considered using more than one LFO here too, but I haven’t gotten around to that yet.

The inside of the [p wavetype selector] object look like this:

If anyone out there has any suggestion on better ways of doing the math here please let me know. Signal math is definitely not one of my strong points. I literally just copied most of it from the MAX 5 tutorials. Once the LFOs are summed together I sent the signal to a series of objects that scale the range of the signal output (-1 to 1) to the range of 0 to 7. I set the range at 0 to 7 because I wanted the [coll] object to contain a scale of 8 notes, the first note being in the 0 position. I had this vision of the end result being a somewhat atmospheric pad sound, but at the same time have that pad utilize notes based around a particular tonal center.

scalelfotocollvalues

The picture on the left shows where the scaled values (between 0 and 7) are sent into the [p coll selecter] object(my apologies for the misspelling of the word “selector”). I’ll explain what goes on inside this object in just a sec. The metro toggle box must be on so that the [umenu] object can select at what rate to generate MIDI notes. Again, the [umenu] object contains all of the recognizable note durations in Max 5. An overview of this syntax can be found here.

This section of the patch decides at what rate to make notes, and from which scale. The various scales are held in a series of [coll] objects inside the [p coll selecter] object. After seeing the way Greg Taylor uses the [coll] object in his examples, I thought it would be cool if I could contain a scale within a [coll] and then, via the transport, trigger different scales of notes at different times during a composition. This way I can have the LFO generated soundscapes move with the harmonic progression of a song. In order to achieve this effect, I placed a series of [timepoint] objects along with the [coll] objects inside of the [p coll selector] object which looks like this:

timepointtriggeredcollsHere you can see each of the colls labeled with the scale that they contain. Eight notes each. (I do know that this harmonic progression is far from standard, but whatever, I thought it sounded cool the other day) I am using the timepoint objects to trigger the different colls when the chords need to change in the progression.

That is how each midi note is generated. Creating the velocity values is pretty much the same procedure displayed on the right side of the patch. You can see this in the picture of the full patch near the top of the post. Both the midi note values, and the velocity values get sent, via [send] and [receive] objects, to the section of the patch displayed below.

lfos_midi_outThe midi notes sent from the [r collpattern] object, the velocity values, and the note duration values all get sent into a [makenote] object to create the MIDI-off notes, things can get pretty noisy if you leave out his object! After that, the numbers are packed, formatted, and sent out the “from Max/Msp 1″ option, available by clicking on [midiout]. I also copied and pasted the various chord containing  [coll] objects to the upper right portion of the front page. Greg posts an awesome “coll loader” patch on this page that allows you to use your midi keyboard to populate the colls. A highly recommended download for adjusting the coll values on the fly while keeping your brain working in musical terms and not in terms of MIDI note values.

I ended up routing this out to some synths in Ableton. Here are a few short samples that I like. At times they seem quite musical, and at others, fairly chaotic. The midi data can also be recorded. So at the very least it can be a fun brainstorm or spring board for better ideas.

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

At the bottom of the page you can see where I have copied and pasted the MAX 5 help patch for the [hostsync~] object. This is just the beginning of me working on having the MAX transport link up with the transport in whatever DAW program I am using. At the moment I am using a demo version of Ableton 8. Right now the [hostsync~] object is just there to provide visual feedback, but the part of the patch on the bottom right (pictured below) allows the toggle box to start both transports at precisely the same time. The addition of the [timepoint] object will create a 16 bar loop on the MAX transport. Unfortunately, for the time being loops points must be set independently in both MAX and Ableton. I suppose in the future with the addition of Max for Live this could be an easy thing to implement, but for now, I haven’t spent the time on finding a way to have loop points mirror each other in both apps.

The Future

I don’t consider myself anywhere near being done with this project. While writing this post I realized a few things that I could have done better.

  • The idea of scaling the LFO’s output (-1 to 1) to match a series of notes is cool, and if those series of notes are an aurally pleasing scale that’s even better, however I think I could improve the way I am doing this. Once I started playing with the LFOs I noticed that scaling the output down to just 8 notes sometimes doesn’t generate all that much variety. On top of that, if we use a full major scale for instance, with certain parameters the LFO might get suck undulating between the 4th and 7th tones in the scale, which might not exactly be the sound you are going for. In the next version I am planning on using less tones over more octaves. Maybe instead of the full scale, just the tones that I think will fit nicely, then have them span over maybe 3 octaves to give the LFOs more range to generate numbers within.
  • Using only one LFO to generate velocity values seems to lend itself to fairly predictable values being out put. For instance a single square wave will produce a very high velocity, followed by very low one, then a high one again….etc. The second audio clip is a good example of this. In the case of that sample, I think it created a sort of cool bell-like sound with the synthesizer, but it doesn’t have much versatility. For the next version, I think I’ll also add another one, or two, LFOs that can be summed together for velocity values and see how that effects things.
  • As much as I enjoy staring at all of this overly complicated looking mess, I think I’ll also have to spend a bit of time working out some more useful and informative GUI elements in Max 5′s presentation view.
  • Lastly, making LFO generated Synth parts that move with a harmonic progression is all fine and dandy, but it doesn’t mean much unless I can link it up with an existing composition, and have a full song to show off. That will be my work for the next week or so, hopefully something totally awesome will come of it

Please leave comments and let me know what you think. I am posting a copy of the .maxpat file here if you’d like to use or modify it. Of course, if you download this and create something even better than I could have done, or imagined in the first place, don’t forget to give me a shout out and send me link so I can check it out!

CLICK HERE to continue on to MIDI Generating LFOs Pt. 2

May 28, 2009

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>