This is a minimal example of how to combine ml5js, p5js and SuperCollider. It uses an express-server and socket.io/ to listen for messages from the p5js-sketch. The sketch uses ml5js applying transfer-learning for classification of the content of your webcam. The predicted class is send to the server. The server uses osc to send the predicted class to SuperCollider.
The idea is to use p5js and machine learning (ml5js) to trigger different sounds played via SuperCollider. However, since many different applications, such as DAWs, support the OSC protocol, you can exchange SuperCollider with many other applications.
- Install SuperCollider
- Install nodejs
- Run
node install
- Start SuperCollider and open
sc/firework.scd
, - Boot the SuperCollider server by executing the first line, i.e.
s.boot
- Execute the first and last code block to add the Synth and to listen to incoming OSC messages
- Run
node socketServer.js
to start the express webserver and to establish the websocket connections - Go to http://localhost:3000/
- Gather data for your two classes by clicking the buttons
class1
andclass2
- Train, i.e. fine-tune the model by clicking
train
. - After training the the p5js-sketch sends the prediction to the webserver which sends the message to SuperCollider.