Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 19 of 19

Thread: multiple usb teensy MIDI

  1. #1
    Junior Member
    Join Date
    May 2017
    Location
    Edinburgh
    Posts
    5

    multiple usb teensy MIDI

    Hello there - my first post, so please be patient.

    Got interested in teensy last year, for DIY midi controllers. I've no background in electronics or programming, but enjoy experimenting. Been using MIDI sequencers for a number of years, though. I'm a fairly tactile person, dissatisfied with the feel and layout of midi controllers I've used, so thought I'd have a go at building my own, to control the software/plugins that I use the most. How hard can it be ? Metal cases, metal knobs, prominent visual indicators, something that feels sturdy.

    Ran through the tutorials, and I've got a few little projects up and running, based around breadboards in project boxes:

    a controller for peavey revalver, with 8 cheap button rotary encoders, 1 higher res optical encoder and a 1602 LCD display via a spi piggyback board. Used a shift register for the buttons, to increase cc values from the encoders at higher rate, as these cheap detent encoders only 20 or 24 counts for a full turn, can't remember which.

    a cubase track inspector controller, with 3 rotary encoders with buttons, (for track select, balance, output gain), 1 higher res optical encoder for input level, 9 LED button switches (for record enable, mute, solo, monitor etc) and a 1.44 SPI display. Used two MCP23017 chips for buttons and LED control, resistor ladder chip to protect LEDs.

    a kush hammer controller, with 3 button encoders (to select frequency), 3 334 line motor encoders (for cut/boost), 1.44 SPI display, 5 led buttons (bands in/out, bypass etc). 595 and 165 shift registers, resistor ladder for LEDs.

    Got a few more projects on the go, but I have a question.

    Got them all working individually, and bidirectionally - so, eg, pressing record enable button on box sets record enable in sequencer, and pressing record enable on sequencer illuminates record enable on box, same with encoder values for cc's. Fairly pleased with progress, it's been quite a learning curve for me.

    However, when I plug more than one in at once, they don't work in cubase. Three teensy's are visible, and all work correctly at the same time in midiox. All are visible in cubase, but only one will work. Tried using midox as midi merge via loopbe virtual midi port, but didn't work, seemed to be in a very slow feedback loop, downloaded copperlan to try same, but that only shows one teensy present. Hmm.

    So, my question is:

    is the issue with my coding, or is using more than one teensy usbmidi at the same time not possible using win7 class compliant driver? Tried looking around the forums, but couldn't find anything specific, so thought I'd ask.

    I've made a couple of smaller controllers using nano's and midi shields as they were cheap off ebay from China, for inserts, edit buttons, transport controls, which work very well, but of course each of these boxes need their own physical MIDI in/out. Rapidly running out of MIDI ports. Been looking at the iconnectivity MIO, as that appears to accept usb midi class compliant devices via a hub, but not sure if that will accept multiple instances of teensy and treat them as separate devices. If anyone has any experience with this, that would be appreciated, as if it will, then I'll probably buy one.

    So, sorry if a little long winded. As an aside, I'm using some aluminium boxes from diyerzone, but because my projects look like rats nests, the wiring means that I can't physically put the top on the cases. So, guess I'll need to look into making circuit boards next. Guess I'll be having lots of questions in the future....

    Thank you for your patience.

    Paul.

  2. #2
    Member
    Join Date
    Jan 2017
    Location
    Maastricht
    Posts
    97
    Hi,

    Did you see the MIDI_name example in Examples/Teensy/USB_MIDI? This shows how to change the name of your MIDI device, perhaps it will work if you give different names to each device.

    regards,

    Gerrit

  3. #3
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    942
    if changing names doesn't work you can change product IDs too but (last I heard) only by altering the core library document "usb_desc.h"

    Not sure what conflicts you could cause doing that....

  4. #4
    Junior Member
    Join Date
    May 2017
    Location
    Edinburgh
    Posts
    5
    Ah, I didn't have the MIDI_name in the examples - latest teensyduino wouldn't install in my version of the arduino ide (1.66). I've updated arduino now, along with the latest teensyduino, and will take a closer look at that next time I have some free time.

    I did try changing the product ID in the usb_desc.h, and device manager just showed an unknown device. Put it back to how it was, think I need to read up on that a little more before I'm comfortable with what I'm doing

    Thanks for your advice.

    Paul.

  5. #5
    Junior Member
    Join Date
    May 2017
    Location
    Edinburgh
    Posts
    5
    Quick follow up - after some tribulations. After uninstalling arduino and updating the IDE, some libraries, particularly ILI9163, no longer worked. Bugger. So, easiest thing seemed to be have two versions, but of course, libraries seemed to be problematic. Ended up I installed 1.6.9 on main PC, and latest one on a spare PC. Relieved I got them to work again - 9163 in particular, as I'd needed to re-amend the settings.h file to adjust the pixel offset Tried the MIDI_name, and have renamed one of the teensy controllers - this worked, in that it now appears as "kush eq" in midiox and cubase, but still shows as teensy MIDI in device manager. Still doesn't like playing at the same time, though, but for now, I can at least use 2 teensy controllers together - one on PC1, one on PC2, using copperlan and vmidi. Got a couple of other things to try, but reckon that hardware MIDI port is probably the most elegant way to go. Thanks for your interest.

    Paul.

  6. #6
    Junior Member
    Join Date
    Jun 2017
    Posts
    5
    hi, so I had this same problem when I converted 2 old pioneer cdj 800 to midi. each one had a teensy in and when I plugged them in It wouldn't always give them the same name/number. my solution was to set Traktor scratch midi out to all and have one teensy on ch1 and one of ch2. traktor would send midi to both at the same time and each one would just respond to it's own channel. It's not the most efficient way, but it works.

  7. #7
    Quote Originally Posted by Gerrit View Post
    Hi,

    Did you see the MIDI_name example in Examples/Teensy/USB_MIDI? This shows how to change the name of your MIDI device, perhaps it will work if you give different names to each device.

    regards,

    Gerrit
    I am using the latest teensyduino on a TeensyLC board. I can't seem to find the MIDI_name example. Can someone post the URL of the example?

  8. #8
    Member
    Join Date
    Jan 2017
    Location
    Maastricht
    Posts
    97
    Quote Originally Posted by tenorjazz View Post
    I am using the latest teensyduino on a TeensyLC board. I can't seem to find the MIDI_name example. Can someone post the URL of the example?
    The example is in the Arduino IDE, look under File > Examples > Teensy > USB_MIDI

    Kind regards,

    Gerrit

  9. #9
    I never did find the USB_MIDI examples. I thought I saw them there in the past, but they are not there now. I have done some uninstalls and re-installs and wonder if I messed something up somewhere.

    I did find the info someplace else and got it working. But now have created a new problem.

    I made changes in the desc.h file to both the name and the ID number to make it work. I read that the number is cached somewhere so if you just want to tweek the name you can't use the same ID number because it returns the old name. So the question is, how do you clear the cache??

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,595
    Quote Originally Posted by tenorjazz View Post
    I never did find the USB_MIDI examples.
    Maybe this screenshot can help?

    Click image for larger version. 

