treefella
Posts: 9
Joined: Thu Mar 24, 2016 11:59 pm

BLE MIDI GATT Service on Pi3

Tue Mar 29, 2016 11:39 pm

Hey all!

I am trying to get my pi to work as a bluetooth MIDI device according to the new spec:https://developer.apple.com/bluetooth/A ... cation.pdf

I have been able to set up connections and send/recieve data using gatttool, but I cannot seem to figure out how to create a Server and assign the IDs required by the spec.

I have found code to do this with arduino:
https://github.com/sieren/blidino/blob/ ... LEMIDI.ino

Looks like I will need to use BlueZ to create a GATT service with the correct UUID and Characteristic and this seems like the closest thing to what I am looking for:
https://github.com/pauloborges/bluez/bl ... -example.c

However, I am having trouble deciphering what the example code is actually doing and how I can use it for my application. Could someone help point me in the right direction?
Ron Sardarian
instagram.com/teafela/
teafella.com

User avatar
Douglas6
Posts: 4739
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: BLE MIDI GATT Service on Pi3

Wed Mar 30, 2016 1:58 am

You are pretty much on your own here. There's very little documentation on the web regarding GATT servers under Linux. The best doc is the BlueZ source code. A good start is a good book on BLE programming. And remember that Raspbian is basically Debian, so expand your search accordingly.

treefella
Posts: 9
Joined: Thu Mar 24, 2016 11:59 pm

Re: BLE MIDI GATT Service on Pi3

Fri Apr 01, 2016 11:48 pm

Very well, I will give BlueZ a go and report back.

Thanks Douglass!
Ron Sardarian
instagram.com/teafela/
teafella.com

rsprat
Posts: 1
Joined: Mon Jun 20, 2016 2:30 pm

Re: BLE MIDI GATT Service on Pi3

Mon Jun 20, 2016 2:32 pm

Hello,
I 'm trying to achieve the same. Have you got any results yet?

Thanks

ftonello
Posts: 2
Joined: Thu Aug 06, 2015 10:35 am

Re: BLE MIDI GATT Service on Pi3

Fri Oct 21, 2016 12:25 pm

Hi all,

I am currently working on the development of MIDI over BLE on Linux. If you want to help, please let me know.

The current stage it works as read-only and ignore timestamp byte due to an ALSA Sequencer limitation (we are working on this as well). I am currenly working on the write support, so hepefully release it in the next month or so.

Please, check it out at https://github.com/ftonello/bluez/blob/ ... idi/midi.c

Cheers,
Felipe

ftonello
Posts: 2
Joined: Thu Aug 06, 2015 10:35 am

Re: BLE MIDI GATT Service on Pi3

Mon Jan 16, 2017 4:46 pm

Hello all,

MIDI over BLE was finally merged BlueZ upstream.

For more information check my blog post about.

Felipe

User avatar
Douglas6
Posts: 4739
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: BLE MIDI GATT Service on Pi3

Mon Jan 16, 2017 4:56 pm

Thank you Felipe for this information. Please keep us updated!

oxesoft
Posts: 1
Joined: Wed Feb 22, 2017 2:32 pm
Contact: Website

Re: BLE MIDI GATT Service on Pi3

Wed Feb 22, 2017 10:44 pm

treefella and rsprat,

The project https://github.com/oxesoft/rpi-midi-ble does the job.
It uses the work done by ftonello as basis and implements two complementary tools: one to provide an ALSA sequencer port from MIDI-BLE connection and another to automatically connect a MIDI hardware plugged on USB to the MIDI-BLE port.

Enkerli
Posts: 3
Joined: Sun Aug 06, 2017 8:00 pm

Re: BLE MIDI GATT Service on Pi3

Sun Aug 06, 2017 8:19 pm

Encouraging.
Should soon receive a pisound HAT. Part of my use for it will be to make a Pi3 into a soundbox for my Eigenharp Pico. It doesn’t send MIDI directly and requires a computer. But that computer can be a Raspberry Pi. Having a portable setup will be fun.

What would be really great, though, is if the Pi could be used as a way to transmit MIDI over Bluetooth, say to an iPad running one of the many synth apps compatible with Bluetooth MIDI.
From this thread, getting the impression that something like this is somewhat doable but not yet very robust. My understanding of these things is admittedly kind of weak. But it’d be useful to know more about what’s possible now and what might happen in the future.

Here’s my understanding of how things are at the moment.
Sounds like Felipe (@ftonello) is saying that MIDI support in BlueZ may be sufficient to use a Raspberry Pi as a Bluetooth MIDI device but work still needs to be done to make everything run smoothly.
https://blog.felipetonello.com/2017/05/ ... -on-linux/

Otherwise, Daniel (@oxesoft) has created two tools to ease Bluetooth MIDI use on Raspbian. (Not sure how to install them.)
https://github.com/oxesoft/rpi-midi-ble

Would someone be able to lead me in the right direction in terms of making this work? Even if it’s not stable, yet, it can be a fun demo.

Return to “General discussion”