Machine Learning in Cycling '74's Max

June 19, 2023 ยท View on GitHub

Repository for Max patches that accompany my Seattle Max Meetup presentation, March 25th, 2023


Summary

In the accompanying talk and demonstration I introduce what Machine Learning (ML) is using simple linear regression as a first example, then expand into other examples of unsupervised and supervised learning. Next I show how ML may be applied to musical tasks using Max, specifically using externals for Max to accomplish the tasks of 1) mapping between a gesture and synthesizer presets in real-time, 2) mapping between an input sound and a corpus of audio in real-time using concatenative synthesis, and 3) using neural networks trained on corpuses of audio to morph the timbre of a sound at the sample level in real-time.


Assumptions

  • You're interested in incorporating ML into your art-making practice
  • You're not deeply knowledgeable about ML (yet!)
  • You're comfortable programming in Max
  • You're aware of how to install packages (File -> Show Package Manager)

ML in Max Resources (Externals Packages)

PackageDeveloperFeaturesSourceRelease DateDevelopment StatusInstall Notes
MuBu + PiPoISMM Team @ IRCAMmany different ML algorithms, focused on audio feature extraction and sound organization, somewhat steep learning curveClosed Source2010In Developmentvia Max Package Manager
nn~Acids Team @ IRCAMdeep learning neural network model in MaxOpen Source2022In Developmentvia this link if on Mac, build from source on Windows, works with RAVE trained models
FluCoMaFluCoMa Teammany different ML algorithms, well organized, some example patches assume knowledge of MLClosed Source2018Just Stopped Developmentvia Max Package Manager
ml.starBenjamin D. Smitha number of different ML algorithms, with nice example patches, although some dated, a good entry pointClosed Source2011Not in Developmentvia Max Package Manager
ml-libIRL Labsa direct implenentation of the Gesture Recognition Toolkit by Nick Gillian in Max, very barebones, data type agnostic, data as listsOpen Source2013In Developmentvia Max Package Manager

Included Patches

Learning Patches

  • linearregression.maxpat - demonstrates simple linear regression linearregression
  • supervised.maxpat - demonstrates supervised learning using the support-vector machine algorithm, requires ml-lib externals supervised
  • unsupervised.maxpat - demonstrates unsupervised learning using the Fuzzy C-means clustering algorithm, requires ml.* externals unsupervised

ML in Max Patches

  • shapetosoundmapping.maxpat - using ML (supervised learning) to learn mappings between a shape and a parametric space, requires ml-lib externals ShapeToSoundMapping
  • concantenativesynthesis.maxpat - using ML (unsupervised learning) to map between one corpus of audio and another at the grain level, requires MUBU externals ConcatenativeSynthesis
  • deeplearning.maxpat - using Deep ML (neural network) to map between an input sound and a trained sound model in real-time, requires nn~ external DeepLearning

TODO

RNBO Extras

RNBO is a new Max feature that allows you to write RNBO patches (similar to Max patches) that can then be exported to five different targets, three of which I'll demo.:

  • C++ Source
  • JS Web Export - see this Template for a great starting point.
  • Raspberry Pi - see here for a step-by-step guide
  • Audio Plug-in - click here for a step-by-step guide
  • Max External

Remember: RNBO is NOT Max. Most notably, you can't have symbols (e.g. (parameter $1)) and you also can't incorporate Max externals (as of this writing).