Author Topic: TEENSY - DIY midi Touch controls with Teensy 3.x, code included  (Read 1737 times)

0 Members and 1 Guest are viewing this topic.

Offline Guitarpolson



6 touchpads are mounted close to the strings, so that they can be touched like normal strings. They are connected to a microcontroller, that generates midi controls accordingly. Some assignments in the Roland GR55 make the trumpets appear when you touch them. I'll do a more technolike example later.



I've placed small brass parts between the string, touching them creates a midi controller command. The teensy is mounted in the bridge pickup hole, under the touchpads, for short wires are recommended for using Teensy's touchread() function.
The teensy is connected to my laptop, and a software bridge routes the midi commands to my GR55. that way i could test this without too much extra wires going to my guitar, just 1 usb cable.
Using stan dard midi is also possible: I've included it in the code. But please start with the usb route, for the touchsensors might make some noise on your normal pickups, you should test it out yourself. I use a piezo guitar here, piezos are not so sensitve to interference.

cheers,
Paul


Small demo of a simple touch interface for Teensy 3.x, here used together with a Roland GR55.
I've shared the example code below:
Code: [Select]
// --------------------------------------
// touchMidi for Teensy 3.x
// --------------------------------------
// A very simple midi touchcontrol interface
// Compile with tools/ usb type: midi.
// outputs standard midi and usbmidi
// The teensy needs a usb connection to be powered, but you can also use a standard usb powersupply.
// Connect touchpins/pads to A1,A2,A3,A4,A5 & **A8**, they will deliver cc's 1,2,3,4,5 & 6
// the touchsensitivity can be adjusted by connecting a potentiometer to A9.
// Using the assigns in Roland equipment like the GR55, one can make a hexaphonic killswitch or the opposite: a "note on touch",
// which turns your guitar into some kind of piano or whatever.
//
// Paul Driessen, April 2015

// here the settings
//int touchPin[6]={A1,A2,A3,A4,A5,A8}; // the touchpins used, there are 12 touchable pins on a Teensy 3.x.
int touchPin[6]={A8,A5,A4,A3,A2,A1}; // reversed mount, the touchpins used, there are 12 touchable pins on a Teensy 3.x.
int touchCc[6] ={1 ,2 ,3 ,4 ,5 ,6};  // and the cc's send  by them, you can change them to whatever you want, ranging from 1 to 127
int touchCh[6] ={1 ,1 ,1 ,1 ,1 ,1};  // midichannels used, from 1 to 16
int sensePin= A9;                    // optional: for the sensitivity potentiometer
int treshold=1200;                   // default sensitivity, lower is smore sensitive.



void setup()
{
  Serial1.begin(31250); // the midi output, so you can e.g. connect a Roland GR55 or VG88/99 straightaway.
  analogReadRes(10);    // not too much resolution for the sensitivity pot.
}

int actSense=0;
boolean touching[6];                 // keep track of the touch-state                 
void loop()
{
  /*int trySense=analogRead(sensePin);  .//uncommment this section for using sensitivity pot.
  if(trySense!=actSense)
  {
   actSense = trySense;
   treshold = actSense << 6;  //
  }  */
  for(int tp=0; tp<6; tp++)   // start of "read all touchpins" loop..
  {
   int tryRead=touchRead(touchPin[tp]);
   if(tryRead>treshold)
   {
     if(!touching[tp])               // if we tought we were untouched
     {
       touching[tp]=true;            // yes, we are touched..
       Serial1.write(0xB0 + touchCh[tp]-1);// cmd=control. midichannelnr's are hard, and 0 based.
       Serial1.write(touchCc[tp]);   // cc from settings..
       Serial1.write(127);           // = on
       usbMIDI.sendControlChange(touchCc[tp], 127, touchCh[tp]); // usb midi cc  version 
     } 
   }else{
     if(touching[tp])
     {
       touching[tp]=false;            // no more touching..
       Serial1.write(0xB0 + touchCh[tp]-1); // cmd=control
       Serial1.write(touchCc[tp]);    // cc from settings..
       Serial1.write(0);              // = off
       usbMIDI.sendControlChange(touchCc[tp], 0, touchCh[tp]); // usb midi cc  version 
     }
   } 
  }                           // end of "read all touchpins" loop..
} // end of main loop() 


« Last Edit: April 18, 2015, 02:23:52 AM by Guitarpolson »

Offline thebrushwithin

Re: TEENSY - DIY midi Touch controls with Teensy 3.x, code included
« Reply #1 on: April 16, 2015, 11:05:18 AM »
Very cool!!!

Offline maxdaddy

Re: TEENSY - DIY midi Touch controls with Teensy 3.x, code included
« Reply #2 on: April 16, 2015, 09:23:16 PM »
Wow. What exactly is going on there with the right hand?

Offline Guitarpolson

Re: TEENSY - DIY midi Touch controls with Teensy 3.x, code included
« Reply #3 on: April 17, 2015, 03:43:26 AM »
Wow. What exactly is going on there with the right hand?
thanks maxdaddy, I've made a more tap and touch style demo, you can see that I tip the sensors to play the flute lead sound .

Offline richfromne2

  • Lurker
  • *
  • Posts: 4
  • Total likes: 0
  • Rating: 0
  • vg-99,ax50,GR-55,US20,Godin Freway SA
Re: TEENSY - DIY midi Touch controls with Teensy 3.x, code included
« Reply #4 on: April 17, 2015, 12:09:07 PM »
 :) Pretty  amazing.  Are you going to post the other video ? Not 100% sure what part of the sound is  originating from the touch sensors.

Offline Guitarpolson

Re: TEENSY - DIY midi Touch controls with Teensy 3.x, code included
« Reply #5 on: April 17, 2015, 12:51:31 PM »
:) Pretty  amazing.  Are you going to post the other video ? Not 100% sure what part of the sound is  originating from the touch sensors.
thanks! and..aw, this is allready the second video, the high pitched flutesound is switched by the touch sensors. The idea is, to be able to use the synth only where you need it, so you can decide per note whether you want a synth there, or not.. secondly, it avoids having to damp the open strings, and enables you to dial in the pcm synth more sensitive.

Offline gumtown

Re: TEENSY - DIY midi Touch controls with Teensy 3.x, code included
« Reply #6 on: April 17, 2015, 04:00:13 PM »
So the touch sensor is mounted at the bridge, I am not quite sure how this is working?
I assume it is not contacting with the strings, are the touch pads raised above the strings?
I can't quite see how it is working without damping the strings.

Impressive playing though!!  :)
Thank You for sharing  ..
Free "GR-55 FloorBoard" editor software from http://sourceforge.net/projects/grfloorboard/

Offline Guitarpolson

Re: TEENSY - DIY midi Touch controls with Teensy 3.x, code included
« Reply #7 on: April 18, 2015, 02:30:29 AM »
So the touch sensor is mounted at the bridge, I am not quite sure how this is working?
I assume it is not contacting with the strings, are the touch pads raised above the strings?
I can't quite see how it is working without damping the strings.

Impressive playing though!!  :)
Thank You for sharing  ..
thanks, Gumtown.. and yes, the pads are raised above the strings. My initial idea is to tunnel the strings through the lusterterminal  s I use for the pads, so that you can tip the pad without inadvertedly touching the string. But I'm not sure whether or not this is a good idea: it is better to have some kind of shielding in between the pads and the strings, if you want to use this with a magnetic pickup.
I've changed the first video, so that you have a better look at how my setup is. I'm sure it can be done better.
For the sake of being complete, here the last vid, with closeup of the pads:
« Last Edit: April 18, 2015, 02:41:35 AM by Guitarpolson »