[sharing] What is your favourite bit of code that you "stole" and made your own?

Wetterberg's icon

I'm sitting here, being all nostalgic and looking at Katsuhiro Chiba's old max patches. The kind of stuff that really got my inspiration flowing as a maxer starting out.

And I'm starting to think about the culture of appropriating other people's code, how great that is. Especially now, with snippets, where every little scrap can become the start of something really cool, without having to think about "abstractions" and such. Just snip, it's yours.

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

Anyway, for me it's this bit. It's gotta be the defining "me" snippet these days.
The always fantastic Peter McCulloch made a bit of code. 3 years ago. I changed it, and now it's mine. It's part of nearly everything I do, in one way or another, so yeah.

Hope you'll share yours, too!

Wetterberg's icon

oh, about the code; it's (now, I think it was something very different then) a variable delay buffer. It can do long loops, shorter delays, really short stutters, and karplus strong, too. In a neat little package, everything you need to mess your sound up.

apcuddling's icon

I remember I was trying to find a way to have a single picked guitar note trigger a gate that, in turn, would trigger pre-recorded samples and midi signals in the same key. The idea was to play notes on the guitar in a set key, but the response would always be a random note also in that key. So no matter what you played, as long as it stays in the one key, you would always get a random harmonization.

I looked up various "random note generator" patches, "analog audio gate" patches. Unfortunately I can't say exactly which ones because I, more or less, picked them to pieces to have it work in my vision and then kept going.

Ultimately it was one of the more rewarding feelings I have ever felt, even though I practically piggy-backed off off someone else's work. The fact that to was able to achieve my end goal.

But I think that is the best part about the MAX community. People share because they care about others developing ideas.

I know that this post isn't exactly the addition you might have been looking for, but when I read the headline, it took me back. So thank you for that.

hz37's icon
Max Patch
Copy patch and select New From Clipboard in Max.

One of my favourites pieces of code is this one below, from these forums, which simulates radio static with some presets as well. It is a snippet now, of course, and I've made variations of it. I sadly can't remember the original author.

zipb's icon

RTC-lib from Karlheinz Essl has tons of interesting stuff that I've been repurposing for years. Thanks, Karlheinz!

Roman Thilenius's icon

sharing seems to be dead.

nothing compares to the stuff you could find 10-15 years ago.

i have collected some 50,000 max 4 files. if you today find someone sharing his patch, it is usualy only an accident that he made it available.

-110

Max Gardener's icon

I'd be curious to hear any theories you might have for why such a dropoff in sharing exists, Roman.

A change in Max from 4 to 7 that makes sharing less prevalent [I suppose that greater discoverability might factor into that....]?
A change in who's actually on the Forum these days?
A change in what it is that people actually *ask for* [and I mean this apart from the usual end-of-term "Hi. Can you send me a patch that I can use for my Uni project? Thanks!" kind of thing. That will always be with us, I expect]?
A change that makes sharing here harder/easier?

I share your perception, and I'm wondering why that might be true....

Wetterberg's icon

Sharing isn't dead, it just smells funny.

In this case, the maxforlive.com website begs to differ with your opinion, Roman, but then again it's all newfangled kids-things over there. It's a silly place.

Wetterberg's icon

@raj oh shit yeah, that's a great story about how you appropriated something for yourself. And ironically, in sharing that you're not sharing, you've tempted me to NOT seek out your solution :) I appreciate that it's yours, and yours alone.

I still remember opening up MLR hoping to steal the awesomeness, and immediately feeling the sting of "effectively closed-source". Man, that patch stunk. That's another side of it, some things just didn't lend themselves to stealage.

Wetterberg's icon

sorry yeah insensitive wording. "Absorbed the core concepts of"? Is that more precise? You get the idea.

Roman Thilenius's icon

i wasnt thinking about the forum at first, or well, maybe it is a small part of the whole.

when you look at the collections of abstractions and externals people make available ... this number is currently shrinking.

