Comments (29)


hello do you have a code for teensy 3.1 or this will work on that as well
thank you..

4 years ago

    Hey! I have not yet tried a teensy 3.1, but I think it will probably work exactly the same. Let me know if you have any problems…I’ve ordered a few 3.1 boards and will be testing them out next week.

    4 years ago

so did you try with a teensy 3.1?

3 years ago

    oh yeah, i forgot to revisit this: yes, this code works perfectly with the teensy 3.1 as well.

    3 years ago

Hi !

Nice projet ! I’d like to try it

What about the responsivity ? is it reactiv enough or do you have a little latency ?

3 years ago

    I’ve never noticed any latency at all, everything I’ve made is just as responsive as any commercial MIDI controller.

    3 years ago

Could you make a tutorial on how to make our own please ?

3 years ago

    I probably should, I’ll put it on my list of things to do!

    3 years ago

Just a schematic would be nice to begin with !

3 years ago

Can you please post the schematic?
In the meantime: do the touch sense inputs use 1 meg resistors to ground or to another pin?

2 years ago

    Hi there,
    I don’t really have a schematic for this – you don’t need to do any special wiring on the touch inputs, they are automatically configured to work when you call them touch pins in the code. So you just need to say “touchRead(pin_number)” and then connect some sort of wire directly to that pin (and touch it).
    I hope that makes sense!

    2 years ago

Hi, do you know if you can send an especific Midi Port number using this usb.midi? something that can be read by ctlin in a Max patch. Thanks nice work!

2 years ago

    I’m not 100% sure I understand what you’re asking – this code should work with the ctlin object in a Max patch over USB as it is. I think it comes up as a device called Teensy USB…if you want to change that name to something specific it’s apparently a bit more effort (and I’ve never bothered).
    Does that make sense? Let me know if I’m not actually answering your question!

    2 years ago

Hi Yann,
is it possible to use the touch pins as note triggers with velocity sensitivity? If yes, could you provide us with code for this feature? I haven’t found anything about this on the web so far. Thanks in advance!

2 years ago

    In my experience, making velocity sensitive notes using touch pins is challenging, because of the way MIDI note messages work – you have to send the message for the note and the velocity at the same time. That is really impractical to do with a touch pin, because by the time you’ve sent the note value the amount of touching will have changed a lot. You can get a quite good range of values from how much you’re touching, but it’s pretty much impossible to send the value of how much you’re touching to the note velocity in a way that feels right! In practice, by the time you’ve sent the note paired with a velocity it’s too late and you only sometimes get a direct correlation between touch and volume.
    It’s quite hard to explain, I hope that makes some sense. There are a couple of possible approaches:
    – Make a small delay between capturing the touch value and sending the note. This would have the advantage of probably getting a more accurate correlation between how much you’re touching and the eventual velocity, but the major downside would be a significant feeling of latency.
    – Avoid using velocity at all and instead use Aftertouch. I think this is the best solution, even though aftertouch isn’t used all that much in most MIDI software or hardware. You could assign aftertouch to control volume, and then use the MIDI.sendAfterTouch message using the value of your touches. I haven’t tested this but I feel like it should work!
    In any case, you’d have to make a system for calibrating the touch values, as they can vary wildly depending on what you are using as your conductive object. I would approach this by making all values set to 0 on startup, and then have a button you can press whilst touching the object which would then set that as the maximum of 127.
    I hope that makes sense, good luck!

    2 years ago

Hello sir can i make a midi controller using teensy, which will control pitch or tempo with 2 pushing button (-button and + button) instead of potentiometer , can potentiometer control be changed into 2 button (- and +) if yes what is type of this controller ,,,,thank you

2 years ago

    Hello there,

    Yes it would certainly be possible to make a controller that uses buttons to control the tempo rather than a potentiometer. It would take a bit more code.

    Off the top of my head:

    You would first want to set up two buttons going into the teensy, and you’ll want to set them to increment and decrement an integer variable. There are a number of ways to do this, perhaps the best way is here:

    Taking that code as a starting point, you would have one button doing buttonPushCounter++ and the other doing buttonPushCounter–.

    Then you send that variable out a MIDI CC controller output and map it in the software.

    I hope that helps!


    2 years ago

Hi Yann. Really cool project you have.

This may be a newby question and if so, I apologize.

Online, all of the Teensy boards I see, show to have only 11 touch sensitive pins, however, your project shows to have a few more. How did you get the extra pins?

Thanks for your time and information!


1 year ago

    Hey there, thanks for the kind words.
    The smaller Teensy boards have 12 built-in touch sensitive pins…three of these are accessible only as little pads on the underside of the board, so they are a bit impractical to use if you’re not used to surface mount soldering.
    I imagine you’re referring to my touch sensitive piano prototype, which used 15 or so touch pins if I remember right…to do that I used a different method, using a Teensy++ and this system:

    I don’t completely remember the circuit I made, but the details are on that site. Essentially each touch pad needs to be connected to a “receive” pin, as well as a “sensor” pin. The various touch pads can share a receive pin. The resistors you use set the sensitivity. Because the Teensy++ has so many pins this allows you to have more touch sensitive inputs.

    I hope that helps!

    1 year ago
