MAX/MSP CPG Externals

Note - this is currently under construction. I’ll try to add explanatory images and maybe a tutorial video in the coming weeks

This page documents a set of externals which allow people to explore the use of Central Pattern Generator (CPG) neural networks. For an intro to CPGs see this page or my paper here.

Download the MAX/MSP package from GitHub..

No building is required: just download the repository and put it in your MAX packages folder. The package comprises three objects and a hackable MAX/MSP implementation of my CPG sequencer/ rhythm generator Neurythmic, including a standalone GUI application. The CPG objects for max are documented in the usual fashion, with help patches inside MAX/MSP, below is a quick intro to the neurythmic patch and GUI.

Neurythmic for MAX

The MAX package includes a MAX/MSP port and update of Neurythmic - a rhythm sequencer/ drum machine/ rhythm generator built on Central Pattern Generators. Inside the NeurythmicApp folder in the MAX package, there is a max patch “neurythmic.maxpat”. In the “gui” subfolder you will find an executable “NeurythmicGUI.exe”.

At present the GUI only works on Windows, but even for macOS users the MAX patch is a good starting point for working with my object, and developing alternative interfaces: whether that’s a simple gui, some kind of algorithmic control system, or a physical installation.

To use neurythmic, first load the max patch and switch on DSP in MAX, then load the GUI: NeurythmicGUI.exe. The GUI sends OSC messages to max, and the patch interprets them, sends them to the object, and uses the output signals to trigger sounds.

You might want to begin by clicking the cog icon on the top right, and loading a preset, then playing around. There is a basic guide below, and this video may also be helpful


Node Menu (right click on node)

Tab 1 - Node menu

This controls the node’s basic behaviour: you can set its natural pulse frequency (a multiple of the base tempo”) via “Rate” or “fine tune”. You can add a new node as “child” of this node. If the current node has no children you can delete the node.

Tab 2 - Rhythmic Manipulation

This controls “filters” applied to the raw rhythmic output of the nodes: there is a quantiser system, and you can also apply timing offsets. Freedom sets the strength of the quantiser If you increase freedom this means less (and ultimately 0) quantisation. If you decrease freedom then the notes generated by the network are pushed towards the quantiser gridlines. At 0 freedom, notes only appear at quantiser gridlines.

You can also set details of the rhythmic grid - either 3/4 or 4/4, or turn the quantiser off (to use the “raw” rhythmic output of the node. “Resolution” sets the number of beats per bar. “Raw mode” bypasses the quantiser altogether, and does not use note triggers, but uses the raw waveform of the node to envelope a simple synthesizer voice.

Finally you can apply timing offset to the beats of the node. Simply click on the slider in the bottom panel - If the quantiser shows you where beats are allowed to fall The root node does not have quantiser controls, since the quantiser is synchronised to this node. The root node still has a “freedom” control - this sets the overall freedom for the system

Tab 3 - Sound Output

The last tab lets you choose the sound which is triggered by the node, and also its pitch and volume. “SIN” is a simple sine-wave synthesizer voice (envelope controlled by Attack, decay). The other options are drum machine sounds. You can replace these with any samples of your choice in the max patch.

Again you can select “RAW MODE”. “Raw mode” bypasses the quantiser altogether, and does not use note triggers, but uses the raw waveform of the node to envelope a simple synthesizer voice. You can still set the pitch. Decay now acts as a kind of envelope waveshaper.

Other Menus

At the top right there are three icons, in order Sound / Settings / Close menu;

Sound Menu

mixer and volume

Settings Menu

Load and restore presets, save a preset bank to a file, load a preset bank from file. I’ve found it can be too easy to accidentally overwrite a preset, and a better UI could easily be imagined. This is a pain, but I haven’t had time to fix it. Warning: there is a slight bug with preset loading - sometimes networks initialise with all the right parameters, but the behaviour is not quite the same. This is no doubt due to the sensitivity of the networks to initial conditions - although we are initialising with internal values for all nodes. It is possible something is off here. I need to find the source of the issue for a future update.

You can also reload the settings file (for ease of hacking: see hacking below) but not all settings options can be changed without a reload. The GUI sends OSC messages to MAX (or potentially any OSC receiving system, if you can imagine another use for this GUI). You can change IP of the OSC host and the in/out ports in this menu too

Max patch Hacking

You can easily make changes to the max patch - look at the help file for for other options which are not used.

Some ideas:

Other hacking:

In the assets folder there are settings files you can change, alongside the max patch. Make sure you back up first. After altering any of these files just reload the exe.

MAX/MSP CPG Externals -