Audio System Design Tool

Audio Library

The key element to creating our synthesizer for the Trellis M4 is the Audio library by PJRC for Arduino. This tremendous library is written by Paul Stoffregen for the Teensy line of microcontrollers, and has been the backbone of many, many amazing audio projects on Teensy. It has now been ported to run on NeoTrellis M4, opening up a whole new world of audio projects that can use the RGB lighted button grid and accelerometer for control!

While you can write your Audio library Arduino patches entirely in code, the secret weapon for crafting your synth is the Node-RED based GUI, the Audio System Design Tool.

The Microcontroller Audio Workshop run by Paul Stoffregen at HaD Superconference 2015 with videos and extensive documentation are an invaluable resource for learning more about the Audio library. Check it out: https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015

Audio System Design Tool

The Audio System Design Tool is a graphical interface for creating modules and patches for the Audio library written by PJRC.

From the tool's readme:

The Audio System Design Tool lets you easily draw a system to process 16 bit, 44.1 kHz streaming audio while your Arduino sketch also runs.

Export will generate code to copy into the Arduino editor, to implement your system.

Most objects provide simple functions you can call from setup() or loop() to control your audio project!

It runs in a web browser, so you can simple open it up by clicking this link (it will open into a new browser window, so if it won't launch, you may need to adjust your browser's pop-up window settings to allow it):

Let's take a look at the interface and build our first patch.

GUI Tour

The GUI is made up of three sections:

  • Nodes panel -- where all of the nodes (also called "objects" or "modules") are that can be used, grouped by types. Use the mouse wheel to scroll through this long list!
  • Canvas -- where you'll drag nodes and connect them to build your patches
  • Info panel -- helpful information on your currently selected node is displayed in this panel

Build a Patch

In order to build a patch, you will drag objects from the Nodes panel onto the canvas, and then patch the nodes by drag-connecting from an output port of one object to an input port on another.

Waveform

First, scroll down to the synth category and find the waveform node. Drag it to the canvas.

Audio Output

Next, scroll up to the output category and find the dacs node. This is the stereo Digital-to-Analog-Converter the we use to output sound over the headphone jack on the NeoTrellis M4.

Patch Cables

Now, we'll patch the output port of the waveform node to the two input ports (stereo L and R) of the dacs node. This is done by simply clicking the mouse on one port, dragging, and releasing on the other port.

In many cases you'll want to connect the output port of one node to the input ports of multiple nodes. This is easy to do -- simply drag multiple patch cables from the output! You cannot patch multiple outputs to a single input port, however. For this you'll usually add a mixer node.

Here's an example of using mixers to allow different levels of a waveform and pink noise to be mixed into each side of the stereo dacs audio output.

Info

When any node is selected, the Info panel will provide useful information on the node, such as a summary, the port mapping, how the functions will be used in the Arduino sketch for that node, and a pointer to any example files in the Arduino library.

Code Export and Import

On the next page we'll look at setting up the Arduino IDE to use the Audio library and write sketches. But, before we move on, we'll look at one last important feature of the Audio System Design Tool --  code Export and Import.

In order to generate the code snippet that defines our nodes and patches, click the Export button. This will open the Export to Arduino window. Here, you can copy and paste the source code and then close the window.

You can also import code that you have adjusted in Arduino code, so if you happen to rewire things there but then want to continue working on the patch in the GUI, you'll use the Import button instead.

Before we dive into using the Audio System Design Tool generated code snippet, we'll get things set up for using Arduino and the Audio library on the NeoTrellis M4.

This guide was first published on Dec 18, 2018. It was last updated on Dec 18, 2018. This page (Audio System Design Tool) was last updated on Oct 17, 2019.