normally you´d think that all the new technology we have (copying code over was much more difficult back in the days, more externals should produce more abstractions) and a much bigger user base would incease those releases.

i am not sure if the philosophy of the average user has changed.

but if you give people two technologies, they chose the one which is worse at sharing. back in the days there were p2p filesharing servers, record labels, netlabels, discothekes and clubs, artist communites and company forums on this planet, and there used to be a group identification and spirit in many of these real and virtual places. people were showing off their custom work there. today people have a personal facebook site and they mostly talk about something another person made there.

another thing is how bad externals are maintained by their authors today - and the corresponding reaction of the crowd, which is quite consumer like. everyone is demanding, but noone wants to help.

-110

vichug's icon

hey
i think there is an overflow of things
like, soo many things archived in these forums, that for the younger generations it's quite intimidating
and there is more and more useful things built-in in standard Max
like when i see what people share for PureData (and i speak about that because that's the closest thing i could think of to what could be a community sharing a lot of stuff for max 4), it's often abstractions for functions that are done with one standard max object
but ofc i can't speak that much for how things were on the forums back in max 4 - i was not really using the forums at that time, or so intimidated when i did so, i don't remember much.

if you give people two technologies, they chose the one which is worse at sharing

No. They will, however, choose the one which is easiest to use, which is more ready made, which is more shiny. Which indeed tends to be the one that their creators intend to sell rather than give away for free, because they spent a lot of time and efforts for the accessibility side, which is louable in its own because it's often the most difficult - making complicated things usable by other people than you - but in turn they tend to drift away from the "share everything" paradigm. So the "worse at sharing" comes as a consequence of this rather than a cause

vichug's icon

back on topic : i've been using a lot of Raja's stuff ;) i especially loved the binamp sustainer. and this jit.gen bit of code https://cycling74.com/forums/help-with-jit-gl-multiple-and-camera-positionrotation/ but it has a very situational use i guess :)

Wetterberg's icon

where's that binamp sustainer, Vichug? :) I don't remember it - is that the one Raja was talking about earlier? I have something like it myself, but it's way primitive, just a freeze with a crossfade.

I just got done ripping the voice module out of "autumn" by Katsuhiro Chiba. It's just an fm voice, but it has something special going on, I don't know what it is... I just love it.

Roman Thilenius's icon

"No. They will, however, choose the one which is easiest to use, which is more ready made, which is more shiny"

but isnt that a bit strange for a programming enviroment? that people start buying max because it contains already everything you need? can it be that the young generation does not understand the difference between creating and consuming?

Wetterberg's icon

ah, now I know the one we're talking about! yeah man, dope work as always. Hell, miles above my shitty patch (NORMAL threshold of a freeze? gtfo, noob me!)

So do any of you have any, what could we call it, "ones that got away"? Like stuff you simply couldn't grok enough to pick apart?

I certainly have some andrew benson shit that I still don't understand several years later.

Roman Thilenius's icon

one thing my nontraditional minde never grok ... i am very bad at understanding FFT.

and ... traditional minds.

-110

Wetterberg's icon

ffuuuuck FFT with a long pointy stick. Eww. First of all it's some pretty insane math just on the whole, but man... max fft is nuts to me. I can bash it and get "interesting results" from modding other people's stuff... uuunless it's a fancy pants gen thing to boot. grrr.

brendan mccloskey's icon

I am forever indebted to a small number of contributors here, for showing me the hidden wonder and simple logic of things like [&], [sprintf], [regexp] and the [zl] fambly. I can be all, like,"sure, we can do that", thanks to y'all.

brendan mccloskey's icon

in fact, it happened very recently, at a workshop I was running; a programmer was all, like "my list is backwards", and I was, like "[zl rot] dude", and he was all, like "awesome chops bro"

or something

Wetterberg's icon

I'm imagining a surfer dude saying that. It's pretty rad, man.

brendan mccloskey's icon

Haha.

Nobody wants to see a 52 yr old hacker in a wetsuit. Dude.

