Articles, Blog

Gen: Inside Max’s Secret Weapon with Cycling ’74 | Loop

I’m Tom Hall. I’m an artist and Cycling 74 employee.
I’m based out of Los Angeles, California. Cycling 74 is a company who makes and develops
a visual programming language called Max. This has been happening for quite a while.
Nearly 20 years actually, 20 years next year. And what started as just Max now includes
a number of programming elements. It includes MaxMSP, Jitter,
and what you’re here for today, Gen, Gen, you may have heard of before, since its first release
almost 6 years ago now, as part of Max 6. In recent years, many programmers have started
to harness its power to push their ideas and programming into areas
not possible before Gen. It’s becoming quite prevalent amongst the Max
and Max for Live communities. Let me introduce you to, what we call,
The Secret World of Gen. It’s not a dark art though, as some people have said to me
before this presentation. It’s an additional patching environment that is build in to
Max. You might already be using Gen in your music practice
without even realizing. It’s included in a number of plugins, devices,
and the code producing Gen you’ll even find inside of music applications. It works similar to Max in the way that you patch objects
together. However there are some important differences. It has a reduced, but highly optimized object set. So you don’t get a thousand plus objects like you do in Max.
But the ones that you do find are really optimized to work well. It addresses audio signal on a per-sample basis,
this is a big one, rather than in vector buffers, which we do in Max. And it compiles code as you work. And you can either run
or explore that code, or even not look at it. An area where you’ll find Gen is inside of a number
of Max for Live devices. One popular Max for Live device that includes Gen
is Convolution Reverb. It’s a fantastic-sounding reverb that harnesses the power
of Gen to create realistic environment-based ambiance. Let’s take a look and a listen to this. Now while this device is pretty complex behind this UI,
what I really like about it is it’s relatively easy to use. And I’m not sure if you know but there is a whole slew of
impulse responses out there on the internet, one website I quite like is called EchoThief. And there’s thousands of impulse responses on there,
and what’s really great about them is they’re all geo-tagged. So, there’s one that I really like called JFK Underpass. And you’ll hear the difference. So it’s like, you saw there, I just simply dragged it in,
completely different sound. There’s a ton of Gen in the back end of this
that’s making all of this work, and it’s really well optimized. Another live pack that heavily utilizes Gen is the popular
Surreal Machines pack. They use the unique functions inside of Gen to emulate
a variety of hardware. Recently they used Gen for a popular VST and AU
plugin series for prototyping code development and they even used Gen
in the final product. Let’s take a look at this Magnetic device, I really like this
one, it’s an emulation of the classic… you might be able to tell from this mode selector dial,
the classic Roland RE-201 Space Echo. This one. I love that device. It’s getting a little hard to find a
cheap Roland 201 these days, so that’s a great alternative. Another area you might not be aware of where you’ll find
Gen code is actually inside of a number of IOS applications now. One IOS developer who uses Gen
is K-Devices. You may have heard of them. They make a variety of modulation-based Max for Live
devices – their Max devices are awesome. But they use Gen to create the audio engine
for their IOS App: Shaper. Shaper is a complex wave shaping tool that adds
glitching, wave folding and distortion to your audio signal. It’s relatively simple and sounds fantastic,
so let’s take a look and a listen to Shaper. Another IOS app that uses Gen is the Moebius Lab app
by the fine folks over at Amazing Noises. You may have heard of them, they make a range of
Max for Live devices, they also make a series of Max learning tutorials and books as well. Moebius Lab
is a multi-morphing sound processor that’s both a synth and a sampler in one.
It has a ton of effects build in and over 200 LFOs that you can apply to almost every parameter in the application,
it’s pretty phenomenal for an IOS app. So let’s take a quick look at that. Now I know those demos are a little on the noisy side,
’cause I love noise. I definitely sit on the experimental side of the music
spectrum. But those two apps can do much more angelic stuff, they’re very versatile. Another area that you can find Gen in addition to software
is hardware, this is a new one to a lot of people. Recently Gen has become a tool for creating code
for a variety of hardware devices. And one of the first pieces of hardware to support Gen
were the Owl Eurorack and guitar pedal devices… by Rebel Technology, you can see here in the middle
the big one with the 8 knobs is the Eurorack model. The way that this works, the way that you produce code
for the Eurorack or the Owl guitar pedal is you develop a patcher inside of Gen, there’s an Export
function for that code, and you upload it to Rebel Technology’s cloud.
There, a small bit of cross-convolution happens, and then it’s downloaded back down to your attached
Owl device. And this actually all happens in just a matter of minutes,
a minute and a half. And then what’s amazing is the code is immediately running on the hardware.
What I really love about this and what changed it for me was you can detach the hardware, straight away, just unplug
Max hard and just shut your computer down and take the hardware off to a gig, reboot it
and the Gen code will be there on the device, just ready to run, you only have to do that process once. Recently, Gen code export and cloud compilations
being extended to the versatile MOD devices, MOD Duo. They’re based here in Germany in Berlin.
I’m not gonna go into that because we actually have them along today as guests,
and they’ll be coming up a little later to show you how it works. So, let’s take a look at some Gen patch examples. So as mentioned, in Gen, you work on the audio signal
on a per-sample basis. This is different to the familiar Max environment
where we will work on blocks of samples at a time. One of the great things about Gen is the additional
functionality it provides you within Max. And you can still patch within the real-time audio domain.
So, just like in Max, you’re patching in Gen. It’s the same thing. The way that this works is: Max is the host for Gen,
which is an object, and inside of the Gen object is the patching environment for Gen.
Max provides the content: Audio signal, parameter control, into Gen, and then from Gen,
Max, the host, still controls Amplitude, Volume, and then routing elsewhere of the signal and/or data. So this brings me to one of my favorite parts of this, is… as I mentioned, Gen works on the audio signal
on a per-sample basis. And you might be thinking, why’s that different?
Well, it allows us to do single-sample feedback loops. And what this allows us to do is emulate a variety
of hardware. So we can create new oscillator and filter designs in Gen.
And this is something that was really difficult to do before Gen. The only way that you could
do this before Gen in Max was to make your own Max object, which meant coding,
which meant writing in C or C++ and for some of us that doesn’t work, that’s a little tricky. Let’s take a look at this example. And this is actually
one of the first examples I got to see actually before Gen was released, and now it’s pretty much
immediately sold. It’s an emulation of the classic Moog Ladder Filter. Sounds great. I sold all my Moog Ladder Filters
pretty much after that. I was like, I don’t need them anymore. And what makes that work and allows us to get that great
filter sound is there’s a number of single-sample feedback loops inside of there that allows us
to do that filter design. So, Gen works inside of Max with its own patching
environment. What this means is it also has its own special set of objects, I mentioned before, it’s a reduced
object set that’s highly optimized. Some of these objects will be familiar to Max users
and some won’t be familiar. So let’s just take a look at a couple of those objects
that are not familiar. And that you’ll only find inside of Gen. So here I just have a simple feedback delay. And I have a parameter here running in from the
Max host environment into Gen that’s allowing me to control the feedback. It’s pretty smooth. There’s no glitching. ‘Cause I’m using this
new, unique object that you can only find inside Gen called the History object, and this allows us to do that
single-sample feedback loop without killing the audio. In addition to that we have this other object that you don’t
see in Max called ‘param,’ and this is doing a couple of things here. It’s setting
the parameter for our Feedback Amount. Which is just before the History object.
And it’s also exposing the parameter back to the Max host. As you can see here. There’s a ton of other objects that you will only find
inside of Gen. So, essentially Gen allows you to make your own
custom compiled MSP object without leaving Max. And even better, without writing a line of code.
I’m a fan of that one. However, for you folks who like to write lines of code,
I get it, it’s fun. There is a textual coding environment that is inside of Gen.
And it’s called CodeBox. It’s actually its own Gen object. And… I should mention that it only works inside of that Gen
patching environment. You can see here, it’s relatively simple. Out 1=In 1.
That’s just a basic bit of CodeBox text there. It allows you to write, edit, copy and paste
your own DSP algorithms inside of Gen. The code that you write inside of CodeBox
is similar to C or JavaScript, and it has a relatively simple set of operators
that relate directly to the same visual objects that you can find inside of the Gen patching environment. So, let’s take a closer look at some patching. So the way that you move into Gen, and into Gen’s patching
environment is simply double-clicking the Gen object from the Max host. You need to make sure that it’s locked
and then just double-click Gen. This is the default Gen patching environment, this is
what you’ll see every time you instantiate a new Gen object inside of Max, and then open up the Gen patching
environment, you’ll be greeted with this. If I go ahead and delete this patch cord… the sound stops. And that’s because just like in Max
we’re patching in the real-time audio domain. You might see that this default patcher has a similarity to
sub-patches in Max. We have inlets at the top, that’s providing content into the Gen patching environment
and then we have an Out one down at the bottom which is sending whatever we’ve created in Gen
back to the Max host. Another thing you’ll see inside here, and some of you who
know Max may have noticed there’s a few extra icons. We have this Loop icon down the bottom here that’s yellow. And you’ll see that it says: Disable Auto-Compile.
And that’s because Auto-Compile is on by default. And that’s gonna make the most sense to Max users
because we’re all used to programming in the real-time audio domain. But if you wish,
you can turn it off and make a change. And you’ll notice that this Hammer icon
became highlighted when I deleted that object. So that I can manually compile the patcher as I go. So sometimes in makes sense to develop code,
but not compile at the same time. Developers like to have that as an option. To the left of the Hammer is the Reset icon.
And what it allows you to do is, you must have noticed the parameter that I had
set in the previous patcher. You can set a default value for your parameters. At some time, you may change that number,
but this Reset icon allows you to reset any set parameter back to its default value.
It can be useful when you’re patching away. There’s one other icon over to the side here.
And it says “C” for “Code.” If I press this C for Code, you’ll see that this sidebar opens
up. And you’ll see there’s some syntax there.
Now what happens is when we patch in Gen in objects, this syntax is automatically written
in the sidebar, and you can actually keep the sidebar open and see this code being generated
in real-time as you patch, it’s pretty cool to see. And, if I go back over here and highlight…
I’ll just rejoin those patch cords. If I highlight these objects, the syntax that relates to the
patch will be highlighted as well. This is actually a really great way to start working with
CodeBox because the syntax that you see here in the sidebar
is what we write inside of CodeBox. So you can just start patching together objects in Gen
and get an idea for what the code looks like. It’s great, I love that part of it. So let’s add some amplitude modulation to this signal
that we have running into Gen. And keep an eye on the sidebar to watch the code
being developed in real-time. So I’m gonna put in a Multiply object here. Did you notice that there was some new code added to the
sidebar? And now I wanna modulate this signal,
so I’ll make a Cycle 0.1. Ah. But there was no syntax added and that’s because
until I draw a patch cord from the Cycle to the Multiply object it’s not part of the patch yet, so there’s no reason for the
Gen patch environment to write any code yet. But watch the sidebar. Boom. There we have it,
some new code. And then if I highlight over these 2 objects
you can see the syntax that’s related to them, that I just added,
and you should be able to hear… There’s one other object I wanna mention that I touched on
before, and that’s CodeBox. Let’s bring it in. It can just be used like this. You’ll notice CodeBox looks a little different to what I
showed before. And basically CodeBox here is just joining the In objects
to the Out. So, if I just join an In like this. So, CodeBox allows you, as mentioned, to write your own
DSP algorithms using language that is similar to C with a relatively simple mark-up. However, you don’t need to write your own DSP algorithms,
and this is one of the great things I like about CodeBox. You can go ahead and find thousands of
DSP algorithms already written out there on the internet, and bring them into your patching. And to get them to work
inside a Gen is actually a relatively simple process. It doesn’t take too many changes to get them functioning,
which brings me to stealing other people’s work. Na. Using other people’s work. That was the word. So to avoid internet hassles, and I’m really glad I did this
after seeing the spotty WIFI yesterday. I pre-made this video where I head off to the internet,
grab a piece of DSP code, bring it back to Max and adapt it into CodeBox.
So, please join me in watching this video. Here we have a simple Max patch set up with a sine wave
running through Gen. If we head over to our web browser and navigate to
music we’ll find a range of code for various effects
already written and available. Let’s use this Waveshaper code. It looks kind of like C. Let’s copy it. Navigate back to our patcher. Open up Gen. Let’s use an object called CodeBox. You can pretty much write any sort of C as long as it doesn’t
do anything with pointers or arrays. Now let’s past our Waveshaper C code into CodeBox. OK, it looks like we have some errors here.
And this has caused our sound to stop. We don’t need this ‘In 2’ object, so delete that.
In CodeBox, we also don’t need these variable declarations. An input in Gen is simply ‘In.’
Also remove this variable declaration. And change the output to simply ‘Out.’
Click outside of CodeBox to pile again. Shoot. Looks like we have an error still. OK, this last one.
fabs – fabs in Gen is actually abs. And now we have it. Our newly dirtied up Cycle tone.
With some DSP code we nicked off the internet. There’s plenty more out there that can be used
inside of CodeBox. There you see. I don’t really say “shoot,”
I don’t know where that word came from. Anyone who knows me well knows I have a vast
vocabulary of bad words better than that one. OK, so… that brings me to introducing my guest,
who I mentioned before. The guys from MOD Devices who are gonna run you
through how to develop a piece of code and get it running on their hardware, the MOD Duo. Please join me in welcoming Gianfranco
from MOD Devices. By the way, I have a MOD Duo and I dig it,
so it’s just great to have these guys along today. Hello everyone. It’s a big pleasure to be here.
Thank you so much to the Cycling guys for inviting us. It actually has been just one year that we met Tom
on the Previous Loop, and he went to our office, and it all started,
so it’s really nice to be here again. So I’ll do a very quick intro on what we do
and I’ll call Nino to actually talk about Gen a bit more, I’ll go as fast as I can. So we are MOD Devices and we do an additional platform
for performing musicians. And from a developer’s point of view, what we have
is a hardware plugin host which is in a box, very sturdy, and stage-ready. It has audio inputs and
outputs, it has MIDI support, and we offer this remote interface in which you can patch everything
together, peddles of all kinds, it’s a plugin based system and you have all kinds of plugins, MIDI or audio.
You patch everything together, make these peddle boards, you can make as many as you want and take them
to the stage. From a system overview, what we have is actually
a computer. that has an arm, a general purpose CPU inside, and not a DSP.
It has an operating system, a real operating system. We have a plugin standard that we support.
And we have an online plugin store where developers can publish code, publish plugins
and distribute it to the community. In terms of operating system we use Linux.
It’s what everyone expected. It’s a real-time patch at Linux, it’s really nice
because it has a large, existing codebase. It has audio libraries already built in, we can
build in more packages if necessary. And because we are not using a DSP,
but a general purpose CPU, it’s mostly about cross-compilation, if it runs on your
desktop, it will run inside the Duo. In terms of plugins, we use a standard,
everybody asks if we support VST, but no, we support the LV2. It’s the standard that was created
by the Linux community. And very similar to VST in the sense that it supports
audio, control ports, MIDI and control voltage. It has a clear separation of DSP code,
and interfaces and metadata, a very liberal license, which is very important for us
when I’ll talk about the store. Hundreds of plugins available, we have about 200
in the store, all open source, you guys can all check the code just like Tom showed
for those internet code. And the website: ‘’, all the documentation is there. And our plugin store, it has at the same time
commercial plugins and free open source plugins, they live together. We have an ARM compiling system so you don’t have to
assemble a 2 chain on your own machine. And because the plugins are all C and C++, and as Tom
just mentioned, not everyone likes to do C code. We have these integrations with MaxMSP, PureData
and FAUST. And the Plugin Store, just let me show you here real quick,
you can publish the plugins, the users can, it’s just like the app store from the smartphones, and the
user can just with the simple click install a new plugin. And I’m going to call now Nino here, to go through the
MaxMSP Integration which is what we actually want to show you guys.
Please welcome Nino from SHIRO Plugins. So, I’m Nino. Good to be here. And I will tell you a bit more
about the integration of Gen in a MOD Duo. So, if you have a MOD and would like to make your own
Gen plugins a good place to start would be with the MOD Duo package. It’s a package which you can find
with the Package Manager. And it’s made in collaboration with Cycling 74
and basically allows you to export your code directly to the MOD
from the environment of Max. Normally you would install it, we already installed it.
And if you click on Launch… you’ll see some documentation below, some tutorials,
walk-throughs, things like that. And a couple of examples, we’ll start with those. So we have some basic set-ups that allow you
to bypass your audio and… this for example is a Vibrato with some comments.
It’s basically pretty simple. This is the code, and the parameters here.
Those are controllable from outside the Gen. And this is just an object-based example, but like Tom
said, you can also use codebooks, which look like this. And we made an empty one to get you started. So, yesterday I heard Doseone talk about flanger,
and he didn’t really have a use for it, but I thought what if hair metal comes back?
So, I kind of prepared something for that. So I made a flanger, which looks like this. And I would like to run it on the MOD.
There are a few things I have to take care of before I export it. All the code that is exported to the MOD
has to be inside the Gen, nothing outside will be into the final plugin. The MOD itself runs at 48 kHz, so
all the math should be correct, or the sample rate conversions or anything like that.
And if I want controllable parameters, I should define the ‘param’ objects with the names and values, default,
minimum and maximum. And then if that’s alright I can… click this message box here, but like the internet
it wasn’t really good right now. We already exported it. So it ends up in this cute tuner box, because it doesn’t
have a GUI yet, you can add that later, but… first it will be inside the tuner box
with the parameters redefined inside the Gen object. We’ll probably want to know how it sounds. So I cheated a little bit there, I added the shimmer reverb
I made. And the MOD has multiple inputs so we can connect
everything and have a delay on my voice, etc. So, I think Tom might take over again.
And this was a small demonstration of MOD’s capabilities with Gen. That was pretty cool. I gotta admit, after being a Max user for many many years,
the first time I was able to press Code Export and put it on a piece of hardware felt like a pretty empowering
feeling, and especially taking it off somewhere in the backpack with no laptop,
it’s pretty exciting times. So as you can see from what Nino was showing us
the patching environment is very similar to Max. And once you get in there, just like in Max,
there’s a whole range of help files and the likes. You can see there’s tons of Gen documentation.
And there’s also, if you go to our website, a whole range of tutorials dating back to when Max
was first released. There’s some phenomenal LFO tutorials by my colleague
at Cycling 74, Gregory Taylor has done some amazing tutorials. So I’m gonna wrap up. As we’ve learned, Gen is a part of
Max with its own patching environment inside Max but it’s a little different, it does have a restricted
object set, but those are highly optimized. Gen makes code as we work, and we can either just
ignore it or we can export it and use it elsewhere. Gen allows you to make more substantial
Max programs, IOS applications, plugins, etc. And as we saw from the MOD Devices guys,
Gen works with hardware. OK, cool. Thank you for your time.
You’ve been a fantastic audience.

5 thoughts on “Gen: Inside Max’s Secret Weapon with Cycling ’74 | Loop

  1. I really LOVE some M4L devices, as Dr-Chaos (and all MIDI crazy stuff in general) and some audio effects.
    The real special thing are the LFOs (and varius modulators) for me: they really turn the entire Ableton workstation into a full powerful modular synthesizer, with ANY kind of synthesis possibilities.
    M4L really can also make Ableton produce a track for you with autogenerative patches; I'm into psytrance production and using MIDI devices as Dr-Chaos and Instant Haus, I really was able to generate psytrance grooves tat was 100% autogenerative.
    But for creating my synths I prefer Reaktor because I find it sounds so powerful, Max stuff sounds always "thin" to my ears. Reaktor is also simply to use too: it's rally easy to create powerful algorythms, including regular macros or core cells too!

  2. The only thing that counts, is what comes out of the speakers. All this talk about endless possibilities is obsolete, if you can't create something and stick with it. We need some limits. Infinite combinations and resources will get you nowhere.

Leave a Reply

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