Diego Leroux

Hi Yann, thanks a lot for your code ! I want to have a number of pots and buttons sending midi notes, and have 2 other buttons selecting banks, in order to send different MIDI notes depending the bank I’m in. Is it possible ? Thanks !

1 year ago

    That sounds like a good idea, I guess this could also be like octave up/down buttons?
    I suppose the way I would do that would be to program the “bank” buttons to add an offset to the midi note number coming out of the array. If that was in multiples of 12 then it would be octaves. Does that make sense?

    1 year ago

Hello sir , please help me & read carefully bellow statement.
I am using a music software FL Studio. in this software the main tempo is increased or decreased by turning scroll wheel of usb mouse (up & down), when pointer of usb mouse is placed on particular position (Tempo Digits) in software window . can i do this action by input from teensy board, without placing mouse pointer on that particular position in software window. if yes please tell me about correct code for teensy for these actions.
sir, i have already tried a code (in teensy board) with help of ,teensy is sending cc messege to music software.but it failed according to my need.because when software is run first time,parameter is increased or decreased with unwanted/big change . inc/dec of parameter is not begins from current value.
when a new software file of (150 bpm) is opened after closing of file (90 bpm),then inc/dec is not begins from current file(150),inc/dec is begins from previous file (90 bpm).here i wants that tempo inc/dec should be begins from current value by use of teensy board. i think sending cc messege to software will not update tempo from current value.
instead of it, turning scroll wheel of usb mouse is always begins inc/dec from current value, when mouse pointer is placed on Tempo digits in software window.

at last , i want to inc/dec tempo in softwre from current tempo by use of teensy board.

if it is possible,,,,,,,,,,please help me about code or anthing more………….thank you

1 year ago
Christopher Allen

Do you have any code for pitch and modulation wheels? I am looking to integrate these into my midi controller but I am a beginner coder to say the least. Thank you

12 months ago

    Hi there,
    I’m pretty sure that in most cases the modulation wheel just uses CC number 1 (as described here), so you could use this code as is to send mod wheel information.
    Pitch bend is a separate thing, though! I need to update this code a bit anyway so I’ll try to include that in the next revision. It looks as though there is a function called “usbMIDI.sendPitchBend” though to be honest I’m not entirely sure how it works…

    11 months ago
Rajiv Deo

Tried compiling the v2.0 ino file. Getting missing “midi.h” error. Any inputs?

9 months ago

    My apologies, I only just saw this comment. I’m not sure what that error is – perhaps the MIDI library is not properly installed?

    8 months ago
    Santiago Torres

    The code is missing a line ->

    put this just after #include
    this way:


    1 month ago

Trying to make your code work but keep getting the following error message. Can you help?

Arduino: 1.8.5 (Mac OS X), TD: 1.40, Board: “Teensy 3.2 / 3.1, MIDI, 96 MHz (overclock), Faster, US English”

teensy_MIDI_controller_v2: In function ‘void setup()’:
teensy_MIDI_controller_v2:95: error: ‘MIDI’ was not declared in this scope
teensy_MIDI_controller_v2: In function ‘void loop()’:
teensy_MIDI_controller_v2:134: error: ‘MIDI’ was not declared in this scope
MIDI.sendNoteOn(touchpitch[i], 100, channel);
teensy_MIDI_controller_v2:139: error: ‘MIDI’ was not declared in this scope
MIDI.sendNoteOff(touchpitch[i], 100, channel);
teensy_MIDI_controller_v2:151: error: ‘MIDI’ was not declared in this scope
MIDI.sendNoteOff(digitalpitch[i], 100, channel);
teensy_MIDI_controller_v2:156: error: ‘MIDI’ was not declared in this scope
MIDI.sendNoteOn(digitalpitch[i], 100, channel);
teensy_MIDI_controller_v2:166: error: ‘MIDI’ was not declared in this scope
MIDI.sendControlChange(digitalPinsCC[i], 0, channel);
teensy_MIDI_controller_v2:171: error: ‘MIDI’ was not declared in this scope
MIDI.sendControlChange(digitalPinsCC[i], 127, channel);
teensy_MIDI_controller_v2:184: error: ‘MIDI’ was not declared in this scope
MIDI.sendControlChange(analogPinsCC[i], newVal[i]>>3, channel);
‘MIDI’ was not declared in this scope

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

5 months ago

    Hi! I only just noticed your comment, and I realise this is very late. You’ve probably figure it out by now, but it looks to me like one f two things…you might just need to change your USB type to MIDI. Before uploading your code, you first need to change your Board to Teensy (it looks like you’ve done this already) by going Tools -> Board -> Teensy (whatever model you are using, then go back to Tools -> USB Type and select “MIDI”.

    The other thing it could be is that you’re missing the Arduino MIDI library. You can install that via the library manager at Sketch -> Include Library -> Manage Libraries.

    3 weeks ago

Leave a Reply

Your email address will not be published. Required fields are marked *