Harmonizer

 

Finlay Braithwaite

Harmonizer

This project realizes an interactive audible tone and interval reference. Think of it as a modern day pitch pipe that allows users to explore complex chords instead of a single note. The harmonizer can reproduce any frequency in the audible spectrum. With a fundamental ‘root’ frequency established, users can explore three additional harmonic intervals to build any four-part chord of their choosing. Harmonizer allows for either equal or just intonation, illuminating a difficult to demonstrate yet fundamental aspect of musical theory.  Tactile controls allow modification of each voice’s volume, waveform, and pan. In addition, a filter can be applied to shape the tone of the Harmonizer’s output. The Harmonizer system is the combination of a web application and USB peripheral.

Demo Video

Harmonizer DEMO

Code – Harmonizer v0.0.1

HTML

https://github.com/braithw8/OCAD_webspace/blob/master/Harmonizer/index.html

CSS

https://github.com/braithw8/OCAD_webspace/blob/master/Harmonizer/style.css

Code for Adafruit Feather M0

https://github.com/braithw8/OCAD_webspace/blob/master/Harmonizer/arduino/multiIO/multiIO.ino

P5.js javascript

https://github.com/braithw8/OCAD_webspace/blob/master/Harmonizer/sketch.js

Breadboard Layout

harmonizer_bb

Wiring Schematic

harmonizer_schem

Process Journal

As this experiment is a rare occasion to focus on one’s self and make a device solely for them, I naturally wanted to create a sound peripheral and application of some sort. My artistic and professional background is in music and sound design as well as audio operations and engineering.

At first, I wanted to make a tool to analyze real-time acoustic information and create a fun yet useful visual display. I thought it would be interesting to design my own device that was equal parts sound pressure meter, real-time spectrum analyzer, waveform monitor. I began investigating the feasibility of such a project. I would connect an Arduino compatible microphone to the Adafruit Feather M0. From there I would ultimately connect to a P5.js javascript platform that would translate my incoming audio data into various visualizations. The beginning and end seemed very realistic, but I began worrying about the serial data connection between the Feather and P5.js. Our in-class examples ran at 9600 baud, but I felt I might need a much higher data rate. Furthermore, in probing the audio possibilities of P5.js with my laptop’s on-board microphone, I felt that an Arduino microphone was overly complicated on one hand and redundant on the other.

