Jam Session at home

On a Sunday afternoon, fifteen friends, all non musicians but two amateur musicians, joined the machines set in turn, around 8 at a time, to improvise electro or hip-hop rhythmic grooves. Of course there were food and drinks as well.

The goal was to introduce music making in an attractive way: no pressure, no constraint, no reason to be shy, just have fun!

Don’t be shy

Some arrived saying “no no no I will never sing in the mike”, but ended up doing the mike to record voice loops into the Kaoss Pad… Other spent time to figure out how to play something musical from machines they were touching for the first time. It was amazing how everybody got into it!

Here is a time lapse overview, unfortunately silent:

Jam Session at home with friends from cyrille martraire on Vimeo.

The machines setup

The machine set was primarily composed of an Akai MPC500 with various programs (drums, stabs, acapella chops, etc.), a Korg Kaoss Pad 3 with an Shure SM58 mike and a Korg microKorg, all MIDI clock-ed together, and all mixed into a Yamaha MG12/4 with a Boss SE-70 reverb send. There were also a 49-keys Casio keyboard and a Yamaha SHS10 mini handheld keyboard, both used as MIDI controllers to drive an EMU Turbo Phatt. Various circuit-bent toys were also pre-mixed and then fed into the Kaoss Pad as well, to get the best out of them.

Every machine has its own appeal: the Kaoss Pad 3 is the most appealing at first, but then it gets more difficult to master. The microKorg, thanks to its sync-ed arpeggiator and its modulation wheel is also rewarding very quickly. The MPC is somehow harder since you must be rather accurate when playing for the rhythm to sound good. The EMU Phatt is very easily rewarding, especially when using the Beats programs or other programs made of several sounds laid over the keyboard.

Fun or accurate: this is the question

One note about loops, either on the Kaoss Pad or in the MPC: if they help to improve the accuracy of the music (repeats perfectly each time), they also kill a lot of fun out of it since you only have to play once, record, and then you are done! On the other end, playing repeatedly the same thing (or at least trying to) helps to get warmer and warmer!

Thanks all for joining us for this party, and see you for next time!

Thanks Lai for the beautiful b&w picture!

Read More

(Arduino) Interactive Generative Sequencer

Following my ongoing work on a theory of rhythms and a corresponding physical instrument using lasers, here is a version of the same idea implemented into an Arduino: a generative sequencer. The idea is to generate rhythms, and perhaps melodies, from one rhythm seed, then use mutated copies of it to create something more interesting, all this in realtime using knobs and buttons.

This is not ‘yet another step sequencer’, but really a generative music device, that builds a real time MIDI loop based on an underlying theory described in a previous post.

This is work in progress, and is shown ‘as is’ for the sake of getting feedback.


The approach is to generate a “seed” of rhythm that is then copied a few times into “instances”, each instance being distorted in its own way. The controls for the human player (or programmer) are therefore all about adjusting the deformations (transforms actually) to apply to each instance, and of course defining the seed.

Eventually each instance is wired to a MIDI note, channel etc. to remote control a synthesizer or a drum machine or any MIDI setup, to generate actual sounds.

Principle: one seed, many transformed instances
Principle: one seed, many transformed instances

The maths

Given a seed of rhythm of lengh length composed of pulses, each of duration m, then:

for each instance k of the seed, each pulse i,
pulse(k, i) happen at time t = phase(k)  + i . m . stretch(k), t < length
where phase(k) and stretch(k) are the phase and stretch settings for the instance k.

Realtime control of the sequencer is therefore all about setting the phase and stretch values for each instance, once the pulse number and the pulse duration of the seed have been globally set.

Inversely, for a given instance k, at time t, we have a pulse if:

there exists an i, such as t = phase(k) + i * m * stretch(k)
i.e. i = (t - phase(k))/(m * stretch(k))

In other words, if

(t - phase(k))/(m * stretch(k)) is integer
(i.e. numerator % denominator == 0)

Thinking in MIDI ticks (24 per quarters), in 4/4, for 1 bar, length = 4 * 24, phase is in [-24 .. 24] and stretch is in [4:1 .. 1:4] and m in [12 .. 48] by steps of 12 ticks.

The implementation is the very simple: for each instance of the seed, and given its phase and stretch settings, whenever the modulo condition above is true, then we emit its MIDI note, with the set velocity on the set MIDI channel.

As usual, the pace of the loop is primarily based on the value from the Tempo potentiometer.

Overview of the circuit
Overview of the circuit, with the switches and the knobs

Adding some swing

8th note swing
8th note swing

The EMU SP-1200, early Linn machines, Roland 909, Akai MPC and many other machines are famous for their swing quantize, a feature that delays every other note by a certain amount in order to create a groovy feeling (see Swung Note).

Different machines express the swing factor in different ways, we will stick to the MPC format, expressed in percent from 50% (no swing, play straight) to 75% (hard shuffle).

For a swing for 8th notes, this swing factor represents the ratio of the period of the first 8th note over the period of the second 8th note, in percent.

In the Arduino code of our generative sequencer, we chose to do a fixed swing for 8th notes only.

A big constraint is that we are limited to a resolution of 24 ticks per quarter note, which is not a lot! By contrast, MPC have a 96 ppq resolution. Because a hard swing of 70% translates into hardly 2 MIDI ticks at 24 ppq, doing the swing on top of the ticks will not be accurate at all!

The only solution is to vary the internal tempo before and after each 8th note. The drawback (or advantage) is that the MIDI clock being sent will also move, reflecting the same swing. Since the Swing knob value is actually between 0 and 25 (to be read from50% to 75%), the tempo before (t-) and the tempo after (t+), are given by:

t+/- = (50 +/- swing) * t / 50
where t is the base loop period without swing

Video Demo

Here is a video demo. There are only 3 instances, selected by the switches 1, 2 and 3; the first switch selects the GLOBAL settings: step duration (quarter, 8th etc.), swing factor, tempo. Each instance can be set its Phase, Stretch, MIDI note, velocity and MIDI channel. Here I have preset the MIDI channels, instance 1 on channel 1 (the microKorg) and instances 2 and 3 on channel 2 (the MPC with a drum kit).

The goal is to build a simple beat by only adjusting the parameters.

(Arduino) Interactice Generative Sequencer from cyrille martraire on Vimeo.

The code

You can download the Arduino project here: generativesequencer1; below is the same source code for convenience. The code includes the knob pagination described in a previous post.

Please note that some parts of the code are not used any more, such as the big constant arrays, and some comments are not up to date (e-g no prime number anymore).

All analog inputs are wired to simple knobs. Digital inputs 8, 9, 10 , 11 are the four buttons used to switch pages. Digital output 12 is the activity LED (showing when the knob is active within the knob pagination). MIDI out is on the Tx pin.

 * Generative rhythm sequencer, more details at: http://cyrille.martraire.com
 * Knob mapping according to a grid 2^n . prime^m, against the MIDI 24 ticks/quarter.
 * Knob pagination to multiplex the knobs several times with LED to show activity.
 * Memory-less event handling thanks to maths relationships.
 * MIDI note on output on every 16 channel and MIDI clock according to tempo.
 * Creative Commons License Cyrille Martraire cyrille.martraire.com
int debug = false;
//---------- USER INPUT AND PAGINATION -----------
#define PAGE_NB 4
#define KNOB_NB 6
#define PROTECTED -1
#define ACTIVE 1
#define SYNC_LED 12
// the permanent storage of every value for every page, used by the actual music code
int pageValues[PAGE_NB][KNOB_NB];
// last read knob values
int knobsValues[KNOB_NB];
// knobs state (protected, enable...)
int knobsStates[KNOB_NB];
// current (temp) value just read
int value = 0;
// the current page id of values being edited
int currentPage = 0;
// signals the page change
boolean pageChange = false;
//temp variable to detect when the knob's value matches the stored value
boolean inSync = false;
// ---------- KNOBS CALIBRATION AND MAPPING ---------
// rhythmic scale, to select globally
int scale2[] =  {1, 2, 3, 6, 6, 12, 12, 24, 24, 48, 48, 96, 192, 384, 768};
int scale3[] =  {1, 2, 3, 6, 9, 12, 18, 24, 36, 48, 72, 96, 144, 384, 768};
int scale5[] =  {1, 2, 3, 6, 12, 15, 24, 24, 30, 48, 60, 96, 120, 384, 768};
int scale7[] =  {1, 2, 3, 6, 12, 21, 24, 24, 42, 48, 84, 96, 168, 384, 768};
int scale9[] =  {1, 2, 3, 6, 12, 12, 24, 24, 27, 48, 54, 96, 108, 384, 768};
int scale11[] = {1, 2, 3, 6, 12, 12, 24, 24, 33, 48, 66, 96, 132, 384, 768};
//int scale13[] = {1, 2, 3, 6, 12, 24, 12, 24, 39, 48, 78, 96, 156, 384, 768};
int maxValue = 890;
int scaleLen = 15;
int *scale = scale3;
int step = 60;
int center = 30;
int coeff = 10;
//---------- GENERATIVE MUSIC CODE ---------
unsigned int cursor = 0;
int bars = 1;
int length = bars * 4 * 24;
int PHASE = 0;
int STRETCH = 1;
//int DIRECTION = 2;
int NOTE = 2;
int DURATION = 3;
int VELOCITY = 4;
int CHANNEL = 5;
// GLOBAL KNOBS (seed and global settings)
int seedDuration = 24;
int seedTimes = 8;
int instanceNb = 4;
int swing = 0;//0..25% (on top of 50%)
int loopPeriod = 125/6;//120BPM
int actualPeriod = loopPeriod;
//instance i
int phase = 0;
int stretch = 1;
int note = 48;
int duration = 24;
int velocity = 100;
int channel = 1;
void setup(){
   Serial.begin(19200); //debug
  } else {

  pinMode(13, OUTPUT);


void setupKnobMapping(){
  step = maxValue / scaleLen;
  if (step * scaleLen < maxValue) {
  center = step / 2; // for phase only
  coeff = step / 8; // +/-3 ticks, for phase only

void loop () {

    //TODO partition inputs reading every other cycle if required by CPU load


    // parameters for each instance (pages 1 to 3)
    for(int index = 1; index < instanceNb; index++){

    cursor = cursor % length;
void poolGlobalSettings(){
    // global parameters
    seedDuration = mapC(pageValues[0][0], maxValue, 1, 4) * 12;
    seedTimes = mapC(pageValues[0][1], maxValue, 1, 16);
    instanceNb = 4;//mapC(pageValues[0][2], maxValue, 1, PAGE_NB);
    // = mapC(pageValues[0][3], maxValue, 1, PAGE_NB);
    swing = mapC(pageValues[0][4], maxValue, 0, 25);
    loopPeriod = mapC(pageValues[0][5], maxValue, 63, 2);// 12.5 ms - 62.5
    if (cursor % 24 <= 12){
      actualPeriod = (50 + swing) * loopPeriod / 50;
    } else {
      actualPeriod = (50 - swing) * loopPeriod / 50;
    //TODO prime number selection and scale switch
// custom map function, with min value always 0, and out max cannot be exceeded
long mapC(long x, long in_max, long out_min, long out_max)
  if (x > in_max) {
    return out_max;
  return x * (out_max - out_min) / in_max + out_min;
void processSeeInstance(int * params){
  phase = mapC(params[PHASE], maxValue, 0, 24);
  stretch = mapC(params[STRETCH], maxValue, 0, 4);
  stretch = pow(2, stretch);// 4:1 to 1:4, in fourth
  note = mapC(params[NOTE], maxValue, 36, 48);
  //duration = mapC(params[DURATION], maxValue, 6, 96);
  velocity = mapC(params[VELOCITY], maxValue, 0, 127);
  channel = mapC(params[CHANNEL], maxValue, 0, 4);

  if(isPulse(phase, stretch)) {
     noteOn(channel, note, velocity);
// for each instance, and for the given cursor, is there a pulse?
boolean isPulse(byte phase, byte stretch){
  int num = cursor - phase;
  int denum = seedDuration * stretch / 4;
  return num % denum == 0;
// Sends a MIDI tick (expected to be 24 ticks per quarter)
void midiClock(){
  Serial.print(0xF8, BYTE);
//  plays a MIDI note for one MIDI channel.  Does not check that
// channel is less than 15, or that data values are less than 127:
void noteOn(char channel, char noteNb, char velo) {
   midiOut(0x90 | channel, noteNb, velo);
//  plays a MIDI message Status, Data1, Data2, no check
void midiOut(char cmd, char data1, char data2) {
   Serial.print(cmd, BYTE);
   Serial.print(data1, BYTE);
   Serial.print(data2, BYTE);
void setupPagination(){
  pinMode(SYNC_LED, OUTPUT);
  for(int i=0; i < KNOB_NB; i++){
    knobsValues[i] = analogRead(i);
    knobsStates[i] = ACTIVE;
// read knobs and digital switches and handle pagination
void poolInputWithPagination(){
  // read page selection buttons
     value = digitalRead(i);
     if(value == LOW){
         pageChange = true;
         currentPage = i - FIRST_PAGE_BUTTON;
  // if page has changed then protect knobs (unfrequent)
    pageChange = false;
    digitalWrite(SYNC_LED, LOW);
    for(int i=0; i < KNOB_NB; i++){
      knobsStates[i] = PROTECTED;
  // read knobs values, show sync with the LED, enable knob when it matches the stored value
  for(int i = 0;i < KNOB_NB; i++){
     value = analogRead(i);
     inSync = abs(value - pageValues[currentPage][i]) < 20;

     // enable knob when it matches the stored value
        knobsStates[i] = ACTIVE;

     // if knob is moving, show if it's active or not
     if(abs(value - knobsValues[i]) > 5){
          // if knob is active, blink LED
          if(knobsStates[i] == ACTIVE){
            digitalWrite(SYNC_LED, HIGH);
          } else {
            digitalWrite(SYNC_LED, LOW);
     knobsValues[i] = value;

     // if enabled then miror the real time knob value
     if(knobsStates[i] == ACTIVE){
        pageValues[currentPage][i] = value;
void printAll(){
     Serial.print("page ");

     //printArray(knobsValues, 6);
     //printArray(knobsStates, 6);

     for(int i = 0; i < 4; i++){
       printArray(pageValues[i], 6);
void printArray(int *array, int len){
  for(int i = 0;i< len;i++){
       Serial.print(" ");

Read More

Music Production Patterns

Here is a collection of tips and tricks to produce current popular genres (Hip-Hop, House and Electro in particular) found freely on the Internet, and presented into the pattern form.

The pattern form

This means each trick or set of related tricks is given an expressive name along with a short description of its intent. Full description of each pattern is left out, as it would represent a rewriting of many sources (I have no time for that), but links to the full source material are given at the bottom in the references section.

Of course this is only useful if you already know what it is about, and should be considered more as a reminder.

Arranging a tune

At the top level of a tune structure, we deal with the arrangement.

  1. Anticipation and Surprise: create anticipation and surprise: Build-ups (Snare Rolls, Reverse Crash, Filter Opening, Synth Fx, Accelerating LFO, Pitch Glide), Breakdowns (drop parts, close filter)
  2. Playing The Studio: allow for spontaneous action in the studio, e-g. Dub-Style (mixer, reverb send, effect send, use of feedback)
  3. Round Trip Creation (e-g. beat first, lyrics, then back to beat to optimize with the vocals)
  4. Question-Answer: Q/A relationship to sustain a tension: Q (lyrics) – A (riff); see also Da Capo, Ternary Form
  5. Useful and insightful definitions:
    1. Vibe: inspiration for a tune, the focus throughout the song (vocal, sound, chord progression…); can be found before or after a beat is created
    2. Character: anything that is highly distinctive (sounds, voice, filter effects, fills, sweeps…)
    3. Energy: drums, bass, and riffs (arp, synth, guitar…) driving the tune

A typical project studio
A typical project studio

Make It Believable

Sometime we want to achieve realism, sometime we do not want to, but there is always a need to be realistic in some way, even in a virtual musical world.

  1. Layer, Layer, Layer: no simple sound, layer similar sounds to make them richer and more complex
  2. Ambiance: Preserve or re-create ambiance (Overhead miking, Parallel Compression…)
  3. Altered Background: sounds in the back should have some reverb and high frequencies attenuated
  4. Possible for a Performer: the performer could possibly do that (or not if we want artificial feeling)
  5. Tone Matching (compatible sounds, physically or for the genre)

Groove and Feel

Getting a strong groove is key to a good tune.

  1. First Beat Straight and Loudest
  2. Primary Beats Louder (than secondary beats)
  3. Swing: play offbeats late, from straight to triplet feel
  4. Silence Matters: make sure there is silence between hits (use Gating, Side Chain Compressor, Manual Edit in the DAW, Adjust Decay)
  5. Dragging or Rushing: make other beats late or early
  6. Evolving Dynamics (through velocity, modulation, filter or sample start modulation)
  7. Layer Beats: Backbeat, Polyrhythm, Ghost Notes
  8. Sync to Tempo: Sync everything (arpeggiator, effects, lfos) to tempo or to some multiple of the tempo (via MIDI or manually)
  9. Notes Duration Matter: the funky bass, it’s in the notes duration

Sound Design

For more character, a tune needs unique and special sounds

  1. Happy Accident: make sure happy accident can still happen, and Record Everything
  2. Unlimited Combinations: Combine Everything to Everything (Compressor, Filter, Effects, Automation, Instruments…)
  3. Extreme Processing: Pitch Shift, Reverse, Audible Looping, Glitch, Overdrive
  4. Uncommon Devices: Circuit Bending, Domestic things that make sounds, exotic spaces to record in
  5. Hybridate Audio Features: (Extract-Promote): extract sample part then loop it as the oscillator in a synth, extract convolution profile then apply it to another sound, extract FFT spectrum or RMS envelope to apply it to another sound etc.
Using a musical toy for special sounds
Using a musical toy for special sounds

Keep it Simple (The Enough Repetition Rule)

  1. Four Hooks Maximum: do not confuse the listener with too many distinct things
  2. Reuse With Variation: it is OK to use again and again the same hook provided it is slightly changed to make it less obvious and boring
  3. Attractive or Complementary: some tracks must attract attention, other tracks must not compete for attention
  4. KISS: Keep it simple (but no simpler): stick to simple melodies, riffs and chords progressions

Keep It Interesting (The Enough Variation Rule)

  1. Alternate Sounds (Alternate Claps, Samples switched by velocity etc.)
  2. Modulations (Sample Start Modulation, Automation of whatever)
  3. Effects, Triggered Effects (via automation)
  4. Widen Stereo: Hard Pan, Haas Effect (Hard Pan With 15-60ms Delay), Stereo Modulation Effect (Chorus etc.)

A ProTools Session during mixing
A ProTools Session during mixing


We’ll fix that in the mix.

  1. The Drum and Bass Backbone: Get them right and solid first
    1. Exclusive Frequencies: boost one, cut the other by the same amount on the same frequency
    2. Exclusive Timing: if possible, if one plays, the other should be silent; variations involve using Side Chain Compressor or Gating
  2. Tune Drums: tune low-end drums and percussion sounds to the root tonic note to avoid very low frequency beats
  3. Sound Substitution: if it cannot sound good, change the sounds
  4. Frequency Separation: reduce clutter with sounds frequencies not overlapping too much
  5. The usual traps: Phase & Mono (phase issues result in Comb filter effects or phase cancellation; clubs are more or less mono)
  6. Create Space (aka Multidimensional Mix): Left, Right, Foreground and Background: Stereo Placement, Damp Highs, Delay + Pan
  7. Less is More, know when to cut something
  8. Mixing Order Priorities: e-g. for Hip-Hop: D&B first, Vocals, then other tracks
  9. Mixing Panning Priorities: most important tracks centered, the rest panned around
  10. Sub Mixes: drums, leads & vocals, the rest, or drums, bass, the rest
  11. Mix down several mixes: Main Mix, Raised Vocals Mix (lead and back vocals +1dB), Lowered Vocals Mix, TV Live Mix (no lead vocals), Instrumental Mix (for promotion)
  12. Mixing for the genre and the goal: More extreme for clubs, more “tone-down” for radio…

Other Techniques

  1. Side Chain Compressor: consider using a separate track to trigger the side chain for more control
  2. Automate level on basses that play too many notes with a different level
  3. Widening stereo for drums: add background kick with reverb and less highs, add stereo claps
  4. Tips to enhance background vocal:
    1. Add Silk: hipass filter >900Hz
    2. Add Sheen: boost 11-12KHz 1-4dB
    3. Heavier effects than lead vocals: subtle ping pong stereo delays, hall reverb, plate reverb, and choruses
    4. Multiple Takes: double, triple, stacking harmonies: For example, pan low vocal/harmony tracks hard left & right. Next, pan medium vocal/harmony tracks 75% left & 75% right. Lastly, pan high vocal/harmony tracks 40% left & 40% right.
  5. Compressor: (too many resources on that one…, typical gain reduction: 10-15dB)
  6. EQ: (too many resources as well), Cut or Boost?


Read More

Geometric Rhythm Machine

In the post Playing with laser beams to create very simple rhythms” I explained a theoretical approach that I want to materialize into an instrument. The idea is to create complex rhythms by combining several times the same rhythmic patterns, but each time with some variation compared to the original pattern.

Several possible variations (or transforms, since a variation is generated by applying a transform to the original pattern) were proposed, starting from an hypothetical rhythmic pattern “x.x.xx..”. Three linear transforms: Reverse (”..xx.x.x”), Roll (”x.x.xx..”) and Scale 2:1 (”x…x…x.x…..”) or 1:2 (”xxx.”), and some non-linear transforms: Truncate (”xx..”) etc.

Geometry + Light = Tangible transforms

The very idea behind the various experiments made using laser light beams and LDR sensors is to build an instrument that proposes all the previous transforms in a tangible fashion: when you move physical object, you also change the rhythm accordingly.

Let’s consider a very narrow light beam turning just like the hands of a clock. Let’s suppose that our clock has no number written around, but we can position marks (mirrors) wherever on the clock surface. Still in the context of creating rhythms, now assume that every time a hand crosses a mark (mirror) we trigger a sound. So far we have a rhythmic clock, which is a funny instrument already. But we can do better…

Going back to our rhythmic pattern “x.x.xx..”, we can represent it with 4 mirrors that we position on a same circle. On the illustration below this original pattern is displayed in orange, each mirror shown by an X letter.. If we now link these 4 mirrors together with some adhesive tape, we have built a physical object that represents a rhythmic pattern. The rotating red line represents the laser beam turning like the clock hands.

Illustration of how the geometry of the rhythmic clock physically represents the transforms
Illustration of how the geometry of the rhythmic clock physically represents the transforms

Now we have a physical pattern (the original one), we can of course create copies of it (need more mirrors and more adhesive tape). We can then position the copies elsewhere on the clock. The point is that where you put a copy defines the transform that applies to it compared with the original pattern:

  • If we just shift a pattern left or right while remaining on the same circle, then we are actually doing the Roll transform (change the phase of the pattern) (example in blue on the picture)
  • If we reverse the adhesive tape with its mirrors glued on, then of course we also apply the Reverse transform to the pattern (example in grey on the picture)
  • If we move the pattern to another (concentric) circle, then we are actually applying the Scale transform, where the scaling coefficient is the fraction of the radius of the circle over the radius of the circle of the original pattern (example in green on the picture)

Therefore, simple polar geometry is enough to provide a complete set of physical operations that fully mimic the desired operations on rhythmic pattern. And since this geometry is in deep relationship with how the rhythm is being made, the musician can understand what’s happening and how to place the mirrors to get any the desired result. The system is controllable.

To apply the Truncate transform (that is not a linear transform) we can just stick a piece of black paper to hide the mirror(s) we want to mute.

If we layer the clock we just described, with one layer for each timbre to play, then again changing the timbre (yet another non-linear transform) can then be done by physically moving the pattern (mirrors on adhesive tape) across the layers.

From theory to practice

Second prototype, with big accuracy issues
Second prototype, with big accuracy issues

Though appealing in principle, this geometric approach is hard to implement into a physical installation, mostly because accuracy issues:

  1. The rotating mirror must rotate perfectly, with no axis deviation; any angular deviation is multiplied by two and then leads to important position deviation in the light spot in the distance: delta = distance . tan(2 deviation angle)
  2. Each laser module is already not very accurate: the light beam is not always perfectly aligned with the body. To fix that would require careful tilt and pan adjustment on the laser module support
  3. Positioning the retroreflectors in a way that is accurate and easy to add, move or remove at the same time is not that easy; furthermore, even if in theory the retroreflectors reflect all the incoming light back to where it comes from, in practice maximum reflectance happens when the light hits the reflector orthogonally, which is useful to prevent missed hits

Don’t hesitate to check these pages for progress, and any feedback much appreciated.

Read More

Rhythmic clock machine

The rotating mirror and the 4 laser beams
The rotating mirror and the 4 laser beams

I finally received ten retroreflectors, the experiments started in Playing with laser beams to create very simple rhythms”, we can now move on.

Once again, the rotating mirror is reflecting the four parallel laser beams so that they sweep a 180 degrees area, where some retroreflectors are positioned to hit the beams trajectories.

Every time a beam hits a reflector then it should trigger a sound on a MIDI synth (here it is my little microkorg playing the sounds).

Generative music (a.k.a mangled rhythm)

However in the first try I forgot to set a short loop perid (the period was set to 100ms). Given the velocity of the laser beam when it hits the reflectors there is very little time to catch the signal on the sensors, and with a measure every 100ms the Arduino is missing most hits.

This means we got a simple and regular theoretical rhythm that is mangled by the input sampling process, and this fuzzyness actually creates “interesting” generative music, as in the video:

Generative music installation with laser beams and low-frequency sensors sampling from cyrille martraire on Vimeo.

Note that it is not totally random… (actually it is not random at all, just the result of different frequencies that sometime are in sync and most times are not).

Laser beams on the wall
Laser beams on the wall

Regular rhythm at last

With a shorter Arduino loop period (10ms) it becomes reliable: every (almost) hit triggers a note, as illustrated in the next video where we can hear a steady rhythmic pattern.

The Arduino code is quite simple: for each of the 4 sensors, read analog value, compare to threshold, debounce (not to send multiple notes for the actual same hit), then send MIDI note.

Arduino code for the rhythmic clock project

Laser beams generate regular rhythm at least from cyrille martraire on Vimeo.

Any feedback welcome…

Read More

Musical instruments for musicians and non-musicians: Put into practice

Other posts in the series Musical instruments for musicians and non-musicians:

  1. Part One: Controls: Analysing how continuous or discrete controls on the sound affect playability to great extent
  2. Part Two: Constraints: How embedding musical theory as constraints makes the instrument easier and more rewarding
  3. Part Three: Exotic examples: Examples of exotic instruments and how they achieve good or not so good results
  4. Part Four: Put into practice: Let’s put theory into practice to build an easy and musically-sounding Theremin

Now we want to put that into practice to build a musical instrument. Let’s consider we want to do something inspired by the Theremin, but simpler to play and more funny to look at while easier to build as well.


Here is now a case study: We want to build an instrument that must be:

  1. Playable by friends that know very little in music: in other words really easy to play
  2. Attractive for friends that enjoy the fun of playing and jamming together: must be expressive
  3. Suitable for groovy electronic music (house, hip-hop, electro, acid-jazz, trip-hop and a bit of techno)
  4. Able to participate within a small band among other instruments, mostly electronic machines
  5. With a funky look and visually attractive when performing

Design and justification

The finished instrument
The finished instrument

Based on these requirements, and after some trials and error we go for the following:

  1. Finger physical guidance, because it is too hard to keep hands in the air at the same position (req. 1)
  2. Bright leds plus light sensor as a primary way of playing, for the funky look and visually attractive performance (req. 5)
  3. Discrete pitch as primary way of playing, with pitch quantization against a pentatonic scale, easy, good sounding (but coupled to one fixed tonality unless putting configuration buttons) (req. 1)
  4. Expression on the pitch when a note is pressed send pitch bend events to modulate the pitch as on a guitar  or real theremin; this only happen after a note is pressed, not to conflict with the primary pentatonic scale (req. 2)
  5. Allows for additional expression using a distinct light sensor mapped to a Midi Continuous Controller (controller 1: modulation wheel) (req. 2)
  6. Continuous rhythm control to start the project simply, plan to quantize it on 16th notes according to a midi clock later (tradeoff to keep simple right now, should be even simpler due to req. 1)
  7. MIDI controller rather than integrated synthesizer to allow for very good sounds generated from external professional synthesizers (req. 3)
  8. Internal scale setup within the range between C3 and C5, to dedicate the instrument to play solo on top of an electronic rhythm (req. 4)
  9. Arduino implementation (easy to implement pitch quantization logic and expression controls)


The very simple circuit
The very simple circuit
The Arduino board
The Arduino board
  • An aluminium rail (from a DIY shop) is fixed to an empty salt box as the body (hence the name “Salty Solo”)
  • A LED (from Booxt) slides on the rail
  • The main sensor and the expression sensor are two simple LDRs connected through a voltage divider to two Arduino analog inputs
  • Two buttons are simply connected to two Arduino digital inputs.
  • The MIDI out DIN plug is connected to the Arduino Tx pin.
  • The rest is in the Arduino software!

I have decorated the salt box with adhesive stuff…

Playability and fixes

At first try, playing the Salty Solo is not that easy! A few problems happen:

  1. Reaction time (or “latency”) is not good
  2. Moving the light with the left hand is not very fast, hence impedes playing a melody that sounds like one.
  3. Also there is a kind of conflict between the note quantization that does a rounding to the closest accurate note, and the expression control that allows to “bend” notes.

The first problem has been solved by increasing the Arduino loop frequency down to 100Hz (wait period = 10ms); to prevent sending MIDI continuous controller and MIDI pitch bend too often we therefore needed to send them (when needed) once out of a few loops.

For the second problem a workaround has been done by using the second button to trigger the next note in the scale, and pressing both buttons together triggers the second next note in the scale. Basically, in the (almost) pentatonic scale we use this usually means jumping to the third or to the fifth. This kind of jump is very common when playing guitar or bass guitar thanks to their multiple strings, and it does help play faster while moving the left hand much less. With two buttons like this it is much easier to play melodic fragments.

The last problem has been solved a bit randomly: because of a bug in the code, the pitch bend only happen when on the highest note: this saves the most useful case of playing the guitar hero on a very high note while bending it a lot. On the other notes, sliding the left hand descend or ascend the scale instead. Further playing and external opinions will probably help tweak this behaviour over time.

Here is the Arduino source code for Salty Solo

Here is a video to illustrate how it works…

Experimental instrument for musicians and non-musicians from cyrille martraire on Vimeo.


Other CC that could be used (however the modulation wheel can also control the same parameters, on a program by program basis on a synth):

  • 1 Modulation Wheel or Joystick (positive polarity) (MSB)  Can be effectively remapped to other controllers on some synth
  • 7 Volume (MSB)  If you re-route to Controller 7, your software mixer will mess up
  • 71 Resonance (aka  Timbre)
  • 74 Frequency Cutoff (aka  Brightness )

And the panic button: 123 All Notes Off

Read More

Musical instruments for musicians and non-musicians: Constraints

Other posts in the series Musical instruments for musicians and non-musicians:

  1. Part One: Controls: Analysing how continuous or discrete controls on the sound affect playability to great extent
  2. Part Two: Constraints: How embedding musical theory as constraints makes the instrument easier and more rewarding
  3. Part Three: Exotic examples: Examples of exotic instruments and how they achieve good or not so good results
  4. Part Four: Put into practice: Let’s put theory into practice to build an easy and musically-sounding Theremin

How can we design musical instruments that both musicians and non-musicians can play and enjoy?

In the previous part of this series, we stated that a musical instrument must provide “A way for musicians and non-musicians to make music easily: musical assistance“.

We will focus on that point in this post.

In the previous post, when discussing the various controls an instrument provide to make music, we already noted that discrete controls were easier to use, since they automatically enforce to play in tune or in rhythm; this was already a simple case of musical assistance.

The ideal instrument

Out of every possible arrangement of sounds, very few can be considered music. Therefore, a tool that could make every possible musical sounds and no non-musical sound would be the ideal instrument.

Such an instrument would have to be very smart and understand what music is. It would have to be playable as well. This instrument probably cannot exist, but designing an instrument is about trying to go there.

Empower the tools so that they can empower the user: towards instruments that always play in tune

The more we can understand what music is, and more specifically what it is not, the more we can embed that understanding into the instrument so that it can assist the player by preventing non-musical events. Preventing non-musical sounds helps the non-musician, while loosing no freedom (or very little) for the expert musician.

To illustrate that approach, let us consider a simplified musical system made of an infinity of notes. If we know that we want to play Western music, we know we can reduce our notes set down to 12; if we know we want to play in the Blues genre, then we know we will only use 6 notes out of this 12 notes set; if we know that our song is in minor A then we know which 6 notes we will only need. Going further, if we know we want to play a walking bass line, we might end up with only 3 playable notes: the task of playing has become much simpler!

This idea already exist de facto in the form of the “black keys only” trick: the subset of black keys on the piano keyboard forms a pentatonic scale (a scale with only 5 notes) that sounds beautiful in whatever combination you play them:

Improvising on the Black Piano Keys — powered by eHow.com

With this approach in mind, let’s now have a look at what music is, and more specifically what are its constraints on how to arrange sounds together.

Musical constraints

Music aims at providing aesthetic pleasure by the mean of organised sounds. This typically imposes constraints on what can be played.


Music (more precisely musical pleasure) happens when enough surprise meets enough expectation at the peak of the Wundt curve (shown at left): expectation is typically caused by conventional constraints (e-g. western music conventions) and internal consistency of the piece of music that enable the listener to expect what will happen next; on the other hand, surprised is caused by little deviations against the expectations to create interesting tension.

In short, too much expectation means boring music, whereas too much surprise means just noise.

Musical constraints

In almost every popular genre of music, conventional constraints requires adhesion to a melodic scale (e-g. major or minor etc.), to a rhythmic meter (e-g. 4/4, or 6/8 etc.), and almost always to a tonality. These constraints represent a “background grid” on top of which a given piece of music will draw a specific motif.

Layers of constraints
Layers of constraints

On top of these conventional constraints, a piece of music also exhibits an internal consistency. This often happens through some form of repetition between its component parts (think about the fugue, or the verse-chorus-verse-chorus repeated structure, or the obvious theme repetition in classical music).  These constraints are usually written into the musical score, or into the simpler theme and chord chart in Jazz notation.

Performance freedom

Musical performance, for instance on a concert stage, is therefore all about the remaining freedom you have within these constraints. When playing a fully written score this freedom is reduced to the articulations between the notes, playing louder or softer, or playing a little faster or slower. In jazz the freedom is bigger, as long as you more or less follow the scale, tonality, chords and rhythm of the song: this is called improvisation. Improvisation on the saxophone or most classical instruments requires being trained to use only the subset of notes that are suited for each song (“practice your scales”) .

Of course, if a player excessively uses his available freedom he runs the risk to loose the audience, and listeners might consider it is noise, not music. On the other hand, if played too perfectly or “mechanically” they might get bored.

Layers of constraints

We can consider the above constraints as layers of constraints on top of each other (see picture): at the top, the category “pleasant music” defines aesthetic constraints (if one wants to play unpleasant music then the freedom is bigger and there will be less constraints). Below this layer, western music brings its constraints (e-g. meter, tempered scale, tonality), then each genre adds its constraints (tempo range, timbres, rhythmic patterns etc.), and at the bottom layer, each piece of music finally defines the most restrictive constraints in the form of the written score, chord chart etc.

For a very deep and rigorous exposé on this topic, I recommend the excellent book How Music REALLY Works which is full of precious insights.


The more we can embody these constraints into the instrument, the easier it will be to play. As an example, if our constraints impose that we can only play 6 different notes, an instrument that enables to play 12 different notes is not helpful: we run the risk to play 6 notes that will be “out of tune”! The ideal instrument should only propose the right 6 notes.

Harmonic table keyboard

The new C-Thru Harmonic Table keyboard (USB)

The new C-Thru Harmonic Table keyboard (USB)

If we want to play chords, or arpeggios, the usual piano keyboard layout is not the most straightforward one, because you have to learn the fingering for each chord.

For that particular purpose, the keyboard can be improved, and people have done just that: it is called the Harmonic Table layout.

Here is an article that explains more about it, and here is the website (also with explanations) of the company C-Thru that is launching such a commercial keyboard at the moment.

The beauty of this keyboard is that every chord of the same type has the very same fingering, as opposed to the piano keyboard:

Same fingering for every chord of the same type (picture from C-Thru)
Same fingering for every chord of the same type (picture from C-Thru)


In some musical genres, such as salsa, waltz, bossa-nova etc. there is a very strong rhythmic pattern that constraints the song very much, especially for the accompanying instruments.

Manufacturers have long embedded these constraints in the form of an auto-accompaniment feature built-in the popular electronic keyboards. The rhythmic pattern for many genres are stored into memory, and when you play a chord on the left part of the keyboard, the chord is not played according to your finger hitting the keyboard but according to the chosen rhythmic pattern. This enables many beginners or very amateur musicians to play complex accompaniment and melody easily. The same system can also play predefined bass lines, also stored in memory.

Going further, some electronic keyboards have also added shortcuts for the most common chords types: you only have to press one note to trigger the major triad chord, and if you want the minor triad chord you just press the next black key to trigger it, etc. This is called “auto chord” on my almost toy Yamaha SHS10.

A Yamaha electronic keyboard with auto-accompaniment and auto-chord features
A Yamaha electronic keyboard with auto-accompaniment and auto-chord features

However, this kind of accompaniment does indeed restrict the music space severely, and therefore the result is very quickly very boring. Auto accompaniment is now considered “infamous”, extremely “kitsch“, and very amateur-sounding. But this is not because this idea has been pushed too far that it is a bad idea in itself or forever…

Samplers and Digital Audio Workstations

Though classical instruments play single sounds (usually single notes or single chords), samplers, loopers and groove boxes can trigger full musical phrases at the touch of a button. This in turn can be played in the rhythm, or quantized, as described in the previous post. Here the idea is to have musical constraints already buit-in into musical building blocks, waiting to be used together.

Going further, DJs play complete records in the rhythm of the previous record (beatmaching), and increasingly take care of the records harmony (harmonic mixing): they actually build a long-term musical piece, with dramatic progression from opening up to a climax, rest etc. In this respect such a DJ mixing session or “playlist” can be compared with a symphony, except that the DJ is using full ready-made records instead of writing raw musical lines for each instrument of the orchestra.

Though not really “live” instruments, recent software applications for wannabe music producers such as Garage Band or Magix Music Maker and to some extent many other more professional software Digital Audio Workstations (DAW), have taken the approach of providing huge libraries of ready made music chunks. From full drum loops to 2-bars-long riffs of guitar, brass, piano or synthesizer to complete synth melodies and even pieces of vocals, you can create music without playing any music at all in the first place.

A very important aspect is that these chunks are also very well prepared to be assorted together (same key or automatically adjustable key, same tempo or automatically adjustable tempo, pre-mastered), therefore whatever combination of these chunks you choose, it cannot sound bad!

Again we can consider that this later approach embeds the knowledge from music theory that a song has one tempo, that must be shared by every musical phrase, and has one tonality, that must also be shared by every musical phrase.

When creating a new project you must set the tempo and tonality for the whole song:

Startup settings for new project in Garage Band
Startup settings for new project in Garage Band

Then you can navigate the available loops and musical fragments; whenever you choose one it will be adjusted to fit the song’s tempo and key.

Garage Band Loops browser
Garage Band Loops browser

Just like auto accompaniment, this idea results in good-sounding but often uninspired music (“Love in This Club” by Usher, US number one hit has however been produced using three ready made loops from Logic Pro 8, which can be considered the very professional version of Garage Band, as shown here). Again, this approach enables a lot of people to have fun doing music easily with a good reward.


Instruments that are more musically-aware can use their knowledge of music theory to assist human players more: they can prevent hitting a note that would be out of tune, they can correct the timing, enforce the key, tempo etc.

Instruments that trigger bigger chunks of music such as loops and readymade musical phrases (e-g. samplers, groove boxes etc.) can be considered the most attractive for non musicians. Playing a musical chunk or a record does yield instant gratification, more than with most other instruments; however making something really musical out of that still requires training and practice.

The key issue is therefore to find a balance between the amount of knowledge the instrument must embedd versus the remaining freedom to express emotions and to try unconventional ideas, in other words to be really creative. The problem with musical constraints is that even if they apply almost always, there is always a case when we must violate them!

A note on visual feedback

Just like cyclists do not look at the bicycle when they ride, musicians hardly look at their instrument when they play. Instead they look at the director, at their score, or at their band mates to shares visual hints of what is going to happen next. When being taught a musical instrument, not looking at ones fingers is one of the first advises to be told.

Instruments have to provide feedback, and almost always this feedback is what you hear.

However in a live concert or performance people in the audience really expect to see somethig happening, hence there is a clear need for a visual show.

Visual excitement for the audience happens when:

  • We can see the instruments: the view of an instrument can already be exciting
  • There is a physical involvement from the player(s), they must do something and be busy enough doing visible things, gestures, attitude, dancing etc. On the other hand, a guy in front of a computer, clicking the mouse from time to time, is not very attractive.
  • There is enough correlation between the gesture and attitude of the player and the music. If you can see the singer lips doing the sound you hear, the shoulders of the pianist moving when he tries to reach higher notes that you also hear, the drummer hitting the drums that you hear, then the visual stimuli and the music combine together to create additional excitement.
  • The player is having fun: having fun on stage is a great way to excite an audience!

Read More

Musical instruments for musicians and non-musicians: Controls

Other posts in the series Musical instruments for musicians and non-musicians:

  1. Part One: Controls: Analysing how continuous or discrete controls on the sound affect playability to great extent
  2. Part Two: Constraints: How embedding musical theory as constraints makes the instrument easier and more rewarding
  3. Part Three: Exotic examples: Examples of exotic instruments and how they achieve good or not so good results
  4. Part Four: Put into practice: Let’s put theory into practice to build an easy and musically-sounding Theremin

How can we design musical instruments that both musicians and non-musicians can play and enjoy?

“A musical instrument is an object constructed or used for the purpose of making music. In principle, anything that produces sound can serve as a musical instrument.” (Wikipedia)

What is a musical instrument?

In practice, nobody hardly calls a hammer a musical instrument, and hardly anybody considers an iPod as a musical instrument either. These two objects are missing something essential: the hammer is missing a way to assist the player in making musical sounds, whereas the iPod is lacking critical control to shape and alter the music in real-time.

Intuitively, musical instruments are tools to make music that are convenient for that purpose, and that provide enough live control to the human player.

Simple claves
Claves, perhaps the simplest instrument

Therefore, to design a musical instrument, we need to address:

  1. A way to generate sounds (every way to originate sounds is classified here); we won’t discuss that point in this post
  2. A way for musicians and non-musicians to make music easily, musical assistance (we will discuss this point partially in this post)
  3. A way for musicians and non-musicians to control the music being made: plenty of control (we will discuss this point in detail in this post)

For non musicians, it is obvious we have to address point 2 (musical assistance) more, whereas for musicians point 3 (plenty of control) will probably be the most important one, otherwise they will be frustrated.

Of course the later two points are conflicting, so the design of a musical instrument will require finding a balance between them.

Musical controls: Playability Vs. Expressiveness

“Playability is a term in video gaming jargon that is used to describe the ease by which the game can be played” (Wikipedia).

Here we will say an instrument has a good playability if it is easy to play, by musicians and especially by non-musicians.

Music is made of sounds that share essential attributes (the list is far from complete):

  • Pitch: this represents how “high” or “low” a sound is. Women typically sing at a higher pitch than men
  • Rhythm: this represents how the sounds are distributed over the metrical grid, in other words the pattern of sounds and silences
  • Articulation (the transition or continuity between multiple notes or sounds, e-g. linked notes -legato- or well separated notes)
  • Tempo: this represents the overall “speed” of the music
  • Dynamics: this represents how “loud” or “soft” a sound is
  • Timbre: this is the “colour” of the sound, as in “a piano has a different timbre than the saxophone”; we can sometime talk about “brighter” or “duller” timbres, etc.
  • Special effects and Modulations: electronic effects are endless, and so are modulations; most well-known modulations are the vibrato of the singer, or the special way to “slide” the start of notes on the saxophone.

Pitch and Rhythm are by far the primary controls, and the playability of an instrument is strongly linked to them: an instrument that is difficult to control in pitch or rhythm will surely be particularly difficult.

On top of pitch and rhythm, every musician, experienced or not, demand enough other controls to be as expressive as possible

Continuous pitch Vs. discrete pitch

Continuous pitch instruments can produce sounds of any pitch (lower or higher note) continuously, such as the violin, cello, theremin or the human voice (and also the fretless bass guitar).

Discrete pitch instruments are represented by the piano, flute, trumpet, the usual guitar, every instrument with a keyboard or with no frets, valves, or explicit finger positions.

continuous pitch instrument, particularly hard to play
continuous pitch instrument by Feromil, particularly hard to play

Because discrete pitch instruments already enforce automatically that every note played must belong to at least a scale (usually a chromatic scale), they are considered easier to learn and to play as opposed to continuous pitch instruments, where the player must find out the notes a priori using his/her ears alone (although after a deep training it will become instant habit).

Discrete pitch instruments have a better playability than continuous pitch instruments.

The chromatic scale contains 12 notes, out of which the (main) tonality of a song usually only uses 5 to 7 notes (diatonic, pentatonic or blues scales). It is usually up to the player to practice intensively to be able to play in any such sub scale without thinking about it, but one could imagine a simpler to play instrument that could be configured to only propose the notes that you can play with within a song (to be rigorous we should then deal with the problem of modulation, but it would bring us too far).

In contemporary music, instruments are sometimes expected to support microtonal scales, i.e. much more than 12 notes.

The great advantage with continuous pitch instruments is that they offer extreme control on the pitch and its variations: one can create a vibrato on a violin by quickly wobbling the finger on the fingerboard, or create a portamento by moving slowly between notes. The counterpart for that control is the huge training effort required.

Some instruments with a fixed pitch (simple drums, triangle, claves, wood sticks etc.) are obviously the easiest to use with respect to the pitch.

Playing in rhythm Vs. quantized playback

Most classical instruments require you trigger the sound at the right time with no help: you have to feel the rhythm, and then you must be accurate enough with your hands to trigger the sound (hit the drum, bow the string etc.) when you want it to be triggered. Again, this often requires training. By analogy with the pitch, we can consider that a continuous control of the rhythm .

Playing the pads on the MPC to trigger sounds
Playing the pads on the MPC to trigger sounds or to record a rhythmic pattern

Electronic groove boxes (Akai MPC in particular) and electronic sequencers do take care of triggering sound accurately on behalf of the musician, thanks to their quantization mechanism: you play once while the machine is recording, then the machine adjusts what you played against a metrical grid, and then repeats the “perfect” rhythm forever. We can consider that as a discrete control of the rhythm.

Pitch-Rhythm / Continuous-Discrete Controls instruments chart
Pitch-Rhythm / Continuous-Discrete Controls instruments playability analysis chart

Note that the grid does not have to be rigid as one can imagine, it can accommodate very strong swing, and quantization can also be applied partially, to fix a little while keeping some of the subtle human timing inaccuracy that can be desirable.

Discrete rhythm instruments (quantized rhythm) have a better playability than continuous rhythm instruments.

Talking about rhythm, the theremin is a bit special since a note is hardly triggered, instead one just controls the sound intensity (dynamics) with the loop antenna on the left. The rhythm is more than continuous…

Realtime quantization can only adjust notes later in time. One could imagine an instrument where notes can only be triggered when two conditions are met: when the player requests a note, and when a machine-generated rhythmic grid triggers a pulse. This would be a form of realtime quantization, which would make the instrument more accessible to non musicians, especially if they are poor in rhythm.

A vintage analogue step sequencer is an electronic device with buttons to decide whether to sound or not and a knob to adjust the pitch of the sound for each pulse of a fixed rhythmic grid. Each column of buttons and knobs is scanned in turn to trigger sounds for each beat. Playing such a sequencer does not require timing accuracy (it is a discrete rhythm instrument) but requires accuracy to set each independent pitch (because it’s set with a rotating know it is a continuous pitch instrument).

To sum up the analysis of pitch and rhythm controls as being either continuous or discrete (or none), here is above a simple chart that shows various instruments sorted by their continuous or discrete pitch and rhythm controls. It reads like this: “Violin is a continuous pitch and continuous rhythm instrument, a groove box is has no control on pitch and is a discrete rhythm instrument”.

The more we move to the upper right corner, the most difficult the instrument usually is (and probably the most expressive as well). The more we more down to the bottom left corner, the easier the instrument is (and probably the most frustrating as well). We therefore have defined a criterion to estimate the playability (or the other way round, expressiveness) of an instrument.

Guitar Hero has been put in the chart, in the bottom left corner, whereas it is not an instrument (as judged by a U.S. Court), since the actions on the fake guitar do not control any sound at all, they only enable to increase ones score.

Expressiveness through other controls

Strange instrument by Jean-François Laporte (Can)
Strange instrument by Jean-François Laporte (Can)

As listed above, playing music makes use of many controls in addition to pitch and rhythm.

Many classical instrument that rely on physical principles (string, air pressure…) provides to the musician a lot of natural controls: changes in the way a sax player breathes, hitting a drum in the center or near the outside, sliding changes in pitch on a string etc.

Electronic instruments used to be rather poor with respect to the expressive potential they provided, however there is now a huge range of devices that help modulate the sound in realtime: pedals, breathe controllers, knobs and sliders, keyboard aftertouch (pressure sensitivity after the key has been pressed).

Various modulation wheels for electronic keyboards from various manufacturers
Various modulation wheels or devices for electronic keyboards from various manufacturers

Typical modulation controls for electronic keyboards control the pitch bend (how to modulate the pitch continuously, by derogation to the discrete pitches of the keyboard), and the vibrato (again a fast and vibrating modulation of the pitch, also by derogation to the discrete pitches of the keyboard). They are often wheels, and sometimes joystick or even touchpad.

A turntable can be considered an instrument, a very limited one, if it provides a way to play a record at a faster or slower pace, hence controlling the tempo.


Non musicians prefer instruments with less control, or with discrete controls that are easier to get right, so that they can have fun without the risk of being out of tune or out of rhythm. We have reviewed this reflection for the primary musical controls: pitch and rhythm, including a way to estimate their playability.

Homemade breakbeat controller by Michael Carter aka Preshish Moments (USA)
Homemade breakbeat controller by Michael Carter aka Preshish Moments (USA)

However, when non-musicians become really interested in getting closer with music they do not want a one-button does it all music box such as Beamz. They want, just like professional musicians, to have enough control to express emotions through the instrument.

On the other end, being both a continuous pitch and a continuous intensity instrument, the theremin is definitely one of the most difficult instrument to play: “Easy to learn but notoriously difficult to master, theremin performance presents two challenges: reliable control of the instrument’s pitch with no guidance (no keys, valves, frets, or finger-board positions), and minimizing undesired portamento that is inherent in the instrument’s microtonal design” (Wikipedia).

This series of post follows a recent and very interesting discussion with Uros Petrevski. Many pictures were shot at the Festival Octopus in Feb 2009.

Read More

Organizing a sound library

Over time I have built up a significant library of sounds, mostly single-note samples, but with some loops as well. All these sounds were collected legally, usually through online registration to loop and samples vendors websites, by following the process they propose so that we can test the quality of what they offer.

Collecting samples along the road was not a massive chore, and yes it really helps asserting the quality of the vendors. Although they all claim to be the best, of course some are better than others, at least for your preferred genre.

Last time I ran a little count over the collection there was over 23000 samples.

Lost in sounds

Even though having many sounds sounds good, it leads to some problems: many of these sounds are not very good (since they come from just anywhere), and they must be organized to find them quickly. I have no idea on how to help with the first problem (except simply listen to each sound). The second problem, how to organize sounds to make them easy to retrieve, is not that easy. If I was in classical music it would be easier, but it is more complicated for electronic genres, that have their own sonic vocabulary, very different than the classic, academic orchestra or the jazz/rock band. I need a way to classify sounds in the context of electronic music genres, from house to hip-hop.

A quick search on the topic yields partial answers, none of them being ready to use…

Traditional classifications

Traditional classifications tend to focus on how the sound is originated:

Symphonic classification

The book Garritan Interactive Principles of Orchestration by Nikolay Rimsky-Korsakov describes a classical classification for the symphonic orchestra: Stringed, Wood wind and Brass Instruments, along with “Instruments of Little Sustaining Power”. The later include the harp, pizzicato strings, piano and percussion instruments “producing indefinite sounds”. Here we find a classification that takes into account whether a sound is loud or not, while the book also explains how many violins you need to match one trumpet loudwise. It also considers whether a sound has a clear pitch or not.

Scientific classification

More scientific, the Hornbostel-Sachs musical instrument classification classifies instruments by the physical process that makes sound:  Idiophone (the simplest of all, just hit the body), Membranophone, Chordophone, Aerophone, Electrophone. Each category has hierarchic sub categories, and they are all numbered, e-g 111242 = bells. This is totally cumbersome for my needs!

Alternate classifications

Classify by function

An appealing idea is to classify sounds according to their typical function within a song: “perfect for melodic lines”, “rhythmic”, “harmonic”. The problem with this approach is that except for obvious cases (bass sounds, kicks, grand piano…) it is hard to tell in advance what a sound can be used for.

Connotative classification

Kicks, snares and hi-hats are so numerous they need further sub-classification. This is where considering the emotional connotations, mood and other symbolic evocations can help: happy/sad, serious/light, asian/african/exotic/western, “dark”, “tribal”, “asian-ish”, references to well known song or soundtrack (“cartoon style”). The problem here is to find connotations that can be shared between different people, or that are at least constant in someone’s mind.

Classify by attributes

Going further, the MIR community (music information retrieval) routinely classifies sounds by their time-domain or frequency-domain features, which can sometime enable to deduce the mood, whether it is melodic or not etc. The problem is that this is still research, and the prime classification is indeed a vector of features values, e-g. (spectral centroid=0.68, rms=0.98, zerocross=3051…). The exploitation of these features vectors requires adaptative machine learning, not something that can be done quickly.


A similar but more intuitive approach to describe sounds in order to classify them would be to consider the synthesizer parameters that would be required to reproduce the sound approximately: Spectrum (single pitched triangle-ish, square-ish, saw-ish or sine, pitched/inharmonic/noise), Amplitude envelope (sustained or not, short/long attack, short/long decay), plus the usual synth tricks (detune, oscillators hard sync, filter envelope, pitch envelope, pitch lfo, filter lfo, amplitude lfo, mono/poly play mode, portamento, ring modulation, high resonance…); again the problem is that each sound would require a full vector of parameters, a kind of simplified old synth “patch”.

Pragmatic classifications

Elemental categories

One particularly obvious way to organize sounds is by their elemental nature: single-hit, loop.

Then single-hits chords, for instance a Em7 Rhodes chord, could also be classified in its own category just because it is not at all as all-purpose as a single note Rhodes C#3. The same would apply to instrumental loops that are harmonically constrained.

Preset categories

Synth makers have long introduced instruments categories to help find a particular preset, for instance in my E-MU Mo Phatt the categories are: Bass (bas), Guitar (gtr), Hit (hit), Lead (led), Synth (syn), Special effects (sfx), Brass (brs), Strings (str,) Keybords (key), Voices (vox), Percussions (prc), plus some special categories: Beats (bts), Drum Kits (kit), Basic waveshapes (wav and rom). This is not bad and already helps a lot, but this is not enough for thousands of sounds

Samples vendors classifications

Samples vendors have their own way to classify their sounds: most are purely marketing driven (by the name of the “famous” creator of the sounds packs, or usually by something related to the targeted genre, e-g. “Bombastic Kicks”), while some others do classify by instruments: “Kick, Snare, Claps, HiHats, Industrial Percussions, Fx etc.” each of them being either “Classic, Rugged, Heavy, Combo, Future, Acoustic, Celebrity, Industry etc.”, or “Keys, Chords, Stabs, Licks, Riffs, Bends”, or even more precise: “Squicks, Glitches, Bits, Swooshes, Scratches etc.”. These classifications are completely specific to each vendor, however they do provide a richer vocabulary for electronic genres.


If your Operating System enables it, an obvious way to classify sounds would be to tag them manually with ‘relevant’ keywords. The problem is that it would have to be done from the beginning, and even in this case it would incur a serious effort, not to mention how to define the ‘relevant’ set of keywords!

Tracing the terms of use

Whenever we download sounds from a sample vendor, we have to abide to its terms of use everytime we use the sample. Commercial vendors usually do not require much, you just cannot use their material if you were to create another sample pack to redistribute. However many creative commons-like material, though free, require you credit their use. Of course this is fair, but this is just hard! After several months of work on a song, how do you know you used samples from this website that requires credit at the time of putting it to myspace?

Since I had no solution, I had decided to classify every downloaded sound by their provider. Yes, yet another classification!

Criteria of a good classification

We must be able to access a list of consistent sounds by going no deeper than one, two or three folders deep, and the list of sounds should not exceed something like 100-300 samples, in other words a number of sounds we can browse through and listen to each to test how well they fit.

Building our own classification

I used to setup directories to organize sounds following an old article from Sound On Sound, and I felt quite happy with it at that time. However it did not work well in practice, because of the terms of use thing, but also because the proposed classification is not precise enough for the most important categories in electronic music: drums and synths.

I tried to build a classification that fits electronic genres as efficiently as possible, by mixing ideas from all of the above-mentioned approaches.

First we can consider that electronic genres mostly derive from the rock/jazz band, which is essentially a drum, bass, guitar and keys plus vocal thing, enriched with back beats, synths effects, background ambiance, and where the role of vocals is often replaced or complemented by synth leads, samples, loops and sound-design hooks.

Electronic-oriented categories

Drums remain the primary category. It is made of low frequency elements (Kicks), mid-frequency elements (Snares and Claps) and high frequency rhythmic elements (Hi Hats, Shakers, Cabasa).

Together with drums, basses are absolutely vital. Bass sounds are rather easy to classify: acoustic, electric, fretless, finger, slap, acid, moog, etc.

Instruments playing the harmony (Keys, Pads, possibly Strings, harmonic Loops or single chord samples, arpeggios, harmonic Soundtracks) form another clear category. However everyone knows that in some cases a lead or even a bass sound can be used to create harmonic pads. Categories are never that strict.

Short sounds can then be grouped into one consistent and important category. Their important quality is that we can trigger them in a rhythmic fashion, hence they are secondary rhythmic elements. Percussions of course, and Bleeps, Stabs, Hits, Pizz belong to this category. In this category sounds can be pitched or not, which can help further sub classify.

Brass instruments can be considered either as lead instruments or short sounds.

Long sounds (Ambiances, Zippers, Sirens, Crowd, Applause, Swells, Speech parts) are similar in use, often in the background,  as X-factor elements. Hip Tree, Crash, Reverse crash could be put into this category even though they play a low frequency rhythm.

Special effects (FX) can be considered yet another category, as they usually have a narrative role, just like on the soundtrack of a movie (fowler): they are exceptional, non-rhythmic effects, in other words narrative elements.

Finally, melodic elements form yet another category: Leads, Loops, Bends, Licks, Riffs, Vocals, Adlibs, even though many other sounds can also play a melodic role.

Refining the categories

Looking at the above categories, they are not all as important as each other. Typically, Kicks (at least) would deserve their own first-level category.

Sub category classification

To classify more accurately crowded categories, consider naming the building blocks logically: kick fat, kick attack, kick tail etc. Breathe noise, key noise, clicks, etc: they are pure sounds that need to be mixed or that can help tweak another sample.

Within each category, we can then make each name more expressive by using connotative words. Looking at sample vendors wording helps here. Words like “Industrial”, “Whispering Winds”, “Atmospheric”, “Ethereal”, “Ephemeral”,Meditative” can be used for that purpose. For kicks, snares and hi hats, they can also be sorted out by typical genre: a techno kick is obviously different than a hip-hop kick.


The above classification is nothing more than a goal, since I still don’t know how to assign each sample to the right category, except manually… I would love a tool that could do that automatically on my behalf, definitely something to investigate.

How you classify your sounds reveal a lot about the way you approach making music. Sticking to the classic bass/drum/keys/synths categories is not enough if you view electronic genres as having the freedom to use sounds are raw material, just a painter uses raw colours to do whatever result.

For example, considering that every short sound can be used in a rhythmic fashion depends on your perspective on music, and this is what can decide whether to put guitars chops and synth bleeps together with orchestra hits, something a classical composer would hardly do!

Read More

Playing with laser beams to create very simple rhythms

Just like many arts, music arousal is considered to follow the well-known Wundt curve that defines the balance between attractiveness and boredom. Too much repetition is boring, not enough repetition is confusing and considered just noise.

What for?

Let us assert that idea to music, to generate rhythms. A very simple application of the Wundt curve principle is to consider one given rhythmic pattern (e-g. , “x.x.xx..”) then to build up a more elaborate polyrhythm by combining various repetitions of it, although each copy must be distorted a bit to make the combination more complex hence more attractive. In other word, given a rhythmic seed, make it grow a rhythmic tree.

The transforms to apply to the rhythmic patterns can be linear:

  • Reverse (“..xx.x.x”)
  • Roll (“x.x.xx..”)
  • Scale 2:1 (“x…x…x.x…..”) or 1:2 (“xxx.”)

or non-linear:

  • Truncate (“xx..”)
  • Switch timbre (not really a transform, just to put somewhere)

In practice

To put that into practice I have been trying simple Java programs long ago, but it was too slow a process, and since I did not build a genetic algorithm around it was driven at random.

To make it more fun to investigate, we have started a small project of building an instrument to program rhythms on using laser beams and small reflectors. Each reflector triggers a sound (on a MIDI controlled MPC500) when hit by a laser beam (you need the sound on to listen to the Clap sound being triggered):

Playing with the beams to create very simple rythms from cyrille martraire on Vimeo.

The Arduino board
The Arduino board

Then by having several reflectors linked to each other to make patterns, we expect to be able to program rhythms by moving reflectors sets in the playground, using its geometry to derive the transformations to apply to the patterns.

EDIT: here is another video after some progress:

Playing with dual beams for kick and clap beat from cyrille martraire on Vimeo.

Read More