Learn to control an FM Synthesizer through Machine Learning via Pure Data, Processing, and Wekinator software.
In this article, I’m going to show you how to control an FM synthesizer using Pure Data, Processing, and Wekinator software.
Through machine learning, we will train the system to understand GUI-based gestures to control the synthesizer. We will provide input to Wekinator from the Processing software. Then, we will use the on-screen slider example and send the values of the x and y coordinates to Wekinator. Wekinator is trained according to the samples we send through Processing and it will send the output to Pure Data where the pitch of sound can be changed.
Setting Up Processing
The Processing sketch is available on Wekinator’s example page.
Download ‘simple mouse dragged object’ from the example page, unzip it, and run the sketch in Processing. This sketch will give the input to Wekinator. The value of the x and y coordinates will be changed as you drag the green box around and this value is what will be sent to Wekinator. The Processing window will look like this:
Downloading and Installing Pure Data
Pure Data (often referred to simply as Pd) is an open-source visual programming environment. It can run on personal computers, embedded devices, and smartphones.
With Pd, users can create software graphically to process and generate sound, video, 2D/3D graphics, interface sensors, input devices, and MIDI without writing code. Once the programs are ready, they work over local or remote networks and it’s possible to integrate wearable technology, motor systems, lighting rigs, and more. It is a way to learn basic multimedia processing and visual programming methods and can be used at a professional level to program complex systems for large-scale projects.
For this tutorial, you need to download Pure Data and the correct Pure Data Wekinator example.
Run the example, which should look like this:
Setting Up Wekinator
Open Wekinator and make the settings as shown in the image below.
Set the inputs to 2 and outputs to 3. Select the output type to all continuous and leave other settings as they are. Wekinator will send three different outputs to Pure Data and Pure Data will then produce different sounds according to Wekinator’s outputs.
Click ‘Next’ in the lower right side of the window to access the window shown below.
Drag the green box in the Processing window to any place and click ‘Randomize.’ Start the recording for half a second and it will record some samples.
Next, drag the green box in the Processing window to another place. Click ‘Randomize’ and start the recording for half a second.
For a third and final time, drag the green box in the Processing window to any other place, click ‘Randomize’ start the recording for half a second.
I have recorded the samples for three different places in the Processing window. You can send more samples to Wekinator by dragging the green box in the Processing window to other places and then recording these samples.
After recording the samples, click on ‘Train’ to train Wekinator according to the inputs and then click ‘Run.’ Now when you drag the green box in the Processing window, Pure Data will change the pitch of the sound according to the output from Wekinator.