Overview

I developed a series of bespoke audio devices for Toby Hey’s Furniture Music exhibition – a sound installation using frequencies that reside at the edge of human perception – at the LEVEL Centre in April-May 2016.

Three different audio playback devices – an infrasonic dual osc synth, a high-frequency Mozzi synth patcher and a capacitive touch wav player – drove different specialist speakers.

The devices integrated the Teensy 3.2 USB-based micro-controller and its accompanying Audio Adaptor Board and Audio Library along with the Mozzi sound synthesis library for Arduino. Wireless control was realised via the Adafruit Huzzah ESP8266 Breakout WiFi micro-controller and custom TouchOSC interfaces on an iPad.

This post is about the dual osc synth (on the right in the photo) – I may make subsequent posts about the other devices.

Operation

The synth is controlled by a TouchOSC interface on an iPad. OSC messages (TouchOSC doesn’t use bundles) are sent via UDP to the Adafruit Huzzah which forwards them on via SLIPSerial to the Teensy 3.2. The Teensy parses these messages, updates the synth accordingly and, when required, sends new OSC messages with the appropriate string and float values back to the Adafruit Huzzah via SLIPSerial which then sends them on via UDP to the iPad to update labels and values in the TouchOSC interface.

There are two oscillators each with 5 available wave types – sine, triangle, saw, square, pulse – the last with an additional pulse width knob.

Both oscillators also have controls for amplitude and frequency (including min and max values).

There are three synth ‘modes’:

  • dual osc – the oscillators are independent but their outputs are mixed together;
  • frequency modulated sine – osc 1 (only as a sine wave) is modulated by osc 2 frequency and wave type (at the time this was the only osc modulation available in the Teensy Audio library though it now features the waveformMod type);
  • osc 1 ease + osc 2 – the osc 1 frequency is ‘eased’ between the min and max frequency values using Andy Browns Easing library; osc 2 frequency is set to the mid point of osc 1’s min and max frequency values.

Note: Through my PhD project I’d become interested in how to create more expressive movement between frequencies via the automation of portamento – and had experimented with Andy Brown’s Arduino easing functions animation library (based on the work of Robert Penner) actually just a family of mathematical functions of position over time. By applying the tweening and easing functions used to create more natural looking movement within computer-based animation – but to sound – I realised more control over the movement between frequencies and a series of distinctly different portamentos to the ear.

The ‘easing’ section features the following controls:

  • duration – the length of the portamento
  • repeat – the type of repetition between min and max frequencies – up, down and palindrome;
  • easing type – linear, back, bounce, circular, cubic, elastic, exponential, quadratic, quartic and sine.

The ‘presets’ section features:

  • load and save buttons for the ‘bank’ of presets – multiple presets are loaded from and saved to EEPROM;
  • load and save buttons for each of the 16 presets – changes are lost between sessions if the bank is not saved.

Note: While the preset functionality is specific to this device out of interest to learn I coded it as an Arduino library.

A scheduler section (page 2 of the TouchOSC layout) features:

  • 16 sliders – to select the preset number for scheduling – left to right;
  • duration – the time each preset runs for;
  • modes – off, random, default (presets 1-16 in order) and selected;
  • load and save buttons – the schedule of selected presets is saved to EEPROM.

Set up

While the Adafruit Huzzah can be configured as a Wi-Fi Access Point allowing the iPad to connect directly to it (this included but commented out in the EPS8266 sketch) – in practice I found it a bit too temperamental, so for the exhibition I added a dedicated Wi-Fi router. Any basic IEEE 802.11 b/g/n rated router should do – make sure to open ports 7000 and 7001 for TouchOSC via the routers admin configuration interface. I also set DHCP address allocation to start at 192.168.1.100 (or equivalent).

Since the IP address of the iPad is hard-coded into the Adafruit Huzzah and realising the correct IP assigns is critical to getting things to work correctly, I documented a consistent set up procedure – as detailed in the ‘Instructions & Configurations’ PDF on GitHub.

In brief:

  • switch on the router first;
  • connect the iPad to it – make sure its IP address has been set to 192.168.1.100;
  • power up the device – then reset the Adafruit Huzzah module;
  • in TouchOSC, load the ‘AUDINT_FM_Lo’ layout and set the ‘Connection>OSC’ to Host – 192.168.1.101, Port (outgoing) – 7000, Port (incoming) – 7001.

Schematic

The schematic is pretty minimal – apart from the +5V and GND lines to both modules the only other connections are Tx (Huzzah) to Rx (Teensy) and Rx (Huzzah) to Tx (Teensy). To avoid errors on uploading code I added a two-position slide switch to the Rx (Huzzah) to Tx (Teensy) line – off for programming and on for normal use.

The inductors and capacitors visible in the photo aren’t essential – they were added to minimise noise on the DAC output of the high-frequency Mozzi synth patcher (I integrated both devices together for this version).

Code

Code was written and uploaded using v1.6.7 of the Arduino IDE and v1.27 of the Teensyduino add-on and with the esp8266 v2.3.0 by ESP8266 Community core files installed via the IDE Boards Manger. It may work with newer versions – I haven’t tested it.

The Adafruit Huzzah code requires no additional libraries – but flashing it it requires a console cable or FTDI cable. I think I used an Adafruit FTDI Friend.

The Teensy 3.2 code requires the EasingAB, EEPROMEx, StopWatch and a self-built Preset libraries – these available on my GitHub.

TouchOSC

Layouts were created (likely) using v1.8.0 of the TouchOSC editor. (I needed to download and install Java for OS X 2017-001 to run it on macOS 10.14.2).

There are two versions on GitHub – the only difference with the public version is that it removes the ‘load’ and ‘save’ presets buttons – so that users couldn’t accidentally overwrite saved presets.

While TouchOSC doesn’t use OSC bundles, Lemur does (this tested but commented out in the sketches). In the future I may re-develop the control interface to make use of Lemur’s more powerful and flexible functionality.