What is Gen

    Jan 07 2012 | 1:57 pm
    Of course, I read through the product description, but it doesn't tell me much. I am fairly new to Max, so far I am pretty comfortable with Max (building complex midi and OSC patches), but haven't touched MSP and Jitter so far. My original understanding of Gen was that it would be an enhanced version of the discontinued Pluggo, generating Code which could be used to build Plugins or software independent from the Max Runtime. I cannot find any hints that this is what Gen does. So, can anyone tell me what Gen is good for? Especially for people like me, who are not into Jitter and MSP at this point. Maybe at some time I will start building synths, too. But my primary use for Max is building Midi/OSC Control surfaces in depth.

    • Jan 07 2012 | 4:14 pm
      Yes I had/have a similar problem understanding the point/purpose of gen~. It is MSP but more low level, as far as I understand it, and allows for some things that MSP has difficulty with, feedback loops etc. Also I guess because it is lower level it can be more efficient computationally. The documentation on gen~ is thin but I think that's partly because it assumes a level of coding (for gen explorer) or MSP/signal processing knowledge from the user.
      Someone more knowledgable than me though will probably reply with more info and I'll be interested to hear what they say. As with all MAX things pissing about with it will teach you an awful lot and I learnt a good amount just from one day with gen~ . Unfortunately I don't have time to go back right now as another patch is calling but I can see the appeal.
    • Jan 07 2012 | 5:24 pm
      I think the point of Gen is to make it computationally feasible to write patches that work at the single-sample level without having to code them in C.
    • Jan 07 2012 | 5:47 pm
      Yes, I was searching for info on what Gen~ is, read posts about it, looked for descriptions of it, and I still really do not have a good idea of what it is or what it is good for. from what I gathered it sounds like something helpful for building synths but I have no idea why.
    • Jan 07 2012 | 5:52 pm
      Nice to hear, that i am not alone with my ignorance ... What you say sounds like it is nothing for me right now. If it would become some kind of app compiler in the future, i would be thrilled, though. I think I read somewhere this might become true in the future. That would be AAAAWESOME!
    • Jan 07 2012 | 8:06 pm
      If you have Max6 on your machine, you can get a sense of what gen does by looking at the gen folder in the examples directory.
    • Jan 07 2012 | 8:09 pm
      This is from the reference documentation:
      Why Use Gen?
      General - You want to create processes that can't be efficiently achieved with ordinary Max/MSP/Jitter objects - You want to program visually at a low level while getting the performance of compiled C or GLSL code - You want to use a concise text based expression language (codebox) rather than visual programming or coding in GLSL - You want to avoid having to compile separate windows and macintosh versions (and in the future, 64-bit application binaries) - You want to design new algorithms and see or hear them immediately - You want to design an algorithm that can run on the CPU or GPU, on Windows and Mac
      Examples - arbitrary new oscillator and filter designs using single-sample feedback loops with gen~ - reverbs and physical models using networks of short feedback delays with gen~ - sample-accurate buffer~ processing such as waveset distortions with gen~ - efficient frequency-domain processing such as spectral delays using gen~ inside pfft~ - custom video processing filters as fast as C compiled externals with jit.pix, and graphics card accelerated with jit.gl.pix geometry manipulation and generation with jit.gen - particle system design with jit.gen - iso-surface generation with distance fields in jit.gen
      Performance improvements - consolidation of chained MSP operators or jit.ops and other MSP/Jitter objects that can be combined into one meta-object - replacement for jit.expr with performance and interface improvements - You want to be able to have a simple way to make use of the GPU for image processing both in visual and textual form
      Gen refers to a technology in Max representing a new approach to the relationship between patchers and code. The patcher is the traditional Max environment - a graphical interface for linking bits of functionality together. With embedded scripting such as the js object text-based coding became an important part of working with Max as it was no longer confined to simply writing Max externals in C. Scripting however still didn’t alter the logic of the Max patcher in any fundamental way because the boundary between patcher and code was still the object box. Gen represents a fundamental change in that relationship.
      The Gen patcher is a new kind of Max patcher where Gen technology is accessed. Gen patchers are specialized for specific domains such as audio (MSP) and matrix and texture processing (Jitter). The MSP Gen object is called gen~. The Jitter Gen objects are jit.gen, jit.pix and jit.gl.pix. Each of these Gen objects contains within it a Gen patcher. While gen patchers share many of the same capabilities, each Gen object has functionality specific to its domain. For example, Gen patchers in gen~ have delay lines while Gen patchers in jit.gen have vector types.
      Gen patchers describe the calculations a Gen object performs. When you’re editing a Gen patcher, you’re editing the internal calculations of the Gen object. In order to make use of the computations described in its Gen patcher, a Gen object compiles the patcher into a language called GenExpr . GenExpr bridges the patcher and code worlds with a common representation, which a Gen object turns into target code necessary to perform its calculations. gen~, jit.gen, and jit.pix transparently generate and compile native CPU machine code on-the-fly, while jit.gl.pix does the same for GPU code (GLSL). When working with Gen objects, you’re writing your own custom pre-compiled MSP and Jitter objects without having to leave Max.
    • Jan 07 2012 | 11:31 pm
      While Gen~ for audio makes perfect sense to me, the jit.gen objects are very confusing to me (I was toying around with the ones in the examples folder). Any idea on an ETA for some Gen tutorials? From what I've seen, it's hideously powerful, but unlike the rest of Max the learning curve is a bit of a brick wall right now.
      There's fundamental differences between patching in gen and patching in max/msp/jitter, not just because of the per-sample structure, but also in terms of logic - I've gotten so used to being able to do logic via if/then statements, or for/while loops in code, it took me some time to get used to dealing entirely with < or > style operations - though it still has that Max 'EUREKA!' feeling when something finally works. :D
    • Jan 08 2012 | 1:03 pm
      it is an object.
    • Jan 08 2012 | 2:12 pm
      @MuShoo If you have something you're trying to figure out and run in to issues, post some questions to the forum. We'll be happy to steer you in the right direction.
    • Jan 08 2012 | 9:27 pm
      It's more that I don't have anything specific, at least with the jit.gen stuff, as I don't think I have enough of a background on lower-level graphic coding. DSP coding with Gen~ makes sense to me, as I had some concept previously of what was going on at the lower level. But graphics is not my background, and while I have a lot of fun with jitter, I picked up a LOT from the tutorials in Max 4 (and 5). But I don't have that background like I do with audio. I know I'm passing around matrices (I assume? Am I working on each pixel in jit.gen? each pixel per plane? the whole matrix? what about jit.gl.pix? what are the differences?) and that matrices can have multiple 'layers' (planes) that are interpreted usually as color.
      But I don't really know how that relates to jit.gen stuff, or what the loop iterates over, and the kinds of things that I can do with it.
    • Jan 09 2012 | 5:54 pm
      @MuShoo, One way to look at it, which helped me a great deal, is to think of the jit.gen/pix/gl.pix code as running on a single pixel. All of the logic, math, etc. are affecting that one pixel value. This is similar to how GPU shaders are written. The code is run per-cell/pixel.
      I would highly recommend looking at the Expo '74 Gen materials posted by Darwin Grosse in the Toolbox section of this site. https://cycling74.com/tools/expo-74-gen-patches/
    • Jan 09 2012 | 6:34 pm
      Jitter gen patchers operate a each cell at a time. For the pix objects, this is a pixel but jitter matrices don't necessarily hold pixel data. The difference with gl.pix and other gen objects is that the calculations run on the GPU using shaders. It's basically the same as jit.gl.slab.
    • Feb 12 2012 | 9:28 am
      "- You want to design an algorithm that can run on the CPU or GPU, on Windows and Mac"
      does that mean that, in theory one could write, for example, a filter, or a reverb, that would be in use by an iphone app? or an opengl equivalent for graphics manipulation??
    • Feb 12 2012 | 12:20 pm
      velebrz : so far not at all, it's alway a gen object inside a max patcher that does you algorythm. Though some said it was also meant to be some kind of compiler replacing the much missed pluggo in the future, i don't see how it could be related, and i merely think they are misinterpreting the doc. Also, short answer for FriFlo, it's completely useless for midi/osc processing, obviously.
    • Feb 12 2012 | 7:55 pm
      @velebrz The point of that quote is that the same gen patch runs without any extra thought on your part on both windows and osx and in the jitter case with jit.pix and jit.gl.pix will run on both the CPU and GPU. The larger point is that the gen world is independent of any hardware or OS, so in the future we can add support for more "backends" like OpenCL, mobile processors, etc.
    • Feb 12 2012 | 10:38 pm
    • Apr 20 2018 | 5:39 pm
      hi there,
      the linked files from the Expo '74 Gen patches seem to have stopped working, any chance anyone could re-upload/send them towards new (and curios) users (ME!)?