Forums > MaxMSP

Algorithmic Suggestions

Nov 02 2013 | 2:15 pm

Hi I have been working on the below patch I followed with one of the BAZ Tutorials. Simple Probability. Just wondering if anyone has any ideas how I can maybe move on from here and go further with the patch.

Im trying to get further into using algorithms in my music so any suggestions are welcome.

Thanks :)

-- Pasted Max Patch, click to expand. --


Nov 02 2013 | 3:52 pm

The first step might be getting into weighted probability or trying out different random number distributions. Check out the Litter externals for generating different kinds of random values. Also, try playing around with applying probabilities to various parameters in music. It’s a pretty short leap to go from probabilities to Markov chains, so that might be something to check out as well. Here’s a little tutorial on it from the algorithmic composer blog. I also made a little patch that implements a weighted random probability table using the prob object.

— Pasted Max Patch, click to expand. —
Nov 02 2013 | 4:34 pm

Check out Chris Dobrian’s blog…

He has a knack for simplifying complex subjects.

Nov 02 2013 | 4:38 pm

Cool, thanks guys, thanks for the suggestions, will look into these in my exploration of more algorithms in music ;)

Nov 02 2013 | 4:46 pm

John for some reason I cant paste your patch.

Nov 02 2013 | 4:52 pm

do make sure to go do the regular max tutorials for a take on non-random systems too.

I dunno, I think algo patches focus too much on randomness.

Nov 02 2013 | 4:55 pm

Really? I thought getting into probability and such would get me away from randomness. Definitely want to have good control over the outcomes and to be able to change the rules.

Nov 02 2013 | 5:57 pm

Probability is probably (heh) the closest relative to randomness. If you want something that goes beyond that, try [drunk] which is already MUCH better than random and most probability things, in my opinion.

But what I really love is basically the output of complex systems. Take this patch:

-- Pasted Max Patch, click to expand. --


Now, it’s not random. And you can *totally* hear it’s not random. But the thing is, there’s this underlying musicality and *control* over the way it progresses, in my humble opinion. Can ya tell I love analogue sequencers? Yeah.

oh, and it sounds like this:

Nov 02 2013 | 6:21 pm

Thanks Wetterberg, Nice patch, I have a bit of research to do anyway. I will definietly give drunk a look too, used it before for a few other things. Nice to make these beats flow more with more differing rhythms.

Nov 02 2013 | 11:31 pm

I agree with Wetterberg that dealing with probability is going to be really close to randomness. If you’re trying to move away from that, maybe try some generative systems such as fractals or generative grammars.

Nov 03 2013 | 12:25 am

The OP asked about algorithms.. which don’t necessarily entail randomness. Either way, I’m not sure I see the contradiction. Randomness is just even odds. The less even they are, the less random it is. Too much or too little is unnatural. So is randomness really the problem? Or like most things, it is the lack of creative (un)balance? And how do you get better at that?

I know I’m not saying anything new, but the guy is just starting out. Seems like it would be most relevant to offer a range of examples, from popcorn percussion to list processing. And given the nature of how to build stuff in Max, what isn’t an algorithm?

Nov 03 2013 | 2:06 am

The less even they are, the less random it is. Too much or too little is unnatural.

too little randomness is unnatural? – or am I misinterpreting the sentence?

I would posit that if you sit by a piano and reach out to play a key, *any* random occurence of a note other than the one you intended to play would be perceived as "unnatural"…

The OP asked about algorithms.. which don’t necessarily entail randomness.

Exactly. My own interpretation of this lead me to post a complex system made with simple elements and repetition (there’s only a little handful of objects, copied out a buncha times, ending in makenote+noteout)

I personally feel that knowing how to wrangle simple elements in this way can be done almost at tutorial no. 1, and they can be *analysed*, so that the beginner – or even intermediate – can sit down and look at the wiring and fully grok the patch. I feel that grokking is needed to learn and move forward, and stochastic processes are more of a "black box" than anything.

But I also concede that many do use max to do large random or pseudorandom processes, and that’s perfectly fine too – horses for courses!

Nov 03 2013 | 3:04 am

too little randomness is unnatural? – or am I misinterpreting the sentence?

No, I meant both.. Of course, the dialectical nature of randomness/predictability makes it impossible to exclude one from the other.. but generally – experientially – too little randomness is sterile, predictable, dead. There are no straight lines in nature… only the chaotic interplay of perceived organization and apparent randomness. The confluence of the two is the sweet spot of creative intelligence.

I would posit that if you sit by a piano and reach out to play a key, *any* random occurence of a note other than the one you intended to play would be perceived as "unnatural"…

Well.. if we consider the measure of information as a measure of what we don’t expect.. and intelligence as our capacity to process the unexpected, then I suppose it depends on who is playing the piano. :) That single note could serve to engender a creative response. Or not. It’s when there is one bad note after another that our natural intelligence is truly tested. :D

Nov 03 2013 | 3:26 am

It’s when there is one bad note after another that our natural intelligence is truly tested. :D

lol :)

I think I’ve made that patch, though. Is that a good thing? :)

Nov 03 2013 | 4:21 am

I think I’ve made that patch, though. Is that a good thing? :)

Story of my life.. hehe

Nov 03 2013 | 5:01 am

Thanks guys. I see generative systems Mentioned above. This is interesting to me. Are there any good articles on generative systems in MAX MSP?

Also any other examples are greatly welcome ;)

Nov 03 2013 | 8:44 am

i can only warn about using too much random.

just as repetition, randomness is something the human brain will detect very easily.

maybe you want to look into this old post:


Nov 03 2013 | 9:48 am

Very astute point, Roman – but the difference between repetition and randomness is that repetition is, in large part, musical in itself.

We hear rhythms in clocks and broken bicyclewheel spokes and squeaky shoes… which may have been broken in a pseudo-random occurrence, but it’s the periodicity we latch on to.

Nov 03 2013 | 9:50 am

Actually, the Turing Machine device discussed in the BEAP thread right now is a good example of using randomness and capturing it, making it repeat. I think it nicely spans the gamut from chaos to music, in some sense.

Nov 03 2013 | 10:34 am

repetition is musical? well yes, but not much more than linear randomness.

musically they are almost the same thing, IMO.

repetition == cosine
randomness == white noise

both will be pissing you on sooner or later.

lets create three slightly higher level examples.

a piece of music which consists of 1 note, C3, played on the piano, repeating every 500 milliseconds, lasting for 10 minutes.

a piece of music which consists of differently tuned notes, based on linear or normal distributed randomness in a range between C3 and C7, repeating every 500 milliseconds, lasting 10 minutes.

a piece of music which consists of randomly tuned notes in a range between C3 and C7, randomly switching between piano, marimba, and bells, appearing randomly in a range of 250-750 milliseconds, whose length is randomly somewhere between 8 and 12 minutes.

if you listen to these three songs you will find that they are basically telling you the same story and transporting the same emotions.
the only difference between them is that listening to 1.) will get boring after 2 minutes, to 2.) will get boring at 3 minutes, and song 3.) will be boring after 4 minutes.


Nov 03 2013 | 10:42 am

oh and about your footsteps and bicycle example. :)

well, that is exactly the point.

because they are neither random nor repetitions. they are chaotic. they are organic.

the sounds your shoes make when you walk are similar to each other, but they are not exact copies.

this is how the chaos, the order of the nature, is built upon, and this is why music should at least contain such patterns in addition to random and copy, in order to be nice to your ears.


Nov 03 2013 | 11:41 am

Nice how you avoided the clock example ;)

Nov 03 2013 | 12:57 pm

damn, he noticed it.

well that is because they modeled the clock rhythm after musical beats.

if music would not have existed, they probably would have ended up with a nonlinear, unpredictable beat when inventing the clock.

look back and see what is been first. linearity, which has been found when playing with maths, is not as old as man clapping with his hands.

the clock is artificial and therefore imperfect. as you know, it has to be corrected every once in a while, because it does not really fit to the universe´s timeline.

Nov 03 2013 | 2:07 pm

I want some of what you’re smoking, Roman! I don’t disagree, neccesarily… on a philosophical level.

Anyway; generative. Generative is where it’s at. Not linear, not random, but inbetween.

Nov 03 2013 | 3:12 pm

thanks for sharing your patch WETTERBERG. I’m starting to explore algorithmic approaches to music a bit atm and your patch sparked some ideas for me.

Nov 03 2013 | 3:14 pm

funny how someone mentioned "generative grammar" in a musical context above. before i knew this term from chomsky only.

Nov 03 2013 | 3:28 pm

I know I’m not saying anything new, but the guy is just starting out

an it is not so uncommon that at the beginning you dont know eher to start off.

you know that you can produce musical events by setting and replaying them. and you know how to create events in realtime using out-of-the-box modifiers such as random, counter, and simple arithmetics. but this does not yet make a toolset to create music.

so what is the next step?

i believe that one should very early learn that possible rulesets for music (or for math in general) are often, at least partially, are selfcontained and selfgenerating/modifying (there are probably better words for it?).

or in other words: use what they call "analysis". say you have a given melody and want to modify it. you could make decisions upon the note numbers. if input is C3, then transpose it to C4. if input is a chord, insert a rest. randomize pitch, but only for every 5th note. learn how to make useful abstractions and subpatches. modularize everything. and when you do it, dont let maxmsp influence your thinking structure, instead try to build what is in your head.


Nov 03 2013 | 5:07 pm

Roman, I very much agree. Those are the kinds of rules and structures that come to mind when I think of ‘algorithmic composition’.

I also think it’s important to mention even more transparent and ubiquitous applications of randomness… such as slight deviations of a pitch over time to create a more analog tone or similar uses of distributed ‘imperfection’ over some range of values…. such that randomness is not distinguished explicitly but perceived implicitly.

Nov 03 2013 | 5:32 pm

Now that’s an application I can totally endorse, for what it’s worth.

Nov 03 2013 | 8:03 pm

Roman, I had originally heard it from Chomsky as well. Most of the papers that I’ve read regarding using generative grammars in composition tend to use them in the original way that Chomsky formulated them, just substituting things like pitch and rhythm for linguistic constructs. Pretty fascinating stuff IMO.

Nov 04 2013 | 5:32 pm

it is quite difficult to think of a musical composition as something on a pure symbolic layer such as "grammar", mainly because programming max patches will force you to create interfaces and modules which are not congruent with those symbols.

maybe it would be an interesting project to create a toolset in max, which is such a completely custom grammar thing, ignoring any other paradigms of programming languages, max, math, or traditional musical notation including time (so that it probably not make a realtime app)


Nov 04 2013 | 7:26 pm

There’s the classic Lerdahl and Jackendoff book A Generative Theory of Tonal Music that’s a good starting point for the idea of grammar in music. (course that’s analyzing, not running it forward…)

There are some corpus based composition examples in OpenMusic, IIRC, and they might also be in PWGL, if you’re looking for programming tools.

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

Forums > MaxMSP