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

Thread: Teensy MIDI, iOS and the Camera Connection Kit

  1. #1

    Teensy MIDI, iOS and the Camera Connection Kit

    Hi there! I was wondering if other Teensy users could share their experience of using Teensy MIDI with iOS. I work with musicians with disabilities and so most if not all of what I do with Teensy is making weird little bespoke, accessible, usually MIDI-based instruments for my students. I don't have any specific code/examples to share I'm afraid but I feel like a couple of years ago, I could connect a Teensy as a MIDI device to an iPad via a camera connection kit and it would work straight away. I even remember successfully running/powering projects through my iPhone 4 without problems. Now it seems like nothing is recognised by the iPad when I am using apps like Thumbjam, Korg Gadget and various other synths which I am sure worked before. I can't be certain what, if anything I am doing differently (drawing too much power? missing a line of code?) and what Apple might have changed in their requirements. I would love to hear from anyone who can confirm that I am not going mad (i.e. stuff used to work and now it doesn't) or even better, anyone who could give me some guidance as to where to look to get iOS playing nice again!

    Thanks so much in advance!!!

    P.S. I actually could post some code of one of my not-working-with-iPad projects if it will help!

  2. #2
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Posts
    833
    It’s a possibility that the newer Teensy requests more power than the older one, just a theory. As a result, the power requirement is much greater than the camera connection kit can provide on its own, therefore it doesn’t work. Teensy uses generic usb midi drivers, therefore as long as the OS has midi drivers it will work and iOS has these so it’s likely not an issue on that front. If you get the new camera connection kit it has a lightning port as well as usb, not just to charge the device as the same time, but it will provide more power to the USB port from my understanding. This is a possible solution if it’s only a power requirement problem, which I suspect it may be.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,206
    Maybe try editing bMaxPower in usb_desc.c, currently at line #595. If using a Mac, control-click on Arduino and "Show Package Contents" to get access to the files inside. On Linux & Windows the Arduino software is just an ordinary folder. On Windows the default location is C:\Program Files (x86)\Arduino. Once you have the folder, just search for "usb_desc.c"...

    This bMaxPower number is how much current Teensy tells the host it will consume. Currently the default is 50, meaning we're claiming 100 mA will be used. No Teensy actually uses that much, unless you add more circuitry.

    I recall a few times people using iOS devices have said this helped. I'm not sure there's ever been any really good feedback about what is really needed. If you gain any insight, hope you'll share your findings here?

  4. #4
    Junior Member
    Join Date
    Nov 2019
    Posts
    1
    Hey, I had the same problem and what fixed it was to setup the Teensy as strictly "MIDI" rather than "Serial + MIDI". Hope that helps.

  5. #5
    Junior Member
    Join Date
    Mar 2021
    Posts
    1
    Hey PaulStoffregen,

    My Teensy LC didnot work when it connectted with Iphone12.
    there is no MIDI Source and Destination found, and from you post, i wanna check the usb power threshold but didnot find the usb_desc.c you mentioned

    1. Could you guild me the detail location of the usb_desc.c on Mac.

    2. Here is my implemention:
    @implementation MIDISource
    + (NSArray *)allSources {
    NSMutableArray<MIDISource *> *sources = [[NSMutableArray<MIDISource *> alloc] init];

    ItemCount sourceCount = MIDIGetNumberOfSources();
    for (ItemCount i = 0; i < sourceCount; ++i) {
    MIDIEndpointRef endpoint = MIDIGetSource(i);
    if (endpoint) {
    MIDISource *source = [[MIDISource alloc] init];
    source.endpoint = endpoint;
    [sources addObject:source];
    } else {
    NSLog(@"Error getting source at index %lud, skipping.", i);
    }
    }

    return sources;
    }

    MIDIGetNumberOfSources() return 0 and MIDIGetNumberOfDestinations() return 0 also,
    do you know how to resolve this kind of issue.
    Last edited by YangLiu; 03-31-2021 at 10:56 AM.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,206
    Quote Originally Posted by YangLiu View Post
    Could you guild me the detail location of the usb_desc.c on Mac.
    Hold the control key and click Teensyduino. Click Show Package Contents.

    In the new package contents window, navigate to Contents > Java > hardware > teensy > avr > cores. There you will find folders named teensy3 and teensy4. Both contain usb_desc.h. If using Teensy LC, edit the copy in the teensy3 folder.

    As soon as you edit any file inside the application bundle (package contents), the digital signature which Apple Gatekeeper checks will no longer be valid. Usually it is not a problem if you do not move or copy the software elsewhere on your Mac. But do understand Apple has tightened security in MacOS in recent version and they are likely to continue this trend after Big Sur.

Tags for this Thread

Posting Permissions

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