Name:	sc.png 
Views:	41 
Size:	267.9 KB 
ID:	12560
    (click for full size)


    This image is with the latest beta. For older versions, you click the same menu. It should have 4 samples in pre-1.41 versions.

  11. #11
    That's it, can't believe I missed it.

  12. #12
    Hi,

    I am new to Teensy too and want to build a midi controller. I started with the MIDI_name example. I uploaded it to my Teensy 3.6, but it comes up listed as "Teensy MIDI" instead of "My MIDI", which is what I was expecting.

    I am using a Macbook running OSX 10.11.3. and Arduino software 1.8.5.

    I checked in the Audio MIDI setup application on my Mac, in Ableton Live and in Max software. It was listed as Teensy MIDI in all of those things. Anything I am doing wrong?

    I will have lot's more questions, but maybe I can figure this out first.

    Thank You!

    Nick

  13. #13
    Here's what I learned...
    1. Open your Sketch in the Arduino IDE
    2. On the right hand side near the top you will see a down arrow. Click it an select "New Tab"
    3. Name the New Tab "name.c", all lower case
    4. Copy this code into name.c

    // To give your project a unique name, this code must be
    // placed into a .c file (its own tab). It can not be in
    // a .cpp file or your main sketch (the .ino file).

    #include "usb_names.h"

    // Edit these lines to create your own name. The length must
    // match the number of characters in your custom name.

    #define MIDI_NAME {'E','S',' ','2','C',' ','A','C',' ','V','0','0','1'}
    #define MIDI_NAME_LEN 13

    // Do not change this part. This exact format is required by USB.

    struct usb_string_descriptor_struct usb_string_product_name = {
    2 + MIDI_NAME_LEN * 2,
    3,
    MIDI_NAME
    };

    5. Modify the MIDI_NAME making sure you use the exact format (One character in single quotes, separated by a comma. A space is also one character)
    6. Modify the MIDI_NAME_LEN to match the number of characters
    7. Don't change anything else
    8. When you save the sketch it will also save the name.c file with it

    Compile the sketch as normal and you should see a new device name.

    This is all shown in one of the examples, but thought it might be easier for non-programmers to have the steps written out. Hope it helps.

  14. #14
    Hi,

    Thank you tenorjazz for your reply. That's pretty much what I did the first time. I tried it again. This time I looked under About This Mac / System Report / Hardware / USB and I can see the device name listed there as a USB device. So the naming worked, but it's just not recognized by the Audio MIDI Setup application, or any of the music software that I use. It's not that big of a deal though, I can work with this. I'm going to move on to hooking up sensors and other things to see if I can get that working.

    Thank You.

  15. #15
    Member
    Join Date
    Jan 2017
    Location
    Maastricht
    Posts
    97
    Quote Originally Posted by nicnut View Post
    Hi,

    Thank you tenorjazz for your reply. That's pretty much what I did the first time. I tried it again. This time I looked under About This Mac / System Report / Hardware / USB and I can see the device name listed there as a USB device. So the naming worked, but it's just not recognized by the Audio MIDI Setup application, or any of the music software that I use. It's not that big of a deal though, I can work with this. I'm going to move on to hooking up sensors and other things to see if I can get that working.

    Thank You.
    It should show up in the Audio MIDI setup. Are you sure you selected MIDI or Serial + MIDI under Tools>USB Type ?

    Kind regards,

    Gerrit

  16. #16
    Hi Gerrit,

    Yes, I selected MIDI under USB type. I added the name.c tab from the MIDI_name example to the analog control change example, and I am getting midi data into my computer, so I know that my Teensy is working, and the midi function is working.

    Do you have a mac? and in your Audio Midi setup does it show up as a custom name?

    thanks, Nick

  17. #17
    Member
    Join Date
    Jan 2017
    Location
    Maastricht
    Posts
    97
    Quote Originally Posted by nicnut View Post
    Hi Gerrit,

    Yes, I selected MIDI under USB type. I added the name.c tab from the MIDI_name example to the analog control change example, and I am getting midi data into my computer, so I know that my Teensy is working, and the midi function is working.

    Do you have a mac? and in your Audio Midi setup does it show up as a custom name?

    thanks, Nick
    Yes I have a Mac and the Teensy shows up with a custom name.

    Here's the content of my name.c file:

    Code:
    // To give your project a unique name, this code must be
    // placed into a .c file (its own tab).  It can not be in
    // a .cpp file or your main sketch (the .ino file).
    
    #include "usb_names.h"
    
    // Edit these lines to create your own name.  The length must
    // match the number of characters in your custom name.
    
    #define MIDI_NAME   {'Z','e','u','s','D','P','C'}
    #define MIDI_NAME_LEN  7
    
    // Do not change this part.  This exact format is required by USB.
    
    struct usb_string_descriptor_struct usb_string_product_name = {
            2 + MIDI_NAME_LEN * 2,
            3,
            MIDI_NAME
    };

    Kind regards,

    Gerrit

  18. #18
    Hi, I wanted to update everyone on this. I plugged my Teensy into a new macbook from 2018 and it showed up in the audio midi setup as the name I gave it, so it worked. My computer is 10 years old, so maybe that has something to do with why it doesn't work on my computer.

    Thank you

  19. #19
    Quote Originally Posted by nicnut View Post
    Hi, I wanted to update everyone on this. I plugged my Teensy into a new macbook from 2018 and it showed up in the audio midi setup as the name I gave it, so it worked. My computer is 10 years old, so maybe that has something to do with why it doesn't work on my computer.

    Thank you
    To see the name change you have to unplug the Teensy device and delete it from Audio Midi Setup and then plug it back in.

    The usb midi device is cached so apps that use it as a midi device will still show it even when it’s disconnected and you don’t have to reconfigure it every time it’s unplugged.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •