<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29350/reducing-latency---ble-nano-as-midi-controller</link><description>Hi All, I am building a wireless MIDI controller using the BLE nano v2.0 from RedBearLab.
MIDI is a protocol to control software musical instrument, therefore latency needs to be &amp;lt;10ms and at the moment it ranges roughly between 20 and 100ms. 
 I am</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 02 Feb 2018 11:22:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29350/reducing-latency---ble-nano-as-midi-controller" /><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/119507?ContentTypeID=1</link><pubDate>Fri, 02 Feb 2018 11:22:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a1a4bb2-6a21-476e-9abb-074664fcff28</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;So I guess you need low latency, and not necessarily high throughput, right? Then the&amp;nbsp;most vital parameter to tweak is the connection interval. The lower the better. Are you able to provide some sniffer traces? It would be interesting to see exactly which parameters are used and the differences between your two modules. You can use a spare Nordic development kit and our &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.tools/dita/tools/sniffer/sniffer_intro.html?resultof=%22%73%6e%69%66%66%65%72%22%20" rel="noopener noreferrer" target="_blank"&gt;Sniffer solution&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/119399?ContentTypeID=1</link><pubDate>Thu, 01 Feb 2018 16:06:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20e4cbc5-472a-441d-8429-54a90b8fcbf1</guid><dc:creator>Pasquale</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;I wanted to give an update on this as I changed strategy a bit.&lt;br /&gt;&lt;br /&gt;Basically I am trying to use the HID service to trigger sound.&amp;nbsp;At the moment is okay as we are just testing usability.&lt;br /&gt;&lt;br /&gt;I am using Keil Univision and I have successfully uploaded the HID Nordic Example on the BLE nano and the latency now is much much better than before. However it is still noticeable.&lt;/p&gt;
