Posts Tagged ‘midi’

MIDI Elements Teensy Library

Written by Tomash on March 8th, 2013. Posted in Controllers, Technology

I have created a wrapper library to make programming MIDI controllers on the Teensy board dead easy and super fast. Simply instantiate object for each component like Buttons, Potentiometer, LED, rotary encoders, etc. and let the library handle all the dirty work of reading the raw values and deciding when to send MIDI signals. Enabling you to experiment and concentrate on your creative ideas and not waste too much time with the repetitive technical details and debugging code.

Just in a couple lines of code you can program a fully functioning MIDI controller.
Here’s an example of how simple things are:

boolean debug=false; // print to serial instead of midi
boolean secondary=true; // enable secondary midi messages
int midiChannel=1; // midi channel number

// declare all your components here
Button but(17,midiChannel,1,secondary,debug); // button 1 on pin 17
Button but2(16,midiChannel,2,secondary,debug); // button 2 on pin 16
Potentiometer pot(45,midiChannel,3,secondary,debug); // knob on pin 45 (A7)
Led led(15,midiChannel,3,true); // led on pin 15 with PWM enabled, triggered on the same number as pot

void setup(){
  usbMIDI.setHandleControlChange(OnControlChange); // set event handler for CC
}

void loop(){
  // add here all the input component reads
  pot.read(); // read knob and send midi messages
  but.read(); // read buttons and send midi messages
  but2.read();
  usbMIDI.read(); // read all the incoming midi messages
}
//====================================================================
// event handlers
void OnControlChange(byte channel, byte control, byte value){
  // add all your output component sets that will trigger with cc
  led.setOn(channel,control,value);
}

Currently only Buttons, Potentiometers and LEDs are supported. But I’m planning on adding RGB LED, rotary encoder, LED bars and ring and button pad classes.
Each component sends two sets of MIDI signals if enabled. For example Buttons send NoteOn, NoteOff, as well as ControlChange values so that they could be easily mapped in Toggle or Instant mode in software like Ableton Live. Also the Potentiometers send secondary NoteOns when values reach 0 or 127, à la MIDI Fighter Pro.

Download: github
To install extract the MIDIElements folder in your arduino/libraries directory

Aftertouch MIDI Glove

Written by Tomash on December 30th, 2012. Posted in Arduino, Controllers, Technology

It’s been a while since I posted a new project here, but after the Moving Silence festival I got so fascinated, inspired and charged with this creative energy that shortly after I just knew exactly what I was going to do.

At first it occurred to me that so far I’ve been working on mostly controllers but not something as expressive as an instrument on its own. I really got inspired by Shingo Inao and Onyx Ashanti and their devices. I wanted to use my body and movement to produce or effect the sounds, but still be able to use that hand for my usual controllerism routine. That’s when the glove idea came in.

Effects would be triggered by pressing buttons on the glove and tilting it, this way the user is able to precisely control which effect he wants to trigger. Also I wanted to somehow trigger samples from it, by making a big sudden move with my hand. I also light feedback with colors and intensity that would be directly related to the intensity of the effects would be great. I believe that its very important when the audience can relate visual elements, big movements, lighting and color to what they are hearing.

So I began working on this idea by taking apart my old useless controller, I needed the accelerometer and IR proximity sensor inside. It took literally just a few hours to put everything together and start working on the code. I graphed all the values from the sensors and tried to find what kind of data and movements would make more sense for this project. Also I had to smooth out all the readings to get rid of the sudden irregular movements. I ended up using the rate of change looking for sudden accelerations for triggering samples, and constraining some values that would be used for tilt tracking.

The buttons are a bit small and uncomfortable to press all the time, so I’ve put a small piece of cardboard underneath the board to lift it higher, also sew in square pieces of cardboard over the push witches, though they slide out of the way and require readjustment. Still have to work on improving this. If you have any ideas pleas let me know in the comments :)

I highly believe that such technology should be free and the only way forward is to collectively contribute in its development and innovation. So you are highly encouraged, almost expected, to re use this code, improve it, and share it :)

As I mentioned above, building it is fairly easy and cheap. Here are all the parts I used.

1 x pair of cycling gloves €10(?)
1 x Teensy 3 €15
1 x ADXL335 Accelerometer €20
1 x Infrared Proximity Sensor €12
4 x Mini Push Buttons €1.20
1 x Common Anode RGB LED €1.5
3 x Resistors €0.60
+ bunch of Wires