Jan M's icon

Two more cents from me about the sharing/what has changed issue.
I am probably one the the mid-aged forum members/Maxers here (speaking about forum/maxing age of course - I don't care how many years you have spent on earth, and where you have been before ;)) ). The most significant change I have observed happening probably during the last 2 years or so: Less and less new folks here... That left a gap, between experienced Maxers and Newbees and facilitates the "Oh i'll just ask one of the dinosaurs" situation.
I would trace that back to two, very practical issues:
- Since the advanced search function is gone, the possible use of the forum has changed radically: Back in the days is was a huge archive, where one could find interesting input on almost everything. Right now it almost impossible to make use of what has been written 3,4,5 or more years ago. This lead to shorter, more problem focussed discussions. The result is a: "I have a question, can't really find answers in a broader context, so I just post a it" attitude.

- Hence the forum lost any advantage towards other places, mainly the Facebook user group. All the young folks (again speaking about maxing/age) are there. For a good reason: You'll get your answer much faster. This is a true loss for this place, as the FB postings cannot reach the quality and depth of the (old time) discussion here. It is probably to late, but in order to make this forum again the central place, it needs to gain back it's archive qualities.

Happy posting ;)

Wil's icon

enjoyable.

I like when I get in my car to go to the local supermarket, the car turns into hover ship and I end up in a parallel universe.

didn't this thread start with a question in which the answer required offering a bit of code? Instead, turned into a discussion about the degradation of insightful code offerings... hmmm...

i-ron-ee

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

i like this simple bit of Gen auto panning. use it a lot... borrowed/stole it from somewhere then added my own controller for changing left/right speed on the fly.

Wil's icon

@RAJA_THE_UNNECESSARY_OPINION... thank you!

the one who travels the path that is straight and narrow may stray from in the extreme (cause they always have a path to return to)

What is your favourite bit of code that you "stole" and made your own?
Well, maybe 'required' was an extremely 'fanatical' interpretation, (although I am living only a few hundred km from where Kin Jung Un executes people using anti-aircraft weapons, so fanatical might be open to interpretation) but the question clearly asks for 'favorite bit of code' of which the entire thread produced only 1 (not including the OP and myself). There is a difference between observation, fact and opinion.

Wil's icon

what i meant is that the thread turned into a discussion about how the sharing of code seems to be dropping of as of late when the OP just asked for a 'bit of code'. the irony being that substance, i.e. usable code turned into opinion/observation.

I agree that discussions are great. But on the lighthearted super selfish side of things I want to be able to click on a post that has 'sharing' 'code' and 'stole' in the title and actually be able to steal something!!!

Wil's icon

I just sent off a piece i have been working on since Feb. So it is day off and bored. Sorry to interrupt your deep meditation and patching.

Roman Thilenius's icon

"I agree that discussions are great. But on the lighthearted super selfish side of things I want to be able to click on a post that has ‘sharing’ ‘code’ and ‘stole’ in the title and actually be able to steal something!!!"

funny, my first idea was to think about what i could contribute.

but until today, nobody of us actually did that.

Jan M's icon

Two of my favorites are already here:

The FFT/Time-stretch patches by Jean-Francois Charles - https://cycling74.com/share.html

And the JS-Modularization techniques, which finally made the jsextensions for me usable - My write-up of them in the Wiki:
https://cycling74.com/wiki/index.php?title=jsextension_-_Tips_for_design_patterns
https://cycling74.com/wiki/index.php?title=jsextension_-_Tips_for_design_patterns_part_2

Jan M's icon

Another one: some years ago JOSHUA KIT CLAYTON suggested this bit of js-code for debugging:

var foo = new Object();
foo.one = "test";
foo.two = 74;
foo.three = [9,10,11];

foo.bar = new Object();
foo.bar.bozo = "i'm not a clown";

myobjectprinter(foo,"foo");