&lt;p&gt;As you may have understood, I am not an expert user of these tools, so I wanted to ask if there are parameters&amp;nbsp;in the HID example that I can change or even parts of the code that I can eliminate to&amp;nbsp;make the communication faster.&lt;/p&gt;
&lt;p&gt;Thanks for any advice!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116753?ContentTypeID=1</link><pubDate>Thu, 25 Jan 2018 08:41:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0c963ab-854b-4801-bcee-f4c3d625a06e</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;It could be that your laptop just decides on some connection parameters, but that your feather automatically starts a new connection parameter update process requesting faster parameters while your RedBearLab just accepts the initial configuration. Some sniffer traces could help to prove this. Or you can look at your RedBearLab code and try to figure out whether that does this automatically too.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116762?ContentTypeID=1</link><pubDate>Tue, 23 Jan 2018 11:44:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4d47530-ee26-4f21-9534-d1ddc6d5016f</guid><dc:creator>Pasquale</dc:creator><description>&lt;p&gt;The code is different, because Adafruit has developed its own libraries to work with ble.&lt;/p&gt;
&lt;p&gt;For example, to send a message through UART with the feather, you just need to use:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ble.print(&amp;quot;message&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;with the Nano everything is a bit more complicated. I am linking the complete code I am using just to test the UART service latency.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/PasqualeTotaro/BLEnanoMIDI/blob/master/UARTtest.ino"&gt;Code&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks for any insight.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116760?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 13:34:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:080183b5-f5ff-4f80-a55f-8bb4ad632a61</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Are you using the same code on the Nano and Bluefruit?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116758?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 12:39:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d84a3e14-2997-4f42-ade9-78b3dcc05468</guid><dc:creator>Pasquale</dc:creator><description>&lt;p&gt;The other Board was a Feather 32u4 and was always using UART service with it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116759?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 08:58:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e804aa4-6b79-4062-80f3-af38a2dbb781</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Was the other board also using a proprietary BLE service? Or was it using the &lt;a href="http://www.hangar42.nl/wp-content/uploads/2017/10/BLE-MIDI-spec.pdf"&gt;actual MIDI service&lt;/a&gt;? As mentioned, this might make a big difference.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116757?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 19:53:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78205ad6-092b-4fd5-a4fd-46d7f98f00c7</guid><dc:creator>Pasquale</dc:creator><description>&lt;p&gt;Thanks for the comment.&lt;/p&gt;
&lt;p&gt;I am using a MacBook Pro as a central device and the latency ranges between 30 and 100 ms, it varies. It is true that the UART service is slower but I have achieved better performances with another board (with its own firmware) and works better that the BLE Nano. However, I need to use the Nano for dimensions.&lt;/p&gt;
&lt;p&gt;Are there other parameters I can play with to increase the Throughput of the UART service.&lt;/p&gt;
&lt;p&gt;Also, does any body know how to implement the MIDI service on the BLE Nano?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116761?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2018 10:30:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0999d87e-9173-4fc7-8db7-d299c94255d4</guid><dc:creator>MartinBL</dc:creator><description>&lt;ol&gt;
&lt;li&gt;What kind of central device do you use? A phone? Apple? Android? If my memory serves me right, I believe all iOS devices have some limits of how short your connection intervals can be, &lt;em&gt;except&lt;/em&gt; on the MIDI service which allows 7.5ms intervals. So if you are using the UART service for testing that probably won&amp;#39;t work very well in terms of latency. Here is a useful write up on the matter: &lt;a href="https://punchthrough.com/blog/posts/maximizing-ble-throughput-on-ios-and-android"&gt;Maximizing BLE Throughput on iOS and Android&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Do you have a way of figuring out what connection intervals are being used? Logs?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116756?ContentTypeID=1</link><pubDate>Sat, 13 Jan 2018 18:11:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c086a1a1-a627-4ba0-b5ea-ccc253e9ab33</guid><dc:creator>Pasquale</dc:creator><description>&lt;p&gt;Thanks for the suggestion.
I have tried to use these settings, but the latency actually increased.&lt;/p&gt;
&lt;p&gt;Any other ideas?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116754?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2018 12:15:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fc217f8-b683-406c-b831-29ad07b94937</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;It is the central (your laptop) that ultimately decides on the connection interval the min max values that you use on the peripheral side is just there to show the central the &lt;em&gt;preferred&lt;/em&gt; intervals. I don&amp;#39;t know what your laptop does when you try setting the intervals to 1.25 which is outside the legal range according to the BLE spec. I didn&amp;#39;t even think it was possible to do without making the Softdevice complain. Have you tried setting the min/max intervals to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define MIN_CONN_INTERVAL               BLE_GAP_CP_MIN_CONN_INTVL_MIN;
#define MAX_CONN_INTERVAL               BLE_GAP_CP_MAX_CONN_INTVL_MIN;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116755?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2018 10:56:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d10a962-093b-43d7-a038-77e9f4f20ad0</guid><dc:creator>Pasquale</dc:creator><description>&lt;p&gt;Thanks for the comments, it all makes sense. In fact, my latency requirements are a target, but there can be a comfortable compromise where the application still works.&lt;/p&gt;
&lt;p&gt;There is an Apple iOS BLE service exactly for MIDI and that might be something that gives the solution.&lt;/p&gt;
&lt;p&gt;On the other end, I have already experience much shorter latency with the Adafruit Feather 32u4, using the same exact configurations and utilities on my laptop, therefore I am pretty sure that are settings or firmware updates I can do on the BLE nano to improve the current latency, I just don&amp;#39;t know what.&lt;/p&gt;
&lt;p&gt;Any other comment is appreciated :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reducing latency - BLE nano as MIDI controller</title><link>https://devzone.nordicsemi.com/thread/116752?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2018 01:49:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f224361b-c287-4830-ab97-d963201b2b02</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Hi, few comments:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You cannot set min and max connection interval in Peripheral Preferred Connection Parameters or anywhere else) because the lowest allowed interval by BT SIG core specification is 7.5ms.&lt;/li&gt;
&lt;li&gt;As visible from previous point the latency can be under 10ms only if you are sure there will be no packet loss which won&amp;#39;t be the case. Even in 2.4GHz &amp;quot;quite&amp;quot; environment there will be some loses sooner or later. On the other side it might be fine for you in the end, it&amp;#39;s all probabilistic game which might have acceptable values from your application point of view.&lt;/li&gt;
&lt;li&gt;I&amp;#39;ve seen MIDI over low-power radio implemented on nRF24, 51 and 52 but as there are always two sides io the transfer and such solution won&amp;#39;t be probably interoperable (so you will need to put HW+FW to both sides of the link) then you might want to explore other radio protocols then BLE. I&amp;#39;ve seen at least two &amp;quot;MIDI over BLE&amp;quot; implementations on nRF chips but all of them used &amp;quot;proprietary&amp;quot; protocols like gazell or ESB, mainly because of latency requirements (I&amp;#39;ve even heard from two musicians that already 1ms out of sync will cause troubles and basically kills current song if it happens... however I&amp;#39;m not musical guy so you probably know what you are doing...&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>