Moving on, I became intrigued with p5.sound’s sequencer functions. This function allows for a sequence of media files or musical notes to be triggered in a repeatable sequence. Following this exploration, I resolved to create a step-sequencer. Users would be able to define the parameters of the sequence using a physical controller. A physical peripheral becomes so import in this context. A computer really only has two variable inputs that can be controlled simultaneously, the X and Y positions of the mouse. I wanted to open this up so one could physically control eight variables simultaneously. To get the most mileage out of this, I thought of using potentiometers as my input. It appeared that the Feather would accommodate eight analog inputs, so I began dreaming about what I could with eight pots. My first design had eight knobs controlling the pitch of eight notes in an eight note sequence. If I could build that, I would think about adding additional functionality. This would resemble the Doepfer Musikelektronik ‘Dark Time’ analog sequencer (http://www.doepfer.de/Dark_Time_d.htm), where every note is set using a potentiometer.

The sequencer was a nightmare to work with in the context of my design priorities. Once the sequencer pattern was set, there didn’t seem to be a fluid way to insert new note pitches into the pattern from the potentiometer value. Also, as the sequence progressed, the CPU demand of the host browser escalated until the app choked out. While this sometimes made an interesting or comical sound, it highlighted that the sequencer was turning oscillators on but not turning them off. Finding the p5.sound code slightly impenetrable with my coding experience, I didn’t not find a workable solution to this problem.

With this left-turn in my design plans, I switched directions and began developing a tone and interval reference system. I’m fascinated with the concept of intonation, the division of the audible spectrum into musical notes. There are many different systems of musical tunings stemming from the world’s diverse musical cultures. Dividing the spectrum is first done proportionally in octaves. Each octave is a doubling in frequency. The difference between 240 Hz and 480 Hz, for example, is an octave. Within each octave we can apply simple fractions to derive tones and semitones. In western music, each octave is divided into 12 semitones. Simple fractions create intervals known as a third, fifth, seventh, etc… This system is beautiful in it’s simplicity and the tones it produces have a pure relationship with one another. This type of intonation is known as just intonation. While theoretically ideal, these ratio relationships of notes don’t transpose well. Instruments created in just intonation can only play in one scale.

To get around this limitation of just intonation, a system of equal intonation was created. Equal intonation has each note equally spaced in terms of frequency from its surrounding notes. It’s a beautiful system that allows an instruments to play music in every key. However, the simple relationships of just intonation are lost, making all combinations of notes slightly dissonant. It’s a tradeoff required to create instruments for all keys and, as a result, is part of the foundation of western music. Interestingly, we’ve become so accustomed to the slightly dissonant intervals of equal intonation, that music with just intonation seems antiquated and quaint; medieval in quality.

Here’s a video that does well in demonstrating the differences between equal and just intonation. You can see the challenge in this demonstration as he has to manually create each individual frequency for each interval he creates.

https://www.youtube.com/watch?v=VRlp-OH0OEA

The concepts of intonation are hard to illustrate acoustically as there are few instruments to elaborate with. This inspired me to create such a reference, so that educators and scholars could have a reference to complex intervals in both intonations.

My design was to create a four oscillator tone generator that could leverage a fundamental frequency oscillate at intervals related to that note. A user would set a four-part chord and then be able to switch intonations.

In my previous experiment, I have explored the concept of a two-state application. For ‘Frame It Up’ we had the launch screen and gameplay states. I wanted to take this further and created a dynamic multi-page experience for the user. I didn’t want to limit the exploration of the user by the number of physical controls. I endeavoured to create a six-page experience. I planned four pages for oscillators and their parameters, one page for effects, and one page for global parameters such as global intonation.

I first created three arrays of intervals, one for equal intonation, another for just intonation, and one with labels for both intonations. Each array entry contains the calculation to leverage a root frequency and calculate an interval. The arrays would allow me to apply a frequency to my four oscillators.

var justScale = [1, 25/24, 9/8, 6/5, 5/4, 4/3, 45/32, 3/2, 8/5, 5/3, 9/5, 15/8, 2];

//calculation of just intonation. Each interval is a simple ratio to the root.

var equalScale = [1, Math.pow(2, 1/12), Math.pow(2, 2/12), Math.pow(2, 1/4), Math.pow(2, 1/3), Math.pow(2, 5/12), Math.pow(2, 1/2), Math.pow(2, 7/12), Math.pow(2, 2/3), Math.pow(2, 3/4), Math.pow(2, 5/6), Math.pow(2, 11/12), 2];

//calculation of equal intonation. Each jump from semitone to semitone is a calculated exponential increment.

var scaleLang = [‘Unison’, ‘Minor\nSecond’, ‘Major\nSecond’, ‘Minor\nThird’, ‘Major\nThird’, ‘Fourth’, ‘Diminished\nFifth’, ‘Fifth’, ‘Minor\n Sixth’, ‘Major\nSixth’, ‘Minor\nSeventh’, ‘Major\nSeventh’, ‘Octave’]

//names of intervals, regardless of intonation

I thoroughly enjoyed making the code for this project. I pushed myself to become more comfortable with functions and objects. I was able to make multipurpose functions that would satisfy a number of scenarios without writing the code over a dozen times. I feel I could take this further and make my code tighter. In making the code smaller, I feel I’d be able to get a better overview of the global logic of my code while at the same time allowing me to make quick changes with global effect.

The function I’m most proud of is latchKnob. With latchKnob, the potentiometers need to move through a current value before it takes control of that value. It makes the dynamic switching of pages possible. Without this, all parameters on a page would snap to the current potentiometer values when the page is loaded. latchValue is an absolute (+ or -) range that widens the function’s parameters.

function latchKnob(value, input){ if (Math.abs(value – input) < latchValue) { return input; } else { return value; } }

20171113_114257

I am very happy with physical peripheral. It’s housed in a sturdy plastic container. As a prototype it allowed me to flexibly configure and troubleshoot the electronics and Feather. It’s open base made accessing the electronics easy. It was fairly straightforward to make a symmetrical design with my eight faders. Instead two banks of four, I wanted to separate the function of two buttons while maintaining the symmetry of the device. The dial on the left would control the page and the dial on the right would control the root note.

20171113_114854

Overall, I’m very happy with how this project evolved. I still feel it’s a work-in-progress and I’m excited to continue working on it. As a first version, I learned a lot about the system’s strengths and weaknesses and found direction for future versions. For the next version, I’m going to make a page that displays and controls all intervals for all oscillators in one space. I also want to explore the sequencer again, allowing you to play chords in a rhythm or possibly as an arpeggio.

Leave a Reply