A digital ocarina instrument



My objective with this project was to explore some of the issues involved with making a digital musical instrument which is based on an existing acoustic musical instrument. I was interested to explore the balance between giving a faithful digital recreation of the experience of playing the acoustic instrument and taking advantage of the possibilities that become available when the interface and the sound it produces become decoupled as they are in a digital musical instrument.


I started studying electronic music last year in Concordia’s electroacoustic music composition program. My background is in jazz piano performance, so I was naturally drawn to live electronic music performance as a major field of interest, and it didn’t take me long to figure out that the interfaces available to me were inadequate for performing the kind of music I was learning about at Concordia. This lead me to start reading about digital musical instruments, and especially the proceedings of the NIME conference. So this year I’ve been making my own new interfaces, working toward more engaging live electronic music performance. I made a pair of sensor slippers for another class, and I also made the Arduinocarina.

The Acoustic Ocarina

I, like many others, first heard about the ocarina in the 1998 video game, “The Legend of Zelda: The Ocarina of Time”, but the ocarina belongs to a family of ancient vessel flutes which are over 10 000 years old. Blowing down the airway of the ocarina causes the air stream from your breath to be divided by the voicing of the instrument, causing the air inside it to resonate. Opening the finger holes on the body of the instrument causes the resonant frequency of the chamber to rise as more area is opened. The important variables which affect the ocarina’s pitch are mainly the volume of its chamber, and the open area of the holes. This has a side effect that the ocarina can take a variety of different shapes, and be made of many different materials, which allows ocarina makers to be very sculptural and artistic in the design of their instruments (or not). You can read more about how the ocarina works here.

The main playing techniques of the ocarina are blowing into it and changing your fingering. Breath in particular has some pleasant expressive qualities on this instrument, as a faster air stream causes the instrument to resonate louder, and also rise slightly in pitch, allowing for breath vibrato, and some other interesting effects. On most ocarinas the higher notes are tuned such that a faster breath stream is necessary for them to be in tune, and on some ocarinas it is necessary to perform what is called the “acute bend” on the highest notes in order for them to sound good. Finally, pitch bends are possible on the acoustic ocarina by sliding the fingers on or off of the holes. Depending on the ocarina, this may also be necessary in order to play some chromatic notes.

The Arduinocarina

The Arduinocarina is a low cost shield for the Arduino development board. It uses capacitive sensing through six copper touch pads on the top of the shield, an air pressure sensor to measure breath velocity, and a three axis accelerometer for additional expressive control. The accelerometer uses the open-source Wire library to communicate over the IIC bus with the micro controller. The air pressure sensor uses a ratiometric analog output which is read through the microcontroller’s analog-digital converter. The capacitive touch pads use a slightly modified version of the open-source cap sense library.

Capacitive Sensing

Many digital musical instruments which use capacitive sensing, such as the T-Stick by Joseph Malloch, make use of a simple integrated circuit which takes care of the sensing algorithm such as this one. In contrast, the capacitive sensing on the Arduinocarina is handled by the Arduino’s microcontroller itself, using a modified version of the open source cap sense library. The cap sense library uses a very simple algorithm to measure changes in capacitance. By connecting two digital pins of the micro controller through a resistor, and connecting a touch pad to one the pins, a simple RC circuit is formed. The user’s fingers act as a virtual ground, and form a capacitor with the touch pad. When a touch is present, the capacitance is slightly higher, which increases the RC time constant of the circuit. By turning on one of the digital pins, and measuring the time it takes for the other pin to reach a high logic state, differences in the RC time constant can be measured, allowing the micro controller program to discern whether or not a touch is present. This kind of capacitive touch sensing is known as self capacitance.

copper touch pads


There are two firmware options for the Arduinocarina: a high resolution low latency serial firmware, and a MIDI firmware. The serial firmware sends the data from the sensors in the same resolution as they are sensed, using 10 bits for the breath sensor, 14 bits for the three axes of the accelerometer, and 6 bits for the fingering. The data are preceded by a status byte which identifies the sensor that the data comes from, and each byte of data is formatted to have a 0 in the most significant bit allowing data to be easily discriminated from status bytes. The data are sent at the maximum available baud rate (115200) to the computer, and can easily be reconstructed in Max/MSP or Pure data. Every sensor is scanned continuously and a new sample is sent to the computer on every loop through the firmware program.

The MIDI firmware sacrifices some resolution and speed in exchange for high compatibility with a variety of software and hardware. The sensor data are all reduced to 7 bits of resolution, and only sent to the computer (as MIDI control change messages) when there is a meaningful change in the reading. A more modest baud rate of 9600 is used. The fingering is converted to corresponding MIDI note numbers on the microcontroller. Whenever the note changes, the new note is sent first and then the previous note’s note off is sent so that there is always a note on. The Arduinocarina offers the best effect when the synthesizer it is controlling is set to a monophonic mode, with breath controlling the overall amplitude.

