Today we’re going to talk about how to set up a development environment for your OWL and Max’s Gen. First, though, a quick recap of what the OWL is and what Gen is:
The OWL is a Eurorack module which is a blank canvas. You can design your own DSP using C++, Pure Data, Faust and now Max’s Gen. You can make things from oscillators to delays to distortions to any sort of CV processes and run them on the OWL in your modular set up.
Gen is a low-level coding environment developed and distributed as a part of Cycling 74’s Max software, which is a visual programming environment. We can use the visual, user-friendly data-flow paradigm of Max to code low level DSP that runs on GPU/ CPU directly. We can then export our projects as C code which can run on all sorts of things – such as OWLs!
1.) Get your copy of Max (and Gen) from cycling74.com/downloads. Download the bundle of Gen examples and templates from github.com/pingdynasty/OwlGenPatches/archive/master.zip
If you’re familiar with github, you can do a git clone, and stay up-to-date with new examples as we add them: the repository is at github.com/pingdynasty/OwlGenPatches
2.) What we’re looking at today is DevTemplate which you’ll see when you unzip the download. You’ll want to add this folder to your Max search path. If you go to Options>File Preferences… you can amend existing search paths or create new ones. This makes sure Max will load all your files correctly!
3.) If you now open up Dev_default.maxpat, you can see that the patch is a virtual simulation of the controls on the OWL. The OWL has four CV inputs and four attenuators for those CV inputs, and we’re emulating the CV inputs. Each dial in the patch (eg the knob connected to [prepend A)] represents the top row of four knobs on the OWL. The knob connected to [prepend E] is the expression knob.
NOTE: for this parameter, you should now use Exp not E – E will give you the mathematical constant e.
The bang connected to [prepend push] is the button on the OWL. The two inputs and two outputs on the [gen~] object correspond to the pairs of input and output jacks on the OWL
4.) Open the [gen~] object by double clicking on it. Inside you’ll see 6 [param] obects. These correspond to the six inputs set up in the main max patch. The input from knob a / [prepend a] comes in to [param @name A @min 0 @max 1], knob b / [prepend b to [param @name B @min 0 @max 1]. Two inputs ([in 1] and [in 2]) and two outputs ( [out 1] and [out 2]) correspond to audio in and out. At the moment, there’s nothing in there – it’s a blank patch that you can use to get cracking making some DSP because that’s more fun!
5.) Let’s make a simple two-channel attenuator. First, “save as” for the template patch before we edit it. We’ll call the main patch SimpleAtten. The max patch and the gen patch co-exist but are also separate entities, and it’s a good idea to save the patch inside Gen separately. If you double click the [gen~] object you can “save as” for this too. It will save as a .gendsp file, in this case, we’ll use SimpleAtten.gendsp.
6.) Open the [gen~] object and unlock it – you’ll have to click on the pencil icon in the bottom left corner to enable you to modify a read only file. Select the two [param] objects for inputs a and b.
Add two multiplication objects. . Break the connection between [in 1] and [out 1], and insert one of the  objects. The audio input goes into the left, the control into the right. The multiplied signal goes to the output. In the world of DSP, multiplying the number from 0 to 1 is the equivalent of volume control from complete silence to maximum volume.
7.) Before we export this as code, let’s make sure it works. We can set up a sine wave, at 440hz, using [cycle~ 440], in the main patch. If we connect it to the inputs of the [gen~] object, and turn audio on, we can use the dials connected to [prepend A] and [prepend B] to fade the sine wave into the left are right channels.
8.) Create a message box called (exportcode) and connect this to the left inlet of [gen~]. Click the message to bring up a menu asking you where to save the exported code too. Check for your exported code in Finder or Windows Explorer. Don’t worry about the contents of the gen_dsp folder – we just need the .cpp and .h files.
9.) To run this code in the browser and on your OWL, go to the OWL patch library at www.rebeltech.org (if you’ve not registered, do so for free). Go to “My patches” and click create patch, Name it what you want; then click choose files and select the .cpp and .h files, making sure you set compilation type to gen. Now, hit “Save and Compile”! Once it’s compiled properly you’ll get a message saying patch compilation succeeded.
Click play, and you can select the microphone input or any of the four sample loops to test your patch – fading up dials a and b will control the left and right audio channels in the browser.
10.) Make sure you’re using a web midi enabled browser (such as Chrome) to load patches onto the OWL. If you’re connected to an OWL, hit “load”. You’ll see when your patch is loaded, how much CPU and memory you’re using. Here we’re testing it with a synth loop on the OWL, and it’s working!