function myobjectprinter (obj, name)
{
    if (( typeof obj == "number") || (typeof obj == "string") ) {
        post( name +  " :" + obj + "n");
    } else {
        for(var k in obj){
           if (obj[k] && typeof obj[k] == "object")
            {
                    myobjectprinter(obj[k], name + "[" + k + "]");
            } else {
                    post(name + "[" + k + "] : " + obj[k] +"n")
            }
        }
    }
}
Wetterberg's icon

@wil it seems to be missing the main Gen element, "panner"?

@raja that's insane! I love how you approached building that eye (fantastic video of the live coding, too, I agree!)

@jan I wish I could read js as well as I used to. I've forgotten way too much of it.

@roman how much would it take for you to .zip up that lib of old patches? Perhaps we collectively could go mining for gold?

...and now, back to karma~ hacking!

Wil's icon
Max Patch
Copy patch and select New From Clipboard in Max.

@wetterberg here is the panning.gendsp

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

and inside of that fader.gendsp

this is really simple but really fun with a bunch of players panning at different speeds. If I ever get the 'means' I think it would be great to move sounds through lots (and lots) of speakers at different rates and different placements.

and yes the 50,000 would be a perfect sensory overload for starting a new piece.

hacking Karma~ ! what a great life musicians lead!

Jean-Francois Charles's icon

Here is a bit of code that I have seen used again and again and again for granular synthesis:
Nobuyasu Sakonda's MSP Granular Synthesis patch v2.5 (2000) at formantbros.jp/sako/download.html.
It's interesting to compare this approach to the Max examples' granularized approach.

The forum changed, for instance when you consider advanced topics. Back in the Max 4 days, when you found a bug, there usually ensued a lively discussion about it. It was a great way to learn deeper knowledge about Max, digital audio & video, and how things work under the hood. Today, it looks like bug reports should be e-mailed to c74, a quite different approach. I still don't understand why there is just one category "bugs/issues" on the forum: a proper bug report is very different from an "issue" one could have when programming.

Wetterberg's icon

hey Wil, that patch's a lot of fun! simple and fun.

Make sure you check out SPAT if you haven't already. And vbap, too. I find that vbap is more oriented towards "art" usage, "swirling" and such.

Wil's icon

thanks Wetterberg. I been looking at surround for some time. by 'means' I meant that currently I am confined to headphones. But I like your interpretation of my persona - 'art' 'swirling' :) wouldn't it be great if we could hear a Pollock?

Wetterberg's icon

@raja I am seriously impressed and/or worried about you. That is a sick patch, perhaps even more impressive that it's an emulation of another persons work in another language. Love it.

...I cant use it for shit, but I love it.

>wouldn’t it be great if we could hear a Pollock?
I imagine a fair few synaesthetes use max, actually - I think Matthew Davidson is one?

Leigh Marble's icon

And the JS-Modularization techniques, which finally made the jsextensions for me usable - My write-up of them in the Wiki: https://cycling74.com/wiki/index.php?title=jsextension_-_Tips_for_design_patterns https://cycling74.com/wiki/index.php?title=jsextension_-_Tips_for_design_patterns_part_2

And sadly, the Cycling 74 Wiki section has disappeared, destroying another opportunity to share knowledge (seriously, even if they want to mothball the Wiki, it should still be available as an archive somewhere).

Roman Thilenius's icon

one reason why the wiki was erased was that not more than 10 or 15 people used it.

but i just noticed that my contribution to this topic was until now only off topic.

so i´d like to answer wetterzwergs´ original question now!

...i think my favorite stolen piece of code is the gaussian function from peters free litter abstractions.

when i started using this i would not at all be able to make this myself, and i believe that a random distribution of gaussian or bell curve is essential for many, many tasks. i remember beeing very grateful to finally find this, ready to copypaste.

the first thing i did is redesigning it - to make up a good reason to rename it to 110.gaussian. :)

today more than a dozen or so of my own abstrations contain this piece of expr code, or modifications of and extensions to it, including abbreviated, scaled, vectral, MSP and ruby versions.