Because most music software will not read from the serial port which the Arduino communicates over, a simple bridge application was written in Max/MSP which reads from the serial port and forwards the bytes unaltered to a chosen MIDI port on the computer. This bridge and both firmwares are available to download at the bottom of this page.

Making Sound

A simple synthesis patch was implemented in Max/MSP, using the serial firmware, to demonstrate some of the potential of the Arduinocarina (it is also contained in the compressed archive below). As on an acoustic ocarina, the pitch is controlled by a combination of the fingering and breath. Unlike on an acoustic ocarina, the Arduinocarina is able to play a range of two and a half octaves, fully chromatic, despite its very small size, by using one of the touch pads as an octave button. This would be impossible on an acoustic ocarina, where the size of the finger hole would have to be too large, and would cause the chamber to be unable to resonate. Other than the octave key, and a “flat” key which plays the semitone below whatever note is selected with the other fingers, the fingering on the Arduinocarina is the same as on the Magic Ocarina by Smule for iOS. The octave is the same as an english pendant ocarina, but the range is extended half an octave downward, using fingering combinations which are not useful on an acoustic ocarina.

Also unlike an acoustic ocarina, it’s possible to change the way the Arduinocarina sounds in any way imaginable. As a very simple demonstration, I included a simple effect processor in the initial synthesis algorithm of the Arduinocarina, controlled by the accelerometer. The gesture of using the accelerometer is more or less familiar to ocarina players from working with the acute bend. I also included two different choices of oscillator which can be selected by the user. Because it is a digital musical instrument, the Arduinocarina could be made to sound any way the user desires.


A long and troubled process of trial and error lead to the ultimate design of the Arduinocarina. At first, I intended to 3D print the instrument, using a conductive filament for the touch pads. The instrument would have had a more traditional and aesthetically pleasant ocarina shape, and the electronics would have been mostly hidden in the body of the instrument. Unfortunately, this idea had to be put on hold because I was unable to access the 3D printer at Concordia. This was probably for the best, since I didn’t really have time this semester to teach myself 3D modelling.

Having scrapped 3D printing as an option, I resolved to fabricate a printed circuit board using the toner transfer etching technique which is popular in the DIY community. Unfortunately, my Brother brand printer is incompatible with this technique (the toner won’t transfer without a significant amount of heat). I also tried hand drawing the circuit, which I thought for sure would work. When it didn’t, I had to scrap circuit board etching as well as 3D printing.

failed pcb etch attempts

The other major design challenge I faced was working with the capacitive sensing. I initially thought that it would be easy to estimate how much of my finger was touching the touch pads, and that I would be able to emulate half holing and pitch bend techniques. As I continued testing, however, this proved unfeasible. With a very large resistor in the RC circuit, the values read using the cap sense library can have a very wide range, and while I thought that this made the readings higher resolution, closer observation showed that they were too noisy and erratic to be useful for musical control.

Finally I resolved to use pennies on a simple perforated prototyping board, with uncomplicated binary touch sensing. This hardware solution is effective and very low cost, and also offers a very low barrier to entry for building an Arduinocarina, potentially making it a suitable project for a wide range of people such as the DIY electronics community. Making a simple binary distinction between touch or no touch reduced the time needed to read from each touch pad dramatically, and also simplified the code for sending the sensor data to Max/MSP.


The Arduinocarina is a small, lightweight, low cost digital musical instrument that allows expressive breath control of a musical algorithm. It allows a two and a half octave range, and can be used to control digital sound effects and/or a variety of synthesis algorithms, using the built in accelerometer. Designing the Arduinocarina has been an excellent opportunity to internalize some of the concepts of digital musical instrument making illustrated in the NIME proceedings and other sources. I look forward to continuing to broaden my performance possibilities as I move forward working with this and other instruments I have made this semester.


Camacho, Oscar, and Eduardo Viramontes. 2011. “Designing Touch Sensing Electrodes: Electrical Considerations and Recommended Layout Patterns.” Freescale Semiconductor Application Notes.

Hunt, Andy, and Marcelo Wanderley. 2002. “Mapping Performer Parameters to Synthesis Engines.” Organised Sound 7 (2): 97–108.

Malloch, Joseph, and Marcelo M Wanderley. 2007. “The T-Stick: From Musical Interface to Musical Instrument.” In Proceedings of the International Conference on New Interfaces for Musical Expression, 66–69.

Scavone, Gary P. 2003. “THE PIPE : Explorations with Breath Control.” In Proceedings of the International Conference on New Interfaces for Musical Expression, 15–18.

Wang, Ge. 2009. “Designing Smule’s Ocarina : The iPhone’s Magic Flute.” Proceedings of the International Conference on New Interfaces for Musical Expression, 303–7.


Arduinocarina Firmware and Maxpatch

Travis West

MUMT 306 Fall 2015

Professor Gary Scavone

Special thanks to Tristan and the Concordia IEEE for the use of their facilities and for their moral support in making this project.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>