trackpad_synth icon indicating copy to clipboard operation
trackpad_synth copied to clipboard

Make music with a macbook trackpad

Trackpad synth

Program to generate SKINI or MIDI data from a macbook trackpad.

Binary Installation (use this if you're not sure)

Download the disk image for snow leopard (10.6):

https://github.com/downloads/jeffkaufman/trackpad_synth/multitouch_midi_v1.dmg

Open it, drag to applications. Double click on it to run.

You need something to turn my program's midi signals into sound. SimpleSynth is good:

http://notahat.com/simplesynth

Download, install, run. Once it's running, select "touchpad" under "MIDI Source" and you should hear this play!

Source Installation

Choose either MIDI, SKINI, or Octaveless output. MIDI lets you choose from more and better voices, SKINI lets you write new voices with the stanford toolkit, Octaveless doesn't have octaves.

MIDI

See the note on SimpleSynth above.

SKINI

Get a SKINI reader. I've been using the Standford Synthesis Toolkit. You can download it from:

http://ccrma.stanford.edu/software/stk/release/stk-4.4.2.tar.gz

Unzip it, run "./configure" and "make" in the stk directory.

Check that it's working:

cat stk-4.4.2/projects/demo/scores/test.ski | stk-4.4.2/projects/demo/demo Clarinet -or -ip

You should hear something.

Put the stk folder paralell to our test.m and Makefile.

Octaveless

Get octaveless from:

https://github.com/jeffkaufman/octaveless

Build it (requires port audio) and check that it works as:

gcc -o octaveless octaveless.c -lportaudio -Wall echo A | ./octaveless

You should hear something; kill it with Ctrl+C.

Copy the octaveless binary to this directory

cp /path/to/octaveless .

Once you have MIDI, SKINI, or Octaveless working, in this directory run one of:

for midi

make ./trackcontroller [options]

for skini

make runskini

for octaveless

make runoctaveless

for midi, simple

just double click on the trackcontrol command line program

Kill it with control C when you're done. It puts midi on channel 3, so that's the one you'd twiddle settings for. Options are:

Usage: trackcontroller [options]

Options: -k [KEY] Play in the given key. Allowable keys are 'A'-'G' followed by an optional '#' or 'b'. Default is D. -H Harmonic minor mode -r Relative/natural minor mode -x Mixolidian mode -K A Klezmer mode (flat 2, sharp 6) -5 Pentatonic scale -C [nnn] Specify scale (ex: '024579B') -S Send SKINI to stdout instead of MIDI from a virtual source. -V Use the far left of the controller as a volume control. -o [N] Divide the trackpad vertically into this many octaves. Default is 5. -s [N] Octave Shift: how far down to shift from the top of our range. Default is 3. -v Use velocity. When pressing keys, set midi velocity to the finger width detected on the trackpad. -a Send aftertouch midi messages based on how fat each finger is -c [N] Send on channel N. Default is 3. -p Send channel pressure messages based on how fat all the fingers are on average, -P Fake channel pressure using volume instead. -h Print this usage.

(run "./trackcontroller -h" for the most up to date usage info)

Usage

There are 5 rows (-o option) each of which has a major scale (change 'scale') of 7 notes. It's polyphonic, so move your fingers around. If using midi output, it can do velocity, aftertouch, channel pressure, and a kind of faking channel pressure by setting the volume, all depending on how much of your finger is in contact with the pad (and if your midi synthesizer supports it). These are off be default and can be enabled with the -v, -a, -p, or -P options.

If you don't want a major scale, the -h, -r, -x, and -K options choose other scales; see above. You can also specify arbitrary scales with -C. The format is:

./trackcontroller -k C -C 0123456789AB

This would make a fully chromatic trackpad starting on C (with even divisions). To leave notes out, don't include their numbers:

./trackcontroller -k C -C 024579B

This would include the notes of the major scale. You can make sections wider by repeating them:

./trackcontroller -k C -C 0057

This would divide the pad with the left half sounding 'C' and the right half divided into 'F' and 'G'.

Misc

Started with multitouch code from: http://www.steike.com/code/multitouch/

For writing midi output I used the source of vmpk as a guide: http://vmpk.sourceforge.net/

All code gpl