## Algorithmic Suggestions

Nov 2, 2013 at 2:15pm

# Algorithmic Suggestions

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 :)

<code>

– Pasted Max Patch, click to expand. –

</code>

#269951
Nov 2, 2013 at 3:52pm

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. –
#269962
Nov 2, 2013 at 4:34pm

Check out Chris Dobrian’s blog… http://algocomp.blogspot.com

He has a knack for simplifying complex subjects.

#269966
Nov 2, 2013 at 4:38pm

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

#269967
Nov 2, 2013 at 4:46pm

John for some reason I cant paste your patch.

#269969
Nov 2, 2013 at 4:52pm

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.

#269970
Nov 2, 2013 at 4:55pm

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.

#269971
Nov 2, 2013 at 5:57pm

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:
<code>

– Pasted Max Patch, click to expand. –

</code>

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:

[audio src="https://dl.dropboxusercontent.com/u/12606333/wetterberg_-_big_fuzzy.mp3" /]

#269975
Nov 2, 2013 at 6:21pm

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.

#269976
Nov 2, 2013 at 11:31pm

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.

#269983
Nov 3, 2013 at 12:25am

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?

#269984
Nov 3, 2013 at 1:15am
#269985
Nov 3, 2013 at 2:06am

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”…

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!

#269987
Nov 3, 2013 at 3:04am

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

#269989
Nov 3, 2013 at 3:26am

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? :)

#269990
Nov 3, 2013 at 4:21am

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

Story of my life.. hehe

#269992
Nov 3, 2013 at 5:01am

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 ;)

#269994
Nov 3, 2013 at 8:44am

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: http://cycling74.com/forums/topic/techniques-for-generative-music/

-110

#270010
Nov 3, 2013 at 9:48am

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.

#270015
Nov 3, 2013 at 9:50am

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.

#270016
Nov 3, 2013 at 10:34am

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.

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

2.)
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.

3.)
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.

-110

#270020
Nov 3, 2013 at 10:42am

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.

-110

#270024
Nov 3, 2013 at 11:41am

Nice how you avoided the clock example ;)

#270029
Nov 3, 2013 at 12:57pm

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.

#270037
Nov 3, 2013 at 2:07pm

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.

#270042
Nov 3, 2013 at 3:12pm

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.

#270045
Nov 3, 2013 at 3:14pm

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

#270046
Nov 3, 2013 at 3:28pm

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.

-110

#270048
Nov 3, 2013 at 5:07pm

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.

#270055
Nov 3, 2013 at 5:32pm

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

#270056
Nov 3, 2013 at 8:03pm

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.

#270064
Nov 4, 2013 at 5:32pm

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)

-110

#270160
Nov 4, 2013 at 7:26pm

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.

#270164

You must be logged in to reply to this topic.