Very roughly all the parts for this cost around 60 euros.

This is the diagram of how I wired everything up (note that I used a Teensy 3 microcontroller and the pins are a bit different)

And you can find all the source code here: github

Arcade Warrior (Midi Fighter Pro clone)

Written by Tomash on June 10th, 2012. Posted in Arduino, Controllers, Music, Technology

Exams are finally over and I can spend much more time experimenting with controllers without any traces of guilt. The major highlight for this post will be my new Arcade Warrior controller, a shameless rip-off of the Midi Fighter Pro (thank you DJTT for being such a great source of inspiration), and the Teensy++ micro-controller board.

I will start off real quick with Teensy++, it’s a very nice and small AVR micro-controller, very similar to Arduino. In fact you can use the Arduino IDE and libraries to program Teensy, which is amazingly handy! But the reason I chose to try it was because of it’s MIDI Class Device support, something that Arduino can’t do. This means that it can act like any professional plug-and-play MIDI controller, no drivers, compatibility layers and virtual MIDI ports required!

Of course to test it out in practice, I had to build a new controller. And this one I wanted it to be a really fun to play and cool looking device, and what suits better than the old school arcade games that we all loved as kids. :) I wanted to build something as expressive as the Midi Fighter Pro, but throw couple of more extra controls in there and a Pac-Man era joystick. Also being able to use Midi Fighter’s already very developed Traktor mappings would save me tons of time and effort. Fortunately all the MIDI signals documentation and mappings are publicly available at DJ TechTools so it was very easy to implement.
Armed with ergonomically placed rapid fire arcade buttons, smooth professional audio gear potentiometers and the joystick controlling expressive gestures, it turned out to be a very nice and responsive controller.

PS: After a lot of questions about the wiring of the buttons I decided to update this post.
One of my goals when building this controller was to make things as simple as possible and use the least number of components. That’s one of the reason why I have included only 3 LEDs. The buttons and Joystick are wired in a very simple manner. All the ground pins (white cable in photo) are daisy chained together and end up on the ground pin of Teensy and all the colored wires are connected to one Digital Input pin on the Teensy, so no resistors required. In order to use this method, you have to enable the pull up resistor for each of the pins in your microcontroller, and this is done by setting the pin mode to pinMode(buttons[i],INPUT_PULLUP); during initialization.
Also note that if you use the pin 6, which is the one that has a LED on the Teensy, you have to set it to pinMode(6,OUTPUT); in order for it to function like the rest.
Finally, since now the buttons operate in active-low logic, this means that if the button is pressed it becomes LOW other wise its HIGH, you have to check for button presses like this if (buttonState[i]->read()==LOW)//is pressed

Also all the analog controls are routed through the breadboards and ribbon cables directly to one analog input on the Teensy.

Here is one simple diagram and a photo of my wiring. Hopefully this clarifies things.

Enjoy and keep your emails coming!

[b]uttonPad meets Traktor

Written by Tomash on March 23rd, 2012. Posted in Controllers, Music, Technology

After Native Instruments announced its new controller, Traktor Kontrol F1 (a very colorful grid controller (with some faders and knobs), designed for the new Remix sample decks in Traktor 2.5) and also heavily inspired by a local DJ friend of mine, I decided to make a mapping for my button pad.

The idea was to test/demonstrate the use of different colors on my device and see whether it was possible to fully operate Traktor with just one grid controller. I believe I covered all the major controls apart from scratching (sorry guys), I think it works best with prepared sets and hot-cues.

Traktor’s MIDI-mapping options are very powerful and flexible, really amazing job from Native Instruments there, BUT there is completely no automation for this very repetitive manual task. Basically you have to manually chose all the GUI elements, signal types and note values from drop-down boxes, no “click-n-press-key” mappings that are found in DAWs and you have to map everything twice, for input and output. It took me 4 freaking days to finish the mappings.

The device is split in half for Deck A and Deck B, so all the controls are mirrored on both sides. On the top there are FX controls, then Volumes and X Fader, Play and Cup buttons, all of the above are constant controls. Then I used modifiers to create “pages” or tabs for the rest of the things like tempo, loops, cues, EQ, and loading tracks. At first everything looks like a rainbow-puke, colorful mess, but actually everything is organized in a logical manner. I have prepared some diagrams to help you visualize how everything is layered.

So here are the constant controls.

Track progress and Tempo control pages.

Hot-Ques and Loops pages.

And finally the EQ page.

You can download my mappings from here.