Teensy LC and MIDI library: MIDI_CREATE_DEFAULT_INSTANCE() not needed?

Status
Not open for further replies.

mpark

Member
When I try the code examples at https://www.pjrc.com/teensy/td_libs_MIDI.html I get this error: "'MIDI' was not declared in this scope". Based on my experience with non-Teensy Arduinos, I added a call to MIDI_CREATE_DEFAULT_INSTANCE() and that error went away (I have other problems, but one step at a time).

Question: Is MIDI_CREATE_DEFAULT_INSTANCE() supposed to be unnecessary with Teensy MIDI as the examples imply?
  • If so, am I somehow pulling in the wrong MIDI.h?
  • If not, the docs should be corrected.
2nd question: Is there a way to see the contents of header files in the IDE so I can see exactly what's being #included?
 
You cannot compile the example code unaltered?

If not post your code please. If so it suggests Teensyduino may not be installed properly since that code has worked for many others.
 
You cannot compile the example code unaltered?

If not post your code please. If so it suggests Teensyduino may not be installed properly since that code has worked for many others.

Right, I can't compile this example copied straight from the website:
Code:
#include <MIDI.h>

const int channel = 1;

void setup() {
  MIDI.begin();
}

void loop() {
  int note;
  for (note=10; note <= 127; note++) {
    MIDI.sendNoteOn(note, 100, channel);
    delay(200);
    MIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}
I had been using the MIDI library before upgrading to Teensy, so I'm wondering if maybe Teensyduino is pulling in the wrong version somehow? Just guessing.
 
Right, I can't compile this example copied straight from the website:

Opps, sorry about that.

Pretty much all of the web page was written when version 3.2 was the most recent. Looks like the info needs to be updated for the changes in MIDI 4.x. I've put this on my todo list.

Probably best to use File > Examples > MIDI Library, rather than the older examples from the web page.
 
Is there any chance that the transport options available under 4.x could be extended (one day) so that usbMIDI actually uses the MIDI library directly rather than trying to mimic it's behaviour?

It would be amazing if MIDI over BLE, MIDI over Ethernet, USB, soft serial and hard serial could all use the same library and features like running status translation and USB-to-serial thru by just setting options rather than having to have calls to different libraries.
 
I've started the journey to MIDI over BLE, using Nordic Semiconductor's nRF52... Dev Kit.
It's daunting.
I have a model use in a product called FreeDrum at https://www.freedrum.rocks, which attaches a small (Teensy-sized) device to each drumstick, and senses motion... sending MIDI over BLE to GarageBand et al on a phone or tablet. The videos on line are cool. The product itself is pretty cool.

They use the MIDI-over-BLE connection to:
- send MIDI drum streams to a midi synth (like GarageBand)
- configure their device and apply firmware updates from their iOS and android apps (sensorware)

So, MIDI over BLE would be a create add-on to a Teensy-based device.

@oddson, are you interested in this?
 
By the way, MIDI over BLE differs from MIDI over USD in that a timecode is needed with each message using BLE. That helps the receiver to attempt to properly space received messages - even in the face of BLE latency.
 
I've started the journey to MIDI over BLE...

So, MIDI over BLE would be a create add-on to a Teensy-based device.

@oddson, are you interested in this?
I'm very interested in this.
I'm not sure about the existing sieren/blidino parser for Ardunio.
It doesn't seem an ideal starting place to me.

Are you using that or building your own?
 
@oddson, the sieren/blidino parser you reference above looks like the right stuff, or related, anyway.

I'm trying to wrap my head around the nRF52 SOC (the descendant of the vRF51 used in the Red Bear hardware a few links down in your reference... http://redbearlab.com/redbearlab-nrf51822/)

To do MIDI over BLE cleanly, it looks like one would flash the nRF52 with code that:
  1. - communicates MIDI messages with the Teensy over SPI or I2C
  2. - buffers the outbound MIDI messages from Teensy until a radio connection is on (it will be intermittent)
  3. - sends and receives MIDI over BLE to a connected host.

I think we could flash the nRF52 from the Teensy at runtime using 4 pins dedicated for flashing, but I don't think that's traditional.
It seems like the usual path is to embed the BLE-ness of the chip via separate flashing, adding its services and characteristics. Nordic has their own bootloader to facilitate the nRF52 running on its own.

A Teensy BLE add-on using the nRF52 would be pretty useful - especially if it could be adapted for any BLE service (with flashing, or whatever).

I have the Nordic nRF52 Dev Kit and have downloaded and have run the demo programs from SES (Segger Embedded Studio - licensed for Nordic chip buyers)
It's all straightforward for use of the nRF52 as an SOC with BLE. Less clear is the nRF52 as a BLE-only add-on to a separate microprocessor.

Should we start a new thread around BLE MIDI?
 
Status
Not open for further replies.
Back
Top