Grant Muller

Harmonic Table 0.5: Midi Input & Lit Keys

While I thought the GOL Sequencer Bank would get the bulk of my attention this Winter, it turns out I’m getting far more requests to update to the Harmonic Table controller. Among them were Midi Input capabilities, buttons lighting up, and some bug fixes here and there. All that completed, I give you Harmonic Table 0.5. Here is the breakdown:

Midi Input – This feature allows you to accept midi note on and off events and display them as key presses on the main screen. I see this as a learning tool that allows a user to easily see the relationships between notes. Note: At this time it is difficult to keep up with a rapid number of midi input messages. If you’re using this as a learning tool, it is recommended that you reduce the tempo of your sequencer so you can see these relationships without missing any notes.

Midi Thru – This is just another aspect of midi input. When this is turned on any messages appearing on the midi input will be mirrored to the midi output you have selected

You can download it here: HarmonicTable 0.5

Lighting up buttons and accepting midi input introduced a few performance related bugs, but nothing that should keep anyone from using the tool. I’ll have this cleaned up in a future release.

The main target in the next release is touch screen support. I’m getting a lot of great info offline from a few people who are interested in testing this for me, so look for that very soon.

STFUnity: GOL Sequencer Bank, Sound Design, and New Music

I’ve undertaken a new musical collaboration with a very eclectic (and eccentric) group of guys called STFUnity. The project for me started when Bill mentioned putting together a completely virtual collaboration between he, Jason Blain, and myself. The idea was that rather than the traditional setting of getting a couple musicians in a room, rehearsing some material, then playing it live, we’d instead pass around a bunch of tracks and see where each member took the material. I’d never worked in this format before, and it seemed like fun so I jumped on it.

There are no set roles in the group, with any member contributing any element to the song. Still, I feel that my capacity in the collaboration falls in the realm of sound design; I usually contribute textures and atmosphere, with the occasional laying down a percussion track or some programming. The exception being Cottonhammer, which I want to point out specifically

Cottonhammer  is special to me as its the first official outing with my homegrown tool, the GOL Sequencer Bank. I struggled to find ways to incorporate it into my existing tracks. Its too non-deterministic on its own, and the unpredictability of it does not lend itself to a song that has an existing structure (at least not in my travels). So, I changed how I used the tool and stopped trying to place too much direct control over it. Cottonhammer is the GOL Sequencer Bank working autonomously with myself playing live drums simultaneously. Cottonhammer is an attempt to interact musically with a machine.

I arranged four of the six sequencers to play a different range of notes; I didn’t want too many tracks overlapping in frequency range. The other two sequencers I outputted to some very glitchy clicks and pops to keep from having too many melodic instruments fighting for space. I find the output rather soothing despite the complete lack of control and the machine gun percussion.

    So far, there are four tracks completed with several more still in the works. I’ll post updates as the project continues, listen and let me know what you think.

HarmonicTable 0.3

Bit slow these days with work and other stuff to get around to some of the changes I’m been meaning to make to these projects, but here is a quick 0.3 stab. I had more changes planned for this release, along with some stuff for playing back patterns and keyboard playback support, but for now I only had time to make a few changes:

  • Chord Mode – Chord mode allows the user to hold down a key on the keyboard and play a chord when a note is clicked. The chord map is on the release page.
  • Chord Lock – By default when playing a chord by pressing a key, the chord only sounds while the key is held down. In chord lock mode you need only press the key of the chord you want to play, and any note you click after that will play that chord
  • Various Performance Fixes – Nothing special here, moved some stuff around and improved map loops to speed the whole thing up a bit

That should cover it, you can download it here.

Java MidiReference 1.0

Several months ago I started working on a series of classes to make my life easier when programming for music. I’d started several projects and realized that trying to refer back and forth between MIDI Numbers and Notation by hand was tedious, so I created a library of functions to do it all for me.

I finally got around to formalizing this into one library, and released it here. I’ve put this into action already with the Game Of Life Sequencer Bank and HarmonicTable projects, and its really made it easy to pull scales, chords, drum maps, you name it quickly from a preset library

If this kind of thing is useful for anyone other than me, feel free to use it

Game of Life Sequencer Bank Demo

Some time ago, Wesen of Ruin&Wesen created a screencast of a sequencer based on the game of life concept. I followed the screencast, and thought there was a lot you could do with something like this. I thought of several features, making it a step sequencer, a drum sequencer, perhaps enabling multiple scales. I had some free time (we took a vacation), so I worked on it on the plane and early in the morning while my wife slept in, and came up with the Game of Life Sequencer Bank, a bank of 6 GOL sequencers each capable of individual operation and synced via MIDI. The application uses a modified RWMidi library (to handle sync events) and controlP5. Here is a video that demonstrates it:


Game of Life Sequencer Bank: Demo from Grant Muller on Vimeo.

Here is an audio example:

goltemplate2

I’ll spend a few days working out any last kinks and putting together something like documentation, and set it free so to speak. For this project I will likely NOT release the source code just yet, mostly because it needs to be cleaned up (I’d be embarrassed).

Processing HarmonicTable 02

Mac users pointed out some problems with 01, so I fixed the following:

  • When dragging notes, the note would only sound once until the mouse was released.
  • The software would not start up automatically on many Macs unless the java version was set to 6
  • Unreported: Notes would only sustain as long as the mouse button was held. May be seen as a feature, see below for fix.

I fixed the dragging problem, and recompiled the software in Java 5 so that it will work in either 5 or 6, so Mac users should be able to start up without issue. I added a Release Notes toggle button on the setup screen, so you can sustain notes after the mouse is released. If you want notes to sustain only as long as the mouse is held, you can turn this Release Notes on.

harmonictable011

There are two tabs at the top, one for the main table screen, and one for setup. The basic setup options at this time are midi ports, starting note values, and a toggle for releasing notes.

This was built using the Processing libraries, along with the ControlP5 library and Ruin & Wesen’s rwmidi library for midi functionality.

This is an executable jar, meaning if you have java installed on your machine (version 5 or above), you should be able to double-click it and you’re off and running. I have only tested this on Windows and Linux, some testing has been completed in Mac, but more needs to be done, so any Mac users out there send me your feedback.

Harmonic Table 02

If you have any questions or comments, leave them in the section below.

Processing HarmonicTable 01

UPDATE: This is no longer the latest version, I fixed some bugs for Mac users and reposted. To get the latest version click here.

Since I don’t have a touchscreen to test this with, I’m releasing the 01 version with mouse functionality, along with a few GUI functions to change the midi out port and the starting note number. At some point I’ll get a tablet and add the touchscreen functionality, or if someone has a tablet I can pass the source code on and they can test/implement that functionality.

harmonictable011

There are two tabs at the top, one for the main table screen, and one for setup. The basic setup options at this time are midi ports and starting note values.

This was built using the Processing libraries, along with the ControlP5 library and Ruin & Wesen’s rwmidi library for midi functionality.

This is an executable jar, meaning if you have java installed on your machine (version 6), you should be able to double-click it and you’re off and running. I have only tested this on Windows and Linux, so if there are any Mac users out there, please let me know if there are any problems.

Download HarmonicTable 01

If you have any questions or comments, leave them in the section below.

Processing HarmonicTable: Part 2

Since the last post I’ve had to make far more changes than I expected. If you looked at the previous examples, there was using a loop to create the hex buttons, making translations to relative to other translations on the screen. In the process I completely lost track of the absolute position of the button, which basically made it impossible to detect the location of the mouse on the screen in order to tell which button I was pressing. As a result I had to create a separate class to represent the Hex Button, and store the absolute starting point of each hex button and the length of one side. This is all the information I needed to create and detect a hexagon anywhere on the screen. From there I just created an array of these buttons in the setup() block, and drew them all over the screen:

hexButtons = new ArrayList

();

