Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Circuitpython BLE MIDI
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Circuitpython BLE MIDI

by JHeim on Tue Mar 31, 2020 3:07 pm

I have started to port a BLE MIDI project from Arduino code to Circtuitpython. I'm doing this mainly to educate myself in Circuitpython--this is my first Circuitpython project. The Arduino version of my project and code is mature and works very well. For the Arduino BLE MIDI interface I'm using bluefruit.h and MIDI.h. I'm using the Adafruit NRF52840 Feather, and Circuitpython 5.0.0.

I was excited to find the Adafruit_Circuitpython_BLE_MIDI library in GitHub. Looks like this is a new library. I'm attempting to run the example program "ble_midi_simplein.py" which is provided with the library.

I'm using an iPad app called 'Sweet MIDI' for the BLE MIDI source. This is the same app that I've used successfully with the Arduino version of my project.

When I run the ble_midi_simplein.py example code, it gets to 'Waiting for connection". A new MIDI device called CIRCUITPY651c shows up in the list of Bluetooth MIDI devices in Sweet MIDI. I select this device. The example program shows 'Connected', but Sweet MIDI first shows 'Connecting' but then reverts back to 'Not Connected'.

I also tried to connect using the iPad 'Settings' app. When I select CURCUITPY651c in My Devices, the iPad does indicate 'Connected'. I start up Sweet MIDI and it also shows 'connected', but when I play an MIDI file, I do not get any of the printed output produced by the "print(time.monotonic(), midi_in)" line in the example.

I feel that the Circuitpython MIDI BLE library is very close to working. Maybe I'm doing something wrong? Has anyone else successfully used this new library?

-J

JHeim
 
Posts: 9
Joined: Tue Jan 22, 2019 11:51 pm

Re: Circuitpython BLE MIDI

by tannewt on Tue Mar 31, 2020 4:46 pm

Hi J! You are ahead of the game!

I had to fix a couple things in core CircuitPython that I have *just* merged: https://github.com/adafruit/circuitpython/pull/2741 In an hour or so there should be brand new versions of CircuitPython on S3 for it.

I also just updated MIDI: https://github.com/adafruit/Adafruit_Ci ... /tag/1.2.1

tannewt
 
Posts: 1685
Joined: Thu Oct 06, 2016 8:48 pm

Re: Circuitpython BLE MIDI

by JHeim on Wed Apr 01, 2020 7:08 pm

Well I uploaded your latest CircuitPython. From REPL:

Adafruit CircuitPython 5.1.0-rc.0-75-gf47b964c5 on 2020-03-31; Adafruit Feather nRF52840 Express with nRF52840

...and I updated the MIDI library files.

Still getting exactly the same symptoms as I described above.

One thing: I did not see an updated version of the "Adafruit_CircuitPython_BLE_MIDI-master" file. The file I'm working with has this timestamp: 3/31/2020 11:04 .

Sure wish I could help out more with troubleshooting this. Are there any further test you'd want me to run? What BLE MIDI source are you using?

-J

JHeim
 
Posts: 9
Joined: Tue Jan 22, 2019 11:51 pm

Re: Circuitpython BLE MIDI

by tannewt on Thu Apr 02, 2020 1:44 pm

That should be a new enough version of CircuitPython. If you can, please jump on Discord: https://adafru.it/discord and we can debug faster. Just @tannewt and I'll see it.

I was testing MIDI in with an iPad running Synth One to connect to the MIDI device and then Xynthesizr to output the midi notes.

tannewt
 
Posts: 1685
Joined: Thu Oct 06, 2016 8:48 pm

Re: Circuitpython BLE MIDI

by tannewt on Fri Apr 03, 2020 3:56 pm

Hi J, thanks for catching me on Discord. I got my iPad working again by turning Bluetooth off and then back on again. Can you try that?

There might be an issue in our bonding code that may lead to this.

tannewt
 
Posts: 1685
Joined: Thu Oct 06, 2016 8:48 pm

Re: Circuitpython BLE MIDI

by JHeim on Fri Apr 10, 2020 11:34 pm

To close out this post:

tannewt recommended I try to 'Forget this Device' on the iPad and then reconnect. This solved my problem. The BLE MIDI code is now working.

JHeim
 
Posts: 9
Joined: Tue Jan 22, 2019 11:51 pm

Please be positive and constructive with your questions and comments.