This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Faster respond for midi application ?

I am using nrf52 , it's always connected to an iPhone, and I need a truly real time respond. I am sending short messages, like 2 characters at a time, and play a sound on the phone according to the messages( e.g "A","B")

Right now, it's fast but not enough for , lets say, play music, there is a 80-150ms delay from when I push the button , till I get the data on the phone, so if you would like to play a song it would be slowly.

Is sending new data every time via characteristic is the right way to go ? or is there another way like doing it without connection, and updating advertising data only ?

How you get the fastest respond for very short messages? what you usually do in these cases ?

Thanx

  • Wait, so is connection interval matter ? I was thinking that it's about interval between advertising..

    My intervals are :

    #define MIN_CONN_INTERVAL               MSEC_TO_UNITS(20, UNIT_1_25_MS)             /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
    #define MAX_CONN_INTERVAL               MSEC_TO_UNITS(75, UNIT_1_25_MS)
    
  • Oh my bad, I'd never thought you use unreliable transfer media such as Advertisement for MIDI;) Sure, you can try to use 20ms adv. interval but you will be loosing packets, iOS scanning will keep up only if screen is woken up, device unlocked and your app on the foreground (and even then I would assume at least 1% loss over some longer time). If you really just advertise then you can easily blame ~100ms delay to simply slow transport of scanning events through the system (I'm not the mobile dev unfortunately to provide more experience). With connection-based link you should easily achieve "every connection interval" latency so delays up to 30ms but not more.

  • I assume iOS device is GAP Central aka master so it selects connection interval. There is a method to ask for better parameters but it has limited effect (most of mobile devices follow, some ignore it and some will disconnect in reaction). You could try to reverse the flow and let iOS device to Advertise (= GAP Peripheral) while embedded device can be GAP Central. Then you should be able to go below 30ms with connection interval (I would not hope to go down to 7.5ms which is limit by BT SIG Core specification but you could achieve 15ms).

  • I did not understand a word from your last note :) Anyway, I think I am at the maximum, I use a regular uart example to send a single letter every time I push a button, and it's not fast enough .

    I still wonder how midi solves that ( your link says it's 2.7x more faster )

  • iOS do not give you any access to the stack(intervals etc) , you can just be central , register to characteristic and get notified, thats it, and that's what I do right now. It's fast enough for remote control, but not to play music. I wonder how other BLE midi controllers works, and how midi solves that.

Related