Android Bluetooth LE

Suggest and discuss new features here.
User avatar
zed
Posts: 9
Joined: Wed Oct 04, 2017 4:22 pm

Android Bluetooth LE

Postby zed » Wed Oct 04, 2017 5:17 pm

Hallo, ich erlaube mir, in deutsch zu schreiben und weiter unten eine GT-Übersetzung für englisch beizufügen.
Hello, if you don't unterstand German, please have a look at the English translation below.

Gemäß der Spezifikation für MIDI über Bluetooth LE für Android arbeitet die derzeitige Implementierung in G-Stomper Studio und Beast fehlerhaft bei der Erkennung verbundener MIDI-Geräte.

Die Spezifikation findet ihr hier: https://developer.android.com/reference ... n_entities

Die G-Stomper-Apps scheinen diese Schnittstelle aber nicht zu verwenden, um verbundene BTLE-Geräte aufzulisten, oder führen einen (überflüssigen) Abgleich mit denjenigen Geräten durch, die über die normale Bluetooth-Schnittstelle als „gepaired“ abgerufen werden können.

Weiter unten im Kapitel „Using MIDI Over Bluetooth LE“ wird das entsprechend dargestellt:

„Before using the device, the app must scan for available BTLE devices and then allow the user to connect. (…) The app will only want to see MIDI devices and not mice or other non-MIDI devices. So construct a ScanFilter using the UUID for standard MIDI over BTLE. MIDI over BTLE UUID = "03B80E5A-EDE8-4B33-A751-6CE34EC4C700". (…) Once the MIDI/BTLE device has been opened by one app then it will also become available to other apps using the MIDI device discovery calls described above.“

Für die Verbindung zwischen Geräten und Apps, die MIDI über BTLE korrekt implementieren aber die Verbindung selbst nicht aufbauen, kann die Verbindung also auch über externe Apps hergestellt werden, z.B. https://play.google.com/store/apps/deta ... ring&hl=de

Der korrekte Weg zur Erkennung verbundener Geräte wäre also, statt dem Android-Bluetooth-System das Android-MIDI-System abzufragen.

Durch den bisherigen Mechanismus zur Entdeckung von BLTE-Geräten ist es nicht möglich, z.B. die BTLE-Geräte von AKAI mit G-Stomper-Apps zu verwenden. Die AKAI-Geräte lehnen (sinnvollerweise) jeden Pairingversuch ab, der nicht, wie oben beschrieben, explizit ein MIDI-over-BLE Pairing versucht. Hierdurch ist es unter Android 7.1.1 nicht möglich, diese Geräte über die „normalen“ Bluetooth-Werkzeuge des Android-Systems zu verbinden…

Zur Fehlerbehebung würde es genügen, die Abfragen an das Bluetooth-System von Android durch Abfragen des MIDI-Systems von Android zu ersetzen.

Ein Beispiel für eine korrekte Implementierung findet ihr zum Beispiel bei DRC. Diese App verbindet sich nicht selbständig mit BTLE-Geräten, sondern nutzt die vorhandenen Verbindungen zu BTLE-Geräten über die MIDI-Schnittstelle.

Darf man erwarten, dass bei G-Stomper das Verfahren zur Geräteerkennung irgendwann an diesen Standard angepasst wird?

Auf Dauer ist es leider langweilig, eure fantastischen Apps nur über die On-Screen-Steuerungen zu benutzen… :P

Grüße, Zed

According to the specification for MIDI via Bluetooth LE for Android, the current implementation in G-Stomper Studio and Beast is faulty in detecting connected MIDI devices.

The specification can be found here: https://developer.android.com/reference ... n_entities

However, the G-Stomper apps do not seem to use this interface to list connected BTLE devices, or perform a (superfluous) matching with devices that are paired through the normal Bluetooth interface.

In the chapter "Using MIDI Over Bluetooth LE" you'll find the following section:

„Before using the device, the app must scan for available BTLE devices and then allow the user to connect. (…) The app will only want to see MIDI devices and not mice or other non-MIDI devices. So construct a ScanFilter using the UUID for standard MIDI over BTLE. MIDI over BTLE UUID = "03B80E5A-EDE8-4B33-A751-6CE34EC4C700". (…) Once the MIDI BTLE device has been opened by one app then it will also become available to other apps using the MIDI device discovery calls described above.“

Apps that implement MIDI through BTLE correctly aren't forced to establish the connection itself. The connection can also be established via external apps, e.g. https://play.google.com/store/apps/deta ... ring&hl=de

So the correct way to detect connected devices is to query the Android MIDI system instead of querying the Android Bluetooth system.

Due to the present mechanism for detecting BLTE devices, it is not possible to connect AKAI BTLE devices with G-Stomper apps. The AKAI devices reject (correctly) any pairing attempt, that is not, as described above, an explicitly MIDI-over-BLE pairing attempt. With Android 7.1.1 is it not possible to connect these devices via the "normal" Bluetooth tools of the Android system...

For troubleshooting, i guess it would be enough to replace the queries to Android's Bluetooth system by querying the Android's MIDI system.

An example of a correct implementation can be found at DRC, for example. This app does not connect itself to BTLE devices, but uses the existing connections to BTLE devices via the MIDI interface.

Can we expect that G-Stomper will adopt the correct method for device recognition?

In the long run it would be maybe boring to use the touch ui for controlling your fantastic apps...: P

Regards, Zed
The secret of success is sincerity. Once you can fake that you've got it made. – Jean Giraudoux

(Android: OP3, Nvidia K1 · MIDI: AKAI LPK25 Wireless, AKAI LPD8 Wireless)
User avatar
planet-h
Posts: 1017
Joined: Wed Jun 19, 2013 4:46 pm
Contact:

Re: Android Bluetooth LE

Postby planet-h » Thu Oct 05, 2017 4:27 pm

Welcome to the forum, zed.
And thanks for your detailed explanation.

I hope you forgive me that I answer in English.

zed wrote:Gemäß der Spezifikation für MIDI über Bluetooth LE für Android arbeitet die derzeitige Implementierung in G-Stomper Studio und Beast fehlerhaft bei der Erkennung verbundener MIDI-Geräte.

Bluetooth MIDI exists since a long time, much longer than the Android M MIDI specification.
How an app handles Bluetooth devices is completely in hands of its developer.
Therefore I've moved your topic to Feature Requests, as this is what it actually is.


zed wrote:Die Spezifikation findet ihr hier: https://developer.android.com/reference ... n_entities

As you surely expect, we're well informed about the Android M MIDI specs and the way they recommend to handle BLE Pairing.
It is handed that way in G-Stomper for several reasons (but that's a different story and not part of this discussion).


zed wrote:Die G-Stomper-Apps scheinen diese Schnittstelle aber nicht zu verwenden, um verbundene BTLE-Geräte aufzulisten, oder führen einen (überflüssigen) Abgleich mit denjenigen Geräten durch, die über die normale Bluetooth-Schnittstelle als „gepaired“ abgerufen werden können.

Weiter unten im Kapitel „Using MIDI Over Bluetooth LE“ wird das entsprechend dargestellt:

„Before using the device, the app must scan for available BTLE devices and then allow the user to connect. (…) The app will only want to see MIDI devices and not mice or other non-MIDI devices. So construct a ScanFilter using the UUID for standard MIDI over BTLE. MIDI over BTLE UUID = "03B80E5A-EDE8-4B33-A751-6CE34EC4C700". (…) Once the MIDI/BTLE device has been opened by one app then it will also become available to other apps using the MIDI device discovery calls described above.“

G-Stomper does only search for paired BLE MIDI devices with the BTLE UUID = "03B80E5A-EDE8-4B33-A751-6CE34EC4C700". And as a matter of course, G-Stomper will never ask you to use your mouse or anything other than valid BLE MIDI hardware as MIDI device. It just does not pair them itself. At the end, paired BLE devices are all kept in the same pool.


zed wrote:Der korrekte Weg zur Erkennung verbundener Geräte wäre also, statt dem Android-Bluetooth-System das Android-MIDI-System abzufragen.

Also here, there is no correct or false way. I agree, that using the Android MIDI System is the more modern way. But as said, BLE MIDI existed years before the Android M MIDI API came out.


zed wrote:Durch den bisherigen Mechanismus zur Entdeckung von BLTE-Geräten ist es nicht möglich, z.B. die BTLE-Geräte von AKAI mit G-Stomper-Apps zu verwenden. Die AKAI-Geräte lehnen (sinnvollerweise) jeden Pairingversuch ab, der nicht, wie oben beschrieben, explizit ein MIDI-over-BLE Pairing versucht. Hierdurch ist es unter Android 7.1.1 nicht möglich, diese Geräte über die „normalen“ Bluetooth-Werkzeuge des Android-Systems zu verbinden…

Agree here, due to this fact it makes actually sense to consider a redesign of the BLE MIDI device handling in G-Stomper.
Even though I think it's not the best practice to refuse the pairing over the regular BLE pairing mechanism.
To be honest, I've never heard of such a behavior before, and I can hardly believe that this is really because of the pairing.
How do you come to that opinion?
Did AKAI told you that?
Or is there any documentation from AKAI that says you can only pair their MIDI devices within an app?

Just out of curiosity... did you ever try the regular pairing on any other Android device?


zed wrote:Darf man erwarten, dass bei G-Stomper das Verfahren zur Geräteerkennung irgendwann an diesen Standard angepasst wird?

Auf Dauer ist es leider langweilig, eure fantastischen Apps nur über die On-Screen-Steuerungen zu benutzen… :P

Thanks for the kind words, I'm glad to hear that you're generally happy with the apps.

And yes, it can be expected.
I cannot give you any promise for an e.t.a. yet, but it will be done in some future release.
User avatar
planet-h
Posts: 1017
Joined: Wed Jun 19, 2013 4:46 pm
Contact:

Re: Android Bluetooth LE

Postby planet-h » Thu Oct 05, 2017 6:45 pm

zde wrote:Ein Beispiel für eine korrekte Implementierung findet ihr zum Beispiel bei DRC. Diese App verbindet sich nicht selbständig mit BTLE-Geräten, sondern nutzt die vorhandenen Verbindungen zu BTLE-Geräten über die MIDI-Schnittstelle.

This is exactly what G-Stomper does.
It looks at the already paired BTLE MIDI devices (only MIDI devices) and offers them to you.
It doesn't make any connection by itself.

Also, the pairing in the MIDI BTLE pairing example app at..
https://play.google.com/store/apps/deta ... ring&hl=de
..is exactly the same as in the regular Android pairing.
The only difference is that the MIDI BTLE pairing example app filters all non-MIDI devices out while scanning for unpaired devices.

May I ask what device you're using?
Phone brand and model + Android version
AKAI BTLE MIDI device model

Thanks in advance.
User avatar
zed
Posts: 9
Joined: Wed Oct 04, 2017 4:22 pm

Re: Android Bluetooth LE

Postby zed » Fri Oct 06, 2017 4:43 pm

Hi and thank you for the quick reply.

Please forgive me that i'll answering in german again – you'll find the english translation below.

Mein geschriebenes Englisch ist zu mies, um die Sachverhalte hier so darstellen zu können, wie es mir in deutsch möglich ist. Habe aber überhaupt kein Problem mit englischen Antworten… ;)

Also, die Verbindung von „Wireless“ AKAI-Geräte über das Bluetooth-System hat weder mit einem K1-Tablet von NVidia geklappt, noch mit einem OnePlus 3. Die AKAI-Geräte werden „entdeckt“, lehnen aber jeglichen Pairing-Versuch ab. Das Pairing lässt sich mit der erwähnten App (https://play.google.com/store/apps/deta ... ring&hl=de) trotzdem erfolgreich durchführen. Einige (wenige) Apps nutzen diese Verbindung dann auch.

Dass AKAI der Auffassung ist, dass ein „normales“ Pairing als Eingabegerät etc. nicht erforderlich und daher abzulehnen ist, ist nur eine Vermutung. Ebenso, dass es die Prüfung gegen die Liste der gepaireden Geräte ist, die G-Stomper davon abhält, diese AKAI-Geräte nutzbar zu machen.

Oder? ;)

Well, i was unable to pair "wireless" AKAI devices with a K1 tablet and an OnePlus 3. The AKAI devices get "discovered", but they deny any pairing attempt. You can indeed complete the pairing using the app mentioned before (https://play.google.com/store/apps/deta ... ring&hl=en). Some (just a few) apps use this connection then.

That AKAI considers "normal" bluetooth pairing as input device etc. as unnecessary and therefore reject any attempts to do so is only a presumption. It is also just a presumption that checks against the list of paired devices are preventing G-Stomper Apps from using the AKAI devices.

Right? ;)
The secret of success is sincerity. Once you can fake that you've got it made. – Jean Giraudoux

(Android: OP3, Nvidia K1 · MIDI: AKAI LPK25 Wireless, AKAI LPD8 Wireless)
User avatar
planet-h
Posts: 1017
Joined: Wed Jun 19, 2013 4:46 pm
Contact:

Re: Android Bluetooth LE

Postby planet-h » Fri Oct 06, 2017 5:28 pm

Thanks for your answer, zed.

zed wrote:Well, i was unable to pair "wireless" AKAI devices with a K1 tablet and an OnePlus 3. The AKAI devices get "discovered", but they deny any pairing attempt.
....
That AKAI considers "normal" bluetooth pairing as input device etc. as unnecessary and therefore reject any attempts to do so is only a presumption. It is also just a presumption that checks against the list of paired devices are preventing G-Stomper Apps from using the AKAI devices.

Looks like the only way to find out for sure is to get one of those controllers.
Fortunately these Wireless Controllers are not that expensive.
I'll see that we get one these days, then we can check what's going on.

Thanks a lot for reporting the problem.
If it is a bug, then it'll be fixed of course.

I'll keep you informed.
User avatar
planet-h
Posts: 1017
Joined: Wed Jun 19, 2013 4:46 pm
Contact:

Re: Android Bluetooth LE

Postby planet-h » Fri Oct 06, 2017 5:30 pm

Just out of curiosity...
Do the controllers work when you hook them up over USB OTG?
User avatar
zed
Posts: 9
Joined: Wed Oct 04, 2017 4:22 pm

Re: Android Bluetooth LE

Postby zed » Fri Oct 06, 2017 6:14 pm

yep, no problem when used via usb otg.

I don't like the usb otg solution because i can't do anything against the battery drain while using it…

Big thanks for your efforts!
The secret of success is sincerity. Once you can fake that you've got it made. – Jean Giraudoux

(Android: OP3, Nvidia K1 · MIDI: AKAI LPK25 Wireless, AKAI LPD8 Wireless)
User avatar
planet-h
Posts: 1017
Joined: Wed Jun 19, 2013 4:46 pm
Contact:

Re: Android Bluetooth LE

Postby planet-h » Sat Oct 07, 2017 4:18 pm

zed wrote:yep, no problem when used via usb otg.

I don't like the usb otg solution because i can't do anything against the battery drain while using it…

Yes, fully understand that.
That's why I would prefer a wireless connection, too.
One problem with Bluetooth MIDI is the latency due to the slower wireless transmission.
Connecting a controller over USB OTG will always give you way better latency results.
For knobs and sliders the additional latency is not a big problem, but when playing drum pads like on the LPD8, a low latency is essential.

On Android Oreo (8.0), the Bluetooth transmission got a lot better and much more stable.
But on Android 7.x and older, Bluetooth MIDI is not usable for real time playing.

We did a lot of tests during the development of "Link to MIDI Bridge" to get a stable MIDI clock sent over Bluetooth MIDI.
The only Android version that was able to fire an (almost) stable MIDI clock over Bluetooth MIDI was Oreo.
Over USB OTG, the MIDI clock is rock solid, even on Android 5.x.
But I'm getting off-topic...

Can you tell me what Android version you're using?
That would be definitely helpful for further investigations.
User avatar
zed
Posts: 9
Joined: Wed Oct 04, 2017 4:22 pm

Re: Android Bluetooth LE

Postby zed » Sun Oct 08, 2017 3:35 pm

I'm on OxygenOS's public beta channel based on Android 7.1.1. OnePlus may release their first Oreo based build this month.

Auf dem OP3 ist die Latenz über Bluetooth für mich nicht so spürbar, dass sie stört. But there are major latency issues on the K1 (Android 7.0) using MIDI over Bluetooth. If Oreo solves this issues on the K1, i will upgrade as soon as unofficial builds will become available... ;)

If i can do anything to help you to get this implemented, i'll be there.
The secret of success is sincerity. Once you can fake that you've got it made. – Jean Giraudoux

(Android: OP3, Nvidia K1 · MIDI: AKAI LPK25 Wireless, AKAI LPD8 Wireless)
User avatar
planet-h
Posts: 1017
Joined: Wed Jun 19, 2013 4:46 pm
Contact:

Re: Android Bluetooth LE

Postby planet-h » Sun Oct 08, 2017 5:36 pm

zed wrote:I'm on OxygenOS's public beta channel based on Android 7.1.1. OnePlus may release their first Oreo based build this month.

Auf dem OP3 ist die Latenz über Bluetooth für mich nicht so spürbar, dass sie stört. But there are major latency issues on the K1 (Android 7.0) using MIDI over Bluetooth. If Oreo solves this issues on the K1, i will upgrade as soon as unofficial builds will become available... ;)

Thanks for the information, zed.
Just one more question.
Is the Android 7.0 on the K1 the stock Android from NVIDIA?
Or is it also a custom rom?

If Oreo will fix the issue on your K1 is hard to say, but I'm pretty sure that it will be an improvement.
We've tested Nougat (7.1) and Oreo (8.0) on a Nexus 5X and a Pixel C, and on both Bluetooth MIDI worked much better after updating to Oreo.

zed wrote:If i can do anything to help you to get this implemented, i'll be there.

Thanks for the offer.
First of all we need the LPD8 here.
I still have the feeling that there will be a way to pair it using the regular pairing mechanism.
However, we'll know when we have it;).
We've ordered one last Friday. But since it's out of stock at the moment, it might take a week until we get it.

Just out of curiosity, are you a developer?

Return to “Feature Requests”

Who is online

Users browsing this forum: No registered users and 0 guests