for (int j=2; j <20; j++){ resetNoteNumber(rowNumber); for (int i=0; i<12; i++){ hexButtons.add(new HexButton(this, space+(i*xOffset), parseInt(height-(j*b)), length, noteNumber)); noteNumber++; } j++; rowNumber++; resetNoteNumber(rowNumber); for (int i=0; i<12; i++){ hexButtons.add(new HexButton(this, space+parseInt(a+c)+(i*xOffset), parseInt(height-(j*b)), length, noteNumber)); noteNumber++; } rowNumber++; } [/sourcecode] As you can see I'm still making relative translations to locations on the screen, but I'm storing them in the class to be accessed later. This way I can still change the proportions and space variable at the top and not have to change a bit of code anywhere else to resize and reposition items. This greatly simplifies my draw() block: [sourcecode language='java'] public void draw(){ background(255); for (int i = 0; i < hexButtons.size(); i++){ HexButton button = (HexButton) hexButtons.get(i); button.drawHex(false); } } [/sourcecode] Now detecting the position of the mouse is simple: [sourcecode language='java'] public void mousePressed(){ for (int i = 0; i < hexButtons.size(); i++){ HexButton button = (HexButton) hexButtons.get(i); if (mouseX >= button.startX+a &amp;amp;&amp;amp; mouseX <= button.startX+a+c &amp;amp;&amp;amp; mouseY >= button.startY &amp;amp;&amp;amp; mouseY <= button.startY+(2*b)){ println(button.note); activeNotes.add(button.thisNoteNumber); midiOutput.sendNoteOn(0, button.thisNoteNumber, 100); } } } [/sourcecode] Notice I only bother performing this function when the mouse it pressed, this saves me some cycle since I have no intention of sending a midi note on unless the mouse is pressed (or dragged, which is using the same function as above). Also notice the activeNotes array. I'm storing notes that have already been pressed, so that I don't retrigger a note unless the mouse is pressed again, which is necessary for mouse drags. After the mouse is released, I just send a note off to all notes in the acttiveNotes array. I also revised the array to create the rows of notes across the screen. Previously it was hard coded, but with the following bit of code: [sourcecode language='java'] public void resetNoteNumber(int rowNumber){ if (rowNumber == 0){ noteNumber = noteNameMap.get(startingNote); previousNote = noteNumber; } else if (rowNumber % 2 == 0){ noteNumber = previousNote + 3; previousNote = noteNumber; } else { noteNumber = previousNote + 4; previousNote = noteNumber; } } [/sourcecode] I can just change the starting note field in the class to be whatever I want, and it will always move up by rows in 5ths and 3rds. So I can make my starting note A2 instead of C2, and everything lines up without a hitch and without any code changes:

harmonictablea2

I tested it out with some seriously 80’s sounding FM pad, dragging across intervals, drawing random chord shapes in honeycomb patterns, etc. Here is a short output:

HarmonicTable Sample

As usual here are the updated files:

HarmonicTable
HexButton
NoteReference

Its a lot of fun, even though I can only play it with the mouse. Last step is to get a touch screen. Anyone want to donate one?

Processing HarmonicTable: Part 1

Earlier this year while reading Harmonic Experience by W. A. Mathieu, I was introduced to the concept of lattices to represent tones, chords and keys. These lattices can be used to represent the basics of music composition in a visual way that makes more sense than standard scales on staffs. Here is an example:

ChordLattice

The lattice is effectively several staffs of music stacked on top of each other, so that the note can be displayed horizontally and vertically. Starting from any note in the lattice, moving horizontally (diagonally right or left), jumps by a 5th (for example C to G, or G to D). Moving vertically jumps by thirds (C to E, or G to B). Since nearly all music is the construction of 5ths in 3rds, this system makes it easy to create patterns visually for chords, cadences, scales etc, that will always look the same no matter where you start on the lattice. In the example above, you can see that Major chords are always point up triangles, Minor chords are the opposite, point down.

Until recently this system didn’t translate directly to an instrument. Any chord on a keyboard will have similar but different fingerings and patterns depending on the starting note, so one still has to memorize a ton of different patterns for one scale, chord, or modulation.

A few weeks into reading Harmonic Experience, providence saw fit to lead me to the C-Thru AXiS controller. The AXiS is a Harmonic Table based midi controller that creates a table much like the lattice in Harmonic Experience, separating notes not in semi-tones like a keyboad, but by 5ths and 3rds (and of course many other inter-relationships based on this). Here is the layout of the AXiS: natural_keyboard If you look the relationships between the keys become clear. They are reversed from Mathieu’s lattice, 3rds are horizontal (diagonally), and 5ths are always straight up. To play a Major triad on the AXiS, just play that triangle pattern using starting at any key. C Major will have the same pattern as Bb Major, etc. There are of course drawbacks to this system (playing inversions, etc), but for the most part it accomplishes the goal of simplifying the muscle memory aspects of playing music so the user can concentrate on composition and performance. you learn the pattern for a scale, chord or mode only once, then you may modulate it anywhere without the need to retrain your fingers.

The problem with AXiS is the price tag. Its around $1700 for one from what I can tell, which is a pretty steep entrance fee for a device I may not be able to get used to. They are in the process of creating a cheaper smaller version, but I want to try it now. The solution was to build one in processing. I’ve only just started, but combining the midi reference classes I’ve been working on along with (eventually) a touch screen, I think I should be able to pull something off that works well enough for me to test this thing out.

I started by looking for ways to draw regular hexagons, and came across this site. With a some basic trigonometry and a lot of cut-and-try with the vertex functions, I came up with this function:

int length=30;
float a = length/2;
float b = sin(radians(60))*length;
float c = length;
public void drawHex(){
beginShape();
vertex(0,b);
vertex(a,0);
vertex(a+c,0);
vertex(2*c,b);
vertex(a+c,2*b);
vertex(a+c,2*b);
vertex(a,2*b);
vertex(0,b);
endShape();
}

This will construct a regular hexagon based on the length of one side.

After that I used a series of translation matrices to draw them all over the screen:

public void draw(){
rowNumber=0;
setNoteNumber(rowNumber);
for (int j=2; j<20; j++){ pushMatrix(); translate(0+space, (height-(j*(b+space/2)+1))); drawHex(getNextNote()); for (int i=1; i <12; i++){ translate(space+(2*a)+(2*c), 0); drawHex(getNextNote()); } popMatrix(); j++; rowNumber++; setNoteNumber(rowNumber); pushMatrix(); translate(a+c+1.5f*space, (height-(j*(b+space/2)))); drawHex(getNextNote()); for (int i=1; i <12; i++){ translate(space+(2*a)+(2*c), 0); drawHex(getNextNote()); } popMatrix(); rowNumber++; setNoteNumber(rowNumber); } } [/sourcecode] I predefined the number of horizontal hexagons to 12 for each row, this means that STRAIGHT horizontally across a row I will have a perfect chromatic scale. The number of vertical keys I simply copied from the AXiS.After predefining the number of columns and rows, it meant that I could construct the size of the screen based on the length of one side of the hexagon. I also included a variable that allows me to declare an amount of fixed space in between the keys (in case my fingers are too big for the key's surface). One variable, named length, can be changed to create a bigger surface with larger keys. After implementing some simple code to write the note name into the key as well, I was finished with the layout. Here is a snapshot of it directly out of processing: Virtual Harmonic Table

Its of course much bigger. With the key surface complete now all I have to do is map the key locations to the midi note they’re associated with, and use some on press functions to trigger them. After that I just need to get access to a touch screen, anyone want to donate one?

Here is the preliminary code to draw the hexagons, as well as the code required to map midi notes:

HarmonicTable
NoteReference

In Part 2 I’ll have have midi functionality implemented and some testing done.

In Part 3 I’ll have it implemented with a touchscreen, most likely a laptop, at that point I’ll make the rest of the code available.