I need help creating a Fibonacci generator..

f's icon

I'm hoping someone can give me a code for a Fibonacci generator that selects a series of predefined MIDI notes, so I can see how it's done.

I want to: "Apply a Fibonacci generator to select a series of predefined MIDI notes." and that's it.

I was told that in order to generate I have to involve delays and gates??

Here is an image that was created for me to explain generating, but it does not work yet, it gets confused when
the button is clicked, and in order for it to work I need to use a delay/s and a gate/s, but I'm not sure how:
http://s17.postimg.org/erh9tpqq6/DSC_0008.jpg

I'm hoping someone has a code already that would have just what I need, it would help me out a lot

bkshepard's icon

Take a look at the bucket object.

f's icon

Does it look like you're doing my homework?

f's icon

What is the bucket object? and where/how do I find it?

Thanks

metamax's icon

You can generate the sequence with [expr] using the closed form equation found here:
https://en.wikipedia.org/wiki/Fibonacci_number#Closed-form_expression

As far as turning the sequence into MIDI notes.. you need to decide what the sequence represents. Practically speaking, you need to convert large Fibonacci numbers into to smaller MIDI numbers. I'm sure there are a lot of ways to do that, but the easiest is probably to use the modulo operator [%]. ex. [% 12] will divide any input by 12 and output a remainder between 0-11 (which can be used to index your notes). Same can be done with [% 128] for all MIDI notes, [% 7] for notes in a scale, etc. These numbers can then be used to trigger output of a [coll] object that has a pre-defined set of notes that correspond to each index number.

Until you sort that out, here is one way to port a math expression into Max using the [expr] object - along with an example of using [%] to get your output in the proper numerical range. Hope this helps. Good luck with your project!

Max Patch
Copy patch and select New From Clipboard in Max.

f's icon

Thanks a lot Metamax, much appreciated.

Any other help appreciated

MakePatchesNotWar's icon

"I want to: "Apply a Fibonacci generator to select a series of predefined MIDI notes." "

"Does it look like you’re doing my homework?"

Lol yes... :)

f's icon

I've yet to see anyone but Metamax do my "homework".
Stop acting like you're doing my homework the rest of you and just do it already :)

metamax's icon

See now you're trying to make me look bad.. but did you think it was a coincidence that I posted a solution that uses the closed form expression? How's that stack overflow treating you, btw? ;)

Roman Thilenius's icon

best screenshot ever

f's icon

Metamax, your input turned out to be of no help whatsoever.

We start again:

"I want to: "Apply a Fibonacci generator to select a series of predefined MIDI notes." and that’s it."

Someone on this forum will do the above for me.

If you're not here to help then do not post. If this was reality you would give me what I demanded or you would be tied up and your head would be beaten with wet tea towels.

Only post if you have some help to offer.

Help a beginner out eh :)

MakePatchesNotWar's icon

What if i told you we're all here to help but not in the way you'd like to see? Your posts title is "i need help creating" but in your first sentence you ask us to give you code? This is max where you build your own stuff so at least show us what you got so we can get a better idea of where you mess up

f's icon

JK

I'll be back with some more info

Cheers

Roman Thilenius's icon

"I mean its not like its unknown territory:"

& it is not like meta would not have given him exactly what he was asking for.

that is the point where his professor is supposed to chime in and explain how the homework´s question was meant in detail.

metamax's icon

Well I gave him what I thought he was asking for.. followed by an attempt at humor (mostly).

Most of the Fibonacci patches I have seen seem overly complicated. I like [expr] because it's compact but the sequence can also be generated using just b, i and + ...no fancy buckets, gates or delays necessary.

Max Patch
Copy patch and select New From Clipboard in Max.

[disclaimer: If you are student and you actually want to learn Max but haven't made an effort to figure this out on your own, you're too big of a dummy for me to help anyways, so enjoy.]

Roman Thilenius's icon

we could still hijack the thread and discuss something useful?

metamax's icon

What? Like music? Ha!

f's icon

You folks have no idea how retarded my lecturer is, nothing is explained at all , and I am totally new to this stuff.

Christopher Dobrian's icon
mzed's icon

I feel like I've said this before, but there's a patch in the CNMAT MMJ depot that does Lucas Sequences, of which the Fibonacci sequence is one type.

The website even works today: http://cnmat.berkeley.edu/downloads Look for Lucas-squence-maker.maxhelp Unfortunately for you, the implementation is in a style that would likely make your lecturer suspect you had gotten it elsewhere.

Roman Thilenius's icon

dont get me wrong, i know that there are many retarded teachers out there (which is why i have exluded any "education" from my vita since i was 12) but if you dont know how to make a screenshot on windows or how to find the bucket object, you are probably in the wrong course.

but dont worry... maybe you are good at sports?

f's icon

Update:

I can take a screenshot
I now remember what the bucket object is

The first 'screenshot' (Lol) was done that way because I was using a mac at my lecture. I hate macs.

Now I have MAX MSP installed on my Windows computer at home so I am more familiar with everything now, and it's easier for me.

f's icon

This is where I'm up to:

It has not yet been generated, but it's a little progress

LSka's icon
Roman Thilenius's icon

nothing against pictures instead of patches. those who can help, can read it just fine this way.

well, in this case...

f's icon

Thanks @ LSKA

Max Patch
Copy patch and select New From Clipboard in Max.

So this is where I'm up to, take a look: