__  __
 |  \/  |___  __ _ _ _  ___ _ _  _ __  ___
 | |\/| / _ \/ _` | ' \/ _ \ ' \| '  \/ -_)
 |_|  |_\___/\__,_|_||_\___/_||_|_|_|_\___|


How I started making a Monome and ended up with something else.

The following images and text is only interesting to those who would like
to know how I build my Monome40h Arduino clone and ended up with something
different. The text contains lots of nerdish references and dry jokes, the
images are solder/electro-pron (at best). For those of you that don’t want
to read a lot of text, just scroll down and there will be a video with the
highlights from this text)


The Monome 40h is a 8×8 button and led grid that is used as an interface to
your musical programs/synths etc. The Arduino is a microprocessor based
hardware interface with development environment on the computer.
The Arduinome is a merge of the both, creating a clone of the original Monome
with the use of an Arduino as brain. It was one of these I tried to build,
but failed with as you will read further down, so instead I created something
that suited my skills better and something I probably will use a lot more 🙂
Thus I dubbed my contraption to Moanome.

Features of my Arduinome:

* 8×8 bright LED’s
* 8×8 arcade buttons (I mounted the LED’s inside)
* Handcrafted box.
* Midi-out.

Building the Box:

I had some prior experience in mounting such arcade buttons on wood, but that
did not prepare me for how long it would take me building a box from start
to end. I used 3mm plywood as outside and a piece of an old IKEA wardrobe
that I had in the garage. So I spent many hot summer afternoons in the garage
sawing and drilling. I didn’t bring the camera out so there are few images
from this part of the build-process. These are two from the finished (almost).

I didn’t do a backplate here though, I made one later, or, I made two, first
I tried to make one out of plastic but that was to squiggly, so I made one from
wood instead. I drilled loads of holes so you can sort of se the inner workings
of my Moanonme.

Modifying the arcade buttons:

I found an instructable on how to add a LED to your arcade-button, it’s really
simple. Dismantle the arcade button, drill a hole for the LED, insert the LED,
Put everything together. Sounds easy enough right? well try boring, that what
it was doing that 64 times. Funny story about the buttons, if you want to buy
a bunch like I did, you better have a friend in the USA because the UK reseller
really adds a hefty amount to the price. Thanks again Nils and snygge-Mange
for getting me these.

Connecting the LED’s in a matrix

First of all the buttons needed to be mounted in the box. To bad the paint had
made the wood swell just enough to not let the buttons slide through the holes.
Borrowed a round file and filed all the holes by hand (it did not work that well
with the sander in the picture). Then mounted the buttons

This was a very nice step, and it made me realize just how stylish the finished
product would be 🙂
And of-course you have to solder the together:

The Arduino-shield-failure.

I started this with the intention of using the Monome Arduino shield. No problem
there, bought it as part of a group-buy and when it arrived by mail I ordered the
parts. Soldering was easy-peasy and didn’t take long. Eager to test things I
hooked it up to the LED-matrix but I couldn’t get it to work. The Arduinome is made
to fit with Monome like plastic buttons and pcb from sparkfun. I didnt want to use
that, I was to much in love with my arcade buttons idea. Anyways my LED matrix did
not light up where it should although I tried with the Monome test max/msp patch and
loads of different MAX7219 Arduino examples from the Arduino site. I tried like a
gazillion different configurations and different source-code. I also bought not
one but two new LED Driver IC’s and tried breadboarding and loads of things.
Nothing worked, I spent most time of the project here. And I didn’t get it to work
at all. BIG FAIL. If this where a romantic comedy type of movie this is the
part where the guy looses the girl.

The shiftOut success.

If you look at the Arduino-site there is an example on how to get more out’s, i.e.
ShiftOut one. very nice, I got that working in like five minutes. a few minutes later
I had it all connected to my LED matrix and multiplexed via inputs on the Arduino.
Here is the program for it.

I’m very proud of this piece. I’s the first thing I’ve prototyped on a breadboard,
the moved to a protoboard and got it all working. Made me feel confident in myselve.
(this is where the strings come in and the boy get’s the girl back)

Replacing the shield altogether (aka the shiftIn success)

So now I’m thinking, what about removing that shield altogether? I suddenly remembered
me buying a few PCB’s a while back from specifically the DIN modules
(digital in) So I hooked up them to my buttons and viola, everything works Hooray!
actually it took a few hours soldering everything together and twice that looking for
shorts. but it works and I extended my previous LED test program so that it lights the
buttons that you press.

As you can se I really really wanted ppl to se parts of the back with all the work I
had with it.

Adding midi-out to the soup.

Now that I had abandoned (saved for later) the shield I was thinking of diversing my
build. I really wasn’t satisfied with building the biggest Monome, the first with
LED’ed arcade buttons so I went for creating the first with a midi-out port. This was
an easy hack as it seems. To bad you need to use the UART that the USB uses to
communicate with the computer. And if you try using port 1 and 2 for multiplexing the
LED’s, strange lightning phenomena’s occur. I still will use the midi-out for for
something though. Since it was the only part of the build that hurt me so bad I
started bleeding.

Modifying the Arduinome source-code to utilize my hardware.

This could be a long chapter, but it won’t be. I started porting the Arduino-Monome
firmware to my hardware setup. Then the new Arduino firmware came out. So I used to
do that the conversion instead. But after optimizing the Arduinome-code (500 bytes
just by changing int blah 47; to #define blah 47) and dividing the source into
logical parts instead of the “singe big file” previously present. Anyways, I stopped
converting because of a number of reasons. 1. I got very little response. 2. I didn’t
get it it to work as I wanted. 3. I don’t really care about max/msp. So I stopped the
conversion and started creating my own setup. anyway: here is a zip with how far I got
in case you’re at all interested.

First signs of success, and a new name.

So I made an os x program that communicates via the serial-port to the Arduino. and that
program communicates back to the Arduino and creates a virtual midi-port. This is very
nice. I can with this setup create whatever programs I want without using max/msp. The
downside is that I cant use the already made max/msp, chuck and or whatever programs and
contraptions other people have created.

Anyways here is the source-code for the os x program (ccmidi class borrowed from
And the current firmware for the Arduino (a little borrowed here from the Monome firmware
(button de-bounce): both WIP and both will change and be added to. I’ll probably forget
to update this page so feel free to email me and ask for the newest version 🙂
there are 3 modes, first of is a press and it will play midi, second is a toggle and play,
and the third is a xoxo step sequencer that is far from finished. It will probably be
rewritten altogether. Perhaps before I publish this little text for the rest of the world 🙂



Final thoughts.

First of, If you only want an Monome, go buy one from If you want to learn a little
bit about electronics. Try and get a hold of the shield. (I still have one that I wont use)
For me though it was a big learning project, and as such has taught me a lot and taken loads of
time. I hope in writing that I in some way can encourage and discourage you, dear reader. But
I can think of way worse places to learn about music and electronics then Arduino and Monome

Convert an MC player to a amp box (with distortion)

Ok, I made a little text about how to convert a walkman to a
distortionpedal, however the info were to little there for some, so here
it is again, but this time with a twist.

I’ve converted a tape recorder to do the same thing, this can be handy
when circuitbending and/or annoying ppl.

Ok so the theory is pretty darn easy. Sound enters the circuit from a
We substitute the tapehead for an input option of our own.
Distortion occurs when we feed the amplification part of the circuit with
higher volumes then it was designed to handle.

To identify the tapehead press play and look for the part going forward.
Then look for the cables connecting the circuitboard to the tapehead,
here we want to jack in.

Most players dont let the engine draw the tape round if the playbutton
isnt pushed in, this is the tricky part, you need to find how they
connect everything, in the case you se below it was easy, just 2 blue

Anyways, check out the video to se it in action.

Incase you are wondering why you dont se me, its because I'm semi-nekkid.

The blue wires where connected to 2 metal plates that connected when you
pressed play or forward but never else, these I connected to a switch (
se further down)

The red and orange (and one more cable lost in focus) where connected to
the electric engine engine, these I just taped toghether to avoid shorts.

The grey and the red cables that are twined together are the ones that
used to go to the tapehead, instead these go to the guitar jack in the

This is where the blue cables used to be connect.

I connected a switch to them instead.

This is the jack that connects to where the tapehead used to be connected.

Solder the twined pieces together, and tape all loose ends.

Full frontal shot.


 _|    _|                         _|         _|_|_|
 _|  _|     _|_|_|       _|_|     _|_|_|     _|    _|     _|_|     _|    _| 
 _|_|       _|    _|   _|    _|   _|    _|   _|_|_|     _|    _|     _|_| 
 _|  _|     _|    _|   _|    _|   _|    _|   _|    _|   _|    _|   _|    _|
 _|    _|   _|    _|     _|_|     _|_|_|     _|_|_|       _|_|     _|    _|

My quest for a knobs’ controller for my soft-synths.

I wanted a midi-controller with a decent amount of knobs to control my
soft-synths and DAW with, this is the story on what I had to go through to get
one, and how I finally had to make one. If you’re not interested in my why I did
not settle with a pre-made one skip down to the “The Actual making of the

Pre-made ones.
I actually did buy a Behringer BCR2000, but it was to heavy (what felt like
twice or thrice the weight of my iBook) it did not run on batteries and the
program to do settings and setup in was unintuitive and, surprise, did not work
especially well on my mac. I could not get it to run in Mackie control mode, and
the endless knobs did not work endlessly. And it is ugly. Then I held out for a
Kenton AB mini, but when it was released (as KillaMix) it was priced twice or
thrice over what I was prepared to pay. But it really has the lot, endless
rotary encoders, USB bus powered. still a bit to pricey. With all these options
I decided to make one myself.

Research in to what hardware to base my controller on.
First I had to figure out what I really really wanted. It ended up being at
least 16 knobs, USB powered (or at least not wall-powered) preferably USB
connected and inexpensive. Doepfer was way to expensive (although I hear they
make great stuff). the Ardunio experiments I saw at the time was to limited in
the knob area (a maximum of 8). did not have an USB
“brain” and it could not draw current from USB.I finally ended up with buying
from a device called pot32 where you get 32 knobs,
it’s battery powered and draws very little current, no USB though. I have a few
things to say about ordering from midi-hardware, Firstly I got a (what I feel
like) great deal on the pot32 (all the cabling the pots the midi-connector an
extra little keyboard to program the device and shipping) for 95 EUR. I did pay
with moneybrookers on the 5th of January but there was no info to me for a week
and on my following e-mails where unanswered for 2 weeks that followed, I
finally received the package on 6th of February.

The Actual making of the controller.
I have an old commodore 64 revision 2 that I wanted to use as casing. That
failed, if I had used that as a case everything would have been to close
together. That would have sucked, I wanted it to be nice-looking and practical
to use. So the C64 was out. then I tried to make a steel case something but
after I broke the tools I had for cutting metal I gave that up aswell. So I
ended up with a piece of wood that was supposed to be used as a piece of floor.
Looked pretty nice.

After drilling, sawing, grinding and milling I had a piece that not only looked
okayish (except for the keyboard hole in the middle that was really sawed badly)
it was okay enough for me to use (I lowered my standards after a few hours of

Testing that the stuff I ordered works, hooking one pot up to the board and then
to the computer, and yes, as you can se I got a lot of messages. I didn’t know
which leg of the pot’s to connect to what so I tested around a little here.

Soldering was tedious, very tedious, lots and lots of wires to connect.

Everything works, but its not very ergonomically and its still very
prototypish.So I order knob heads and now it looks much better, I also added
two legs at the sides and an on/off switch that I scavenged from my electronic

Finally I have this. some glue and paint made the badly sawed cut in the middle
look ok. For handling I can tell you it is a dream, I’ve set it up with my Korg
padKontrol and its all very nice.

As much as I love it, and how easy everything went, there has been a few spots
that I would liked to have avoided. Firstly it took ages to get the stuff from The pots I got from him had all different torque, very very
annoying, and one of them is broken inside. It has a scraping sound when I
rotate it. Makes the overall tactile feeling lousy. I shouldn’t have ordered the
keyboard, waste of money since I have everything configured as when I got it.
I’d really liked to have a few buttons, you know, to trigger clips and stuff.So
next time I build myself a controller I think I will go with’s stuff.
They are perhaps a bit more expensive in time you have to spend to set things up
and things you have to learn, but you gain it in functionality and community


 |_  |   _    _  _|_  ._  o  _    _    _   |    _.
 |_  |  (/_  (_   |_  |   |  /_  (_)  (_)  |<  (_|

Family, friends and pets here is a somewhat instructionable text on how
to electrify your kazooo (or someone elses)

Originally this was intended for Timbre, cheers!

Anyways, you need:

A kazoo
A piezo mic
A guitarjack
A bit of soldering.
A bit of glueing.
A bit of drilling.

If you have a piezo that is inside a plastic container follow the
instructions at Erinys superb how-to to extract them.

Solder the jack to the piezo together.
Test where you get the best sound out of the contraption by testing
different positions of the piezo.
Then all you have to do is glue the piezo onto the kazoo (and drill if the
air is trapped)

Then you will have something that sounds something like this soundbyte . The first is
clean and then the others are somewhat manipulated. (phased/distorted/etc)

Anyways, get to it, build one yourself!

Parts used pictured here.

Pizo nekked and solderd.

Close up.

Final result.


'||'''|. |''||''| '\\  //`   ||                   
 ||   ||    ||      \\//     ||                   
 ||   ||    ||       ||    ''||''   '''|.  '||''| 
 ||   ||    ||       ||      ||    .|''||   ||    
.||...|' |..||..|   .||.     `|..' `|..||. .||.   



Which is the worlds sexiest and awesomest instrument? yes, the keytar. But
what if you want special features on it and are to cheap to buy one of ebay?
That is what I am. Cheap and special, that is why I made my own.

Hardware and costs.

1x Fatar keyboard 30eur (
2x 500mm SoftPot 25.95 usd (
1x iDuino 17.82 usd (
1x battery stepup thingy (sparkfun)
cables + connectors + wood and such 200 sek, so about a 1000 sek.


I cant be botherd to do them right now, but they are not that advance.


This is easy, here it is




Final thoughts.


##        #     #               #
# #  ## ###  ## ### ### ### ### ### ### # #
##  # # # # # # # # # # # # ### # # # #  #
# # ### ### ### ### ### ### # # ### ### # #


My and my buddy Gange decided we wanted a fat vicious and malevolent
music-machine to bring to festivals, for our own listening pleasure when
sitting by the tent and drinking coffee and eating donuts.

Anyway, what we figured was that since we are noobs at building this
type of things we wanted a modular environment. That is we wanted to be
able to exchange parts for other similar but louder ones.

So what we ended up with are pictured here, its a frame made of
particle board. The speakers where bought in a low-price store
(the sound is good though). Car battery from when I thought that it
was dead on my wife’s car and bought a new one for her.
Stereo is really an LG something (although there is a Panasonic on the
picture) the reason we choose the LG is because of its ability to play
MP3’s and also because its 4x50w output (louder 🙂 .
The connector to the stereo pictured is one that came with the box.

Ohh, and we made the frame ourself.
In total this beasts way in at 32kg, which is a lot, so we have a little
carriage for transport.

A view from the top, the babe 🙂

The front with loudspeakers moved to the sides (the cables are about 1,5
meters with a knot as enders)

Box opened, car stereo and battery shown.

Where we soldered and connected everything together.

Yeah, I really want better connectors (and shielded aswell)

A few tips to end this little nonsense page with:
* Be careful
* Try to use car battery’s that doesn’t have water in them.
* Have fun
* Be careful

Arduino step sequencer

   Oo    .oOOOo.  .oOOOo.
  o  O   o     o  o     o
 O    o  O.       O.
oOooOoOo  `OOoo.   `OOoo.
o      O       `O       `O
O      o        o        o
o      O O.    .O O.    .O
O.     O  `oooO'   `oooO'
Arduino Step Sequencer


A stepsequencer is by wikipedia a “special case” of musical sequencer. But
I figure you know what a stepsequencer is if you’re reading this page, about
me making a stepsequencer with an Arduino. The main reason is probably that
I burned my Gorf when assembling it.
Fiddling with it got me thinking about what I wanted of a step-sequencer and
how I wanted to use it when composing music. The gorf to me was a bit to
small. Dont get me wrong small is nice and all, but not the spacing between
controls. I dont preform drunk (or create music drunk either) but I’d like
my stuff to be usable while intoxicated. I would never have done this unless
I had burned the Gorf-kit :D.
Anyways I wanted a bigger display, so that I could fiddle around with
different setups and functions. I wanted rotary encoders (endless) so that
I would need fewer then 1 per step. I wanted MIDI-out, to you know, control
Luckily for me I have a interaction-designer-musician friend that I can
discuss with. So we iterated the idea back and forth. He’s suggestions where
all great, but I didn’t take them all. Had this been a mass-market product
I where going to try to sell I’d probably taken them all, right now I only
took the ones that I wanted!

A few resources have been helpful for me while creating the Ass here is a list:
Rotary Encoders, read up on these
library for the LCD screen
Information about the built in pullup resistor
ever so useful information about the midi connections
ever so useful information about the midi connections
library for the rotary encoder that I modified
very useful in getting the liquidcrystal library to work.


1 Arduino
1 5pole DIN (MIDI)
1 Sparkfun screen
1 9v Battery holder
1 Input-connector for the battery
5 Buttons
1 OnOff switch
1 Rotary Encoder
1 Knob
1 Plastic case
2 resistors to get the contrast of the screen sane.

As you can se, we’re under 50 dollars in parts.
Everything was pretty easy putting together, and here is a schematic that
is more of a photo with drawn lines then a schematic. Hope it helps if
you want to build your own Ass.

the source



Everything was dead easy programming, everything except the rotary encoder.
I got a 2 dollar one, so i had problems with bouncing and noise on it, as
you’ve seen on the previous video I programmed it while sick so, yeah.
Another thing to think about is that you shouldent update the LCD screen
every time in you’re Loop function, it goes CRAZY then.
I’ve commented the code a lot so I wont go in on it here, I’ve used the excellent tool.

UPDATE  Magellan has supplied a much better schematics, thank you!

Here is the better schematics:

This is the Ass.pde file

   Oo    .oOOOo.  .oOOOo.  
  o  O   o     o  o     o  
 O    o  O.       O.       
oOooOoOo  `OOoo.   `OOoo.  
o      O       `O       `O 
O      o        o        o 
o      O O.    .O O.    .O 
O.     O  `oooO'   `oooO'  
Arduino Step Sequencer                           

#include <LiquidCrystal.h>
#include "rotaryEncoder.h"

#define usesMidi 1 /*enable this if you want to send midi, doesent work at all together with Serial.print debugging */
#define debugprint 0 /*this sends midi messages as text instead */

LiquidCrystal lcd(12, 11, 10, 7, 6, 5, 4); /* Utilizing the liquidcrystal library for the screen, this is a setup-call*/

RotaryEncoder rotary(2, 3); /*sweet sweet library that solves a lot of problems, I made a few changes to the original one */

/*defines for the buttons */
#define menuButton 14
#define onOffButton 15
#define lengthButton 16
#define velocityButton 17
#define playPuaseButton 18
#define noteButton  19

/*booleans to tell me if the buttons are pressed or not */
byte menuButtonIsPressed =0;
byte onOffButtonIsPressed =0;
byte lengthButtonIsPressed =0;
byte velocityButtonIsPressed =0;
byte playPuaseButtonIsPressed =0;
byte noteButtonIsPressed =0;

/*useful state variables */
byte currentlyPlaying =0;
byte currentlyEditing =0;
boolean isPlaying=true;

/*channel and instrument are for the midi messages */
byte channel=0;
byte instrument =0;

byte tempo=120;  /* bmp of our sequence */
long timeChange=250; /*a variable for calculating how long we are going to wait*/

/*a struct for our notes in our sequence*/
struct data
  byte  velocity;
  byte  onOff;
  byte  length;
  byte  note;

int numberofsteps = 8; /* at first we have 8 steps, this is pretty basic */
#define maxNumberOfSteps 17 /*that's 16*/

data myData[maxNumberOfSteps]; /*array for our notes*/

/*remembering the good old times*/
long rememberMillis=0;
long rememberMillisDisplay =0;

/*we'd like to present notenames instead of midi numbers */
char* noteNames[] = {
  "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };

void setup()
  /*telling everybody we're alive */
  lcd.print("Arduino Step Seq");

  /*setting up the buttons */

  /*starting the builtin pullup-resistor!*/

  /*initialization of the encoder library */

#if usesMidi

  /*calculating the timeChange variable. milliseconds divided by 
   tempo and 16th note, or something like that. I dont remember*/

  /*initializing the steps in the array */
  for(int i=0;iclear();

  /*what time is now*/

  rememberMillis = millis();
  rememberMillisDisplay = millis();

/* a little function to print the name of the note */
void printNoteName(byte initialNote)
  byte octave = (initialNote / 12) - 1;
  byte noteIndex = (initialNote % 12);


/* this functions prints what we have in the first "menu" part of the data
 tempo, channel and instrument*/
void populateDisplayMenuButtonPressed()

  lcd.setCursor(0, 0) ;

  lcd.print(" c:");
  lcd.print(" i:");

  if (!isPlaying)
    lcd.setCursor(0, 1) ;
    lcd.print("PAUSED           ");
    lcd.setCursor(0, 1) ;
    for(int i=0;iif(i==currentlyPlaying && i==currentlyEditing )
      else if(i==currentlyEditing)
      else if(i==currentlyPlaying)
    /* prints spaces for the rest of the line, it is better then using a 
     lcd.clear, atleast if you call lcd.clear fast/often */
    for(int i=numberofsteps;i<  maxNumberOfSteps ;i++)
      lcd.print(" ");


/*this is the normal/regular display info printing routine */
void populateDisplay()
  lcd.setCursor(0, 0) ;
    lcd.print(" ");
    /*On if the note is On, Off it is Off, getting it? getting on or getting off, muhahahaha */

    lcd.print(" ");
      /*what kind of note what we are dealing with */
      switch (myData[currentlyEditing].length)
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
      case 6:
        break; /*we made bu bu*/
    lcd.print(" ");

    lcd.print("       ");

    lcd.setCursor(0, 1) ;
    for(int i=0;iif(i==currentlyPlaying && i==currentlyEditing )
      else if(i==currentlyEditing)
      else if(i==currentlyPlaying)

    /* prints spaces for the rest of the line, it is better then using a 
     lcd.clear, atleast if you call lcd.clear fast/often */

    for(int i=numberofsteps;i<  maxNumberOfSteps ;i++)
      lcd.print(" ");

    lcd.setCursor(0, 1) ;
    lcd.print("PAUSED           ");

/* a reading the button function */
int readbutt(int button)
  if (digitalRead(button)==LOW)
    return 1;
  return 0;

/* function to iterate through the buttons */
void checkButtons()

  if (readbutt(noteButton) && noteButtonIsPressed==false)
    noteButtonIsPressed = true;
  else if (noteButtonIsPressed==true && readbutt(noteButton)==false)
    noteButtonIsPressed = false;
  if (readbutt(menuButton) && menuButtonIsPressed==false)
    menuButtonIsPressed = true;
  else if (menuButtonIsPressed==true && readbutt(menuButton)==false)
    menuButtonIsPressed = false;
  if (readbutt(onOffButton) && onOffButtonIsPressed==false)
    onOffButtonIsPressed = true;
  else if (onOffButtonIsPressed==true && readbutt(onOffButton)==false)
    onOffButtonIsPressed = false;
  if (readbutt(lengthButton) && lengthButtonIsPressed==false)
    lengthButtonIsPressed = true;
  else if (lengthButtonIsPressed==true && readbutt(lengthButton)==false)
    lengthButtonIsPressed = false;
  if (readbutt(velocityButton) && velocityButtonIsPressed==false)
    velocityButtonIsPressed = true;
  else if (velocityButtonIsPressed==true && readbutt(velocityButton)==false)
    velocityButtonIsPressed = false;
  if (readbutt(playPuaseButton) && playPuaseButtonIsPressed==false)
    playPuaseButtonIsPressed = true;
  else if (playPuaseButtonIsPressed==true && readbutt(playPuaseButton)==false)
    playPuaseButtonIsPressed = false;

/*our main baby */
void loop()


  /* we dont want to update the screen to often, it freaks out */
  if( millis()-rememberMillisDisplay > 100)
    if (!menuButtonIsPressed)


    if( millis()-rememberMillis > ((myData[currentlyPlaying].length * myData[currentlyPlaying].length )*(timeChange)))
      //fuck it, we always send off, most MIDI devices wont crap themselves.
      sendMidiMessage(0x80,  myData[currentlyPlaying].note,120); //off

      if (currentlyPlaying==numberofsteps)


      if( myData[currentlyPlaying].onOff)
        sendMidiMessage(0x90,  myData[currentlyPlaying].note, 120); //on



/* This functions makes almost all our values be more correct.
 like, we dont want negative values or out of range values */
void SanitizeValues()

  myData[currentlyEditing].onOff= myData[currentlyEditing].onOff % 2; //setting the current value to be inbetween 0 and 1
  myData[currentlyEditing].note= myData[currentlyEditing].note % 128; //setting the current value to be inbetween 0 and 127
  myData[currentlyEditing].velocity= myData[currentlyEditing].velocity % 128; //setting the current value to be inbetween 0 and 127
  currentlyEditing=(currentlyEditing % (numberofsteps));
  isPlaying = isPlaying%2;

  if(numberofsteps > maxNumberOfSteps)

  if(numberofsteps < 0)

  instrument = instrument % 128;
  channel = channel% 17;
  tempo =tempo % 200;


void setCurrentValue()
  int encoder0Pos = rotary.position();

      currentlyPlaying =0;
      currentlyEditing =0;
    else if(noteButtonIsPressed)
    else if(onOffButtonIsPressed)
    else if(lengthButtonIsPressed)


    else if(onOffButtonIsPressed==true)

    else if(lengthButtonIsPressed)

      if(myData[currentlyEditing].length > 6)

      if(myData[currentlyEditing].length < 1)

    else if(velocityButtonIsPressed)
    else if(playPuaseButtonIsPressed)



void sendMidiMessage(char cmd, char data1, char data2)

#if debugprint
  Serial.print("Sending MIDI ");
  Serial.print(" ");
  Serial.print(" ");
  //not sending channel or instrument change yet...
#if usesMidi
  Serial.print(cmd, BYTE);
  Serial.print(data1, BYTE);
  Serial.print(data2, BYTE);

This is the RotaryEncoder.h file

 *  RotaryEncoder.h - Arduino library for reading RotaryEncoder encoders.
 *  Version 0.90
 *  modified by Johan Larsby 2009 May 08

#ifndef RotaryEncoder_h
#define RotaryEncoder_h

#define DIGITAL_PINS (13)

class RotaryEncoder
		RotaryEncoder(int encoderPin1, int encoderPin2);

		void minimum(int min);
		int minimum(void);
		void maximum(int max);
		int maximum(void);
		void nominimum(void);
		void nomaximum(void);

		int position(void);
		void position(int pos);

		int pressed(void);

		static void isr(void);

		int _readEncoderPins(void);
		int _encoderPin1, _encoderPin2;

		volatile int _position;

		int _min, _max;
		bool _usingmin, _usingmax;

		volatile int _previous, _time;

		static RotaryEncoder* _instance;

inline void RotaryEncoder::minimum(int min)
    _min = min;
    _usingmin = 1;

    //  adjust position if lower than new minimum
    //_position = max(_position, min);
	_position = _position > min ? _position : min;

inline int RotaryEncoder::minimum()
    return _min;

inline void RotaryEncoder::maximum(int max)
    _max = max;
    _usingmax = 1;

    //  adjust position if higher than new maximum
    //_position = min(_position, max);
	_position = _position < max ? _position : max;

inline int RotaryEncoder::maximum()
    return _max;

inline void RotaryEncoder::nominimum(void)
    _usingmin = 0;

inline void RotaryEncoder::nomaximum(void)
    _usingmax = 0;

inline int RotaryEncoder::position(void)
    return _position;

inline void RotaryEncoder::position(int pos)
    _position = pos;

#endif // RotaryEncoder_h

This is the RotaryEncoder.cpp file

 *  RotaryEncoder.cpp - Arduino library for reading RotaryEncoder encoders.
 *  Version 0.90
 *  modified by Johan Larsby 2009 May 08

#include "rotaryEncoder.h"

extern "C"
	#include "WConstants.h"	//all things wiring / arduino

const int _quadrature [4][4] =
    { 0, 0, 0, 0 },		//  00 -> 10 is silent CW
    { 1, 0, 0, 0 },	//  01 -> 00 is CW
    { -1, 0, 0, 0 },	//  10 -> 11 is CW
    { 0, 0, 0, 0 }		//  11 -> 01 is silent CW

RotaryEncoder * RotaryEncoder::_instance;

RotaryEncoder::RotaryEncoder(int encoderPin1, int encoderPin2)
 : _encoderPin1(encoderPin1), _encoderPin2(encoderPin2), _position(0), _min(0), _max(0), _usingmin(0), _usingmax(0), _time(0) // constructor initializer list
    pinMode(encoderPin1, INPUT);
    pinMode(encoderPin2, INPUT);
    digitalWrite(encoderPin1, HIGH);	//  activate internal pullups
    digitalWrite(encoderPin2, HIGH);

    _previous = _readEncoderPins();	//  read initial position

    TIMSK2 |= (1 << TOIE2);		//  enable timer 2 overflow interrupt

    _instance = this;

inline int RotaryEncoder::_readEncoderPins(void)
    return digitalRead(_encoderPin2) << 1 | digitalRead(_encoderPin1);

inline void RotaryEncoder::isr(void)
	//                                Read Encoder
	int quadbits = _instance->_readEncoderPins();

	if (quadbits != _instance->_previous)
		int position = _instance->_position - _quadrature[_instance->_previous][quadbits];

		//  limit to minimum if assigned
		position = _instance->_usingmin ? max(_instance->_min, position) : position;

		//  limit to maximum if assigned
		_instance->_position = _instance->_usingmax ? min(_instance->_max, position) : position;

		_instance->_previous = quadbits;


Everything might be wrong, nothing might be correct. you have been warned!