MIDI over Bluetooth

Yes … my dear @wyleu, lately i find we haven’t enough :face_with_monocle: by here …
We want more :face_with_monocle: … newbies need some presion over his shoulders, or this magnificent tradition would be on risk of being lost!! God shall not allow this to happen!

I’m sorry sir, as you know the natives have been revolting for some time now, and in truth we’ve not managed to get past good in testing where the Brocoli boys are still breaking everything they touch. . .

I’ll chuck a couple of randomly chosen types off this evening but If Sir, didn’t release new kit, then perhaps Sir wouldn’t be having to deal with an influx . . .
would Sir…?

And that zynthian club lot are getting un-ruly, frankly it’s getting like an underground Bazaar down there, apparently some meeting took place in Clacton-On-Sea and fruit and encoders were exchanged. . . .

But worse than that Sir.

They ridiculed me! They laughed outwardly and noisily at the duopiano.ca and hinted my interest wasn’t honourable. . .
And all so we could connect bluetoothly to the two 44 note keyboards…

Sorry Sir,

Very Heavy, Very Humble.

4 Likes

For our newest members missing the occasional humouristic medieval cultural references, Blackadder should be more advertised:

:slight_smile:

1 Like

I did actually buy the duopiano as well, along with a Marshall Stockwell II. I was thinking of something very lightweight that works for traveling.
As for the assembly part, it was really a bit of fun even though there were quite a few steps. I was a bit worried about mounting the “zynductor”, but it worked out just fine. I also managed not to scratch the screen. :smile:

3 Likes

Well, I did find the core issue by inspecting config.txt:

# Disable Blutooth Support for HifiBerry compatibility with RBPi 4
dtoverlay=pi3-disable-bt

By removing this line the controller was detected without a problem.

Are you sure the bluetooth issues with HifiBerry also affects RPi4?

This thread seem to indicate that it does not:

Edit: it looks like we’re forcing bluetooth to use the miniuart since we’re also using this line:

dtoverlay=pi3-miniuart-bt

This may have implications in terms of baud rate and flow control. I’m also going to investigate if we’re able to use one of the main UARTs for bluetooth. It looks like some of the GPIO pins are reserved by the HifiBerry.

2 Likes

Just wanted to add that I’ve successfully paried a Bluetooth MIDI device on my custom Zynth with the onboard Bluetooth device using this guide (in case anyone else find it useful):

**Bluetooth service**

# Get the status of the Bluetooth service.
service bluetooth status

# If the Bluetooth service is not running, start it.
service bluetooth start

# Stop the Bluetooth service only if required.
service bluetooth stop

**Pairing a Bluetooth device**

# Once a device is paired it should automatically pair in future.

# Start the Bluetooth utility.
bluetoothctl

# Make sure the Bluetooth device is powered on.
power on

# Make sure an agent is running for the Bluetooth device.
agent on

# Start a scan for other Bluetooth devices in the area.
scan on

# Wait for the required Bluetooth device to be reported...

# Stop scanning when the required Bluetooth device is found.
scan off

# Attempt to pair the required Bluetooth device.
pair <dev>

e.g. <dev>=00:1D:A5:F7:FF:0D

# Pairing normally prompts for a password. Standard Bluetooth pairing passwords
# are: 0000 or 1234, try these if you are unsure of the password.

# If pairing fails or propt for password does not appear, try the following, and
# then try paring again.
agent off
power off
power on
agent on

# Once paired it should appear in the list of paired devices.
paired-devices

# You can now leave the Bluetooth utility and the device should be paired and
# ready for use.
quit

**Creating a serial device for use in the OBDII application**

# rfcomm associates the paired device ID with a serial device name.
rfcomm bind 0 <dev>

# The device it should create is:
/dev/rfcomm0

# To remove the serial device do the following if required.
rfcomm release <dev>

### Shouldn't need this command, force rfdevices to stop.
### rfkill list

**Unpairing a Bluetooth device**

# Start the Bluetooth utility.
bluetoothctl

# Unpair the Bluetooth device if required.
remove <dev>

# Make sure the agent is stopped for the Bluetooth device.
agent off

# Make sure the Bluetooth device is powered down.
power off

# Exit the Bluetooth utility.
quit

Source: Pairing Bluetooth Devices From A Raspberry Pi Command Prompt - Raspberry Pi Forums

9 Likes

This is really great, @sidor !

We have to integrate this ASAP. I just commited a few changes to the zynthian system configuration so your instructions can work without having to modify /boot/config.txt, etc.

Simply update your zynthian, reboot, and @sidor instructions should work.

Next step is integrating pairing process on UI, but it shouldn’t be too difficult given that most of devices use known/standard passwords and system is smart enough to manage that without prompting the user.

Thanks a lot!

3 Likes

Nice work! How is the latency?

Hello, I would like to try using this, is it in the stable branch, or should i switch to testing? I have many apps on the IPad waiting to be buzzed by zynthian!

If you can connect simple HID (Mouse/keyboard) devices
a mini remote might be enough to scroll through snapshots during a set.

I got a few key-fob remote shutter devices at a Dollar Store, probably being dumped at the near end of life of included coin battery.
This “Smart Lens” brand device has the shutter button which sends a Carriage Return, and 5 media control keys (like computer keyboards have) unfortunately the mapping table in the Zynthian web config page only accepts printable characters?

FYI these common media control devices generate these ASCII codes:

Function . . . . . . . . . . . . . . . ASCII
VolumeDown . . . . . . . . . . . 174 The volume down key.
VolumeUp . . . . . . . . . . . . . . 175 The volume up key.
MediaNextTrack . . . . . . . . 176 The media next track key.
MediaPreviousTrack . . . 177 The media previous track key.
MediaPlayPause . . . . . . . . 179 The media play pause key.

Those 5 keys might be enough to navigate through a preset sequence in the UI.

Amazon Wireless

Here’s an $8.65 example on Amazon
qiguch66 Bluetooth Multi-Media Remote Control Wireless Phone Bluetooth

Aliexpress offering Wireless Bluetooth Remote Control Car Steering Wheel for $4.88

I didn’t get far with Sidor’s Bluetooth configuration steps.
Which resemble a Pi forum post

I’ve had some success with MIDI over BLE. I’ve used the Yamaha UD-BT01 transmitter with wind controllers and running it through a RPi3 with FluidSynth.

I initially started using the RPi on-board BT with BluePy to connect to the Yamaha dongle. The latency was acceptable after tweaking the connection interval. Then Bluez came out with its MIDI over BT, so I gave that a try, thinking it would be better having the connection “built-in” to the OS. It turned out that the latency was significantly longer, and there wasn’t an obvious way of tweaking it, so I reverted to using BluePy.

Since then I’ve decided that a dedicated receiving device is a better option, and I’ve built one to feed serial MIDI to a DIN plug on my synth. I used an ESP32 controller for that. There were still some difficulties getting the connection interval to the minimum, but it was doable.

Now I’m thinking that the CME devices might be a better option. They have the “WIDI Master” and the “Core” chips, which, they say, negotiate the minimum connection interval.

In summary, MIDI over BLE works for me, but the inherent connection interval means it is not as fast as MIDI over USB cable. I suspect that there will be difficulties using the RPi on-board BT with the Zynthian metal case, so an external receiver is likely to be better.

My projects are here: https://gonzos.net/projects/

Gonzo

2 Likes

Hi @gonzoB! Welcome to Zynthianland. Thanks for sharing your insight and experience of MIDI over Bluetooth. It is very useful and interesting. The Raspberry Pi shares a serial port that it uses for Bluetooth communication which had the capacity to interfere with other functionality so it is disabled by default. (This hardware implementation changed on the RPi4.) There have been a few attempts to use MIDI over Bluetooth but generally the results have been unreliable which is bad for performers so we have tended to shy away from it. A reliable, robust, low latency, low power, wireless connection would be beneficial for the type of instrument you have demonstrated. Being able to play a lightweight wind controller without the burden of wires would be good

1 Like

I played around with MIDI over BLE myself (with a Yamaha MDBT01 BT/MIDI adapter), and discovered that one big factor in terms of latency and connectivity is the presence or absence of MIDI clock. In my experience the clock signal easily turns into a “denial of service attack” on the bluetooth link. And this does not only apply to the direction controller → receiver (Zynthian), but the other direction as well. So clock on the back link can slow down the MIDI coming from the controller because it keeps the buffers full and the BT devices busy.

1 Like

Here’s a report on 3 different makers of low latency purpose built Bluetooth Transmitter-Receiver pairs, running proprietary protocols not limited by Apple defined waits in the BT MIDI standard.

Hi @gonzoB ,

my conclusions in this are are very close to your summary, so I preordered new WIDI things from CME. When they arrive I will share experience.

P.S. I´m fun your projects, specialy the last midi-Bone, wind controler like trombone is crazy.

@catherder , I use the BLE for one-direction live performance/practice so the timing is not an issue. When I tried sending back to the instrument from the RPi I needed to insert “dummy” timing codes (just sequential ones), but I didn’t check for latency under those conditions. Thanks for the heads-up.

@ToFF , Yeah, the midi-Bone is a bit of fun. I’m still debugging it, and learning to play. I’m so slow compared to sax-like instruments. I look forward to your review of the WIDI stuff when it arrives.

Gonzo

Hi @gonzoB , I had a look at your projects website. Really nice. I especialy appreciate your midi wind controller.

Hi to all,

First impression from CME WIDI things:

  • Zynthian1 plugged with WIDI Bud Pro wia USB port
  • Wind Controler Akai EWI USB with WIDI Uhost (powered by small power USB bank) sticked by silver tape.
  • Behringer FCB 1010 pedal midi controler with WIDI Master

Configured and setting to one group by WIDI aplication on Android smart phone.

Results: Yes all workings without problems.
But more tests is need, specially in stability of connections, long time connection and others…

Last thing (also on fig.) - Genki Wave ring is not possible connect to WIDI aplication (version 1.4.4) , I must write to CME about this.

2 Likes

Nice work!

Is there any configuration in zynthian required with the widi bud?

I use host to connect various akai wired controllers to PC.

I have some bt pad banks and mpk esque mini key/ pads I would like to use with zynthian if possible.

The one pads/ knob bank will not play well with some windows apps or android for that matter, depending on the app. so work arounds with loopmidi and midiberry were required so I am wondering if something similar may be possible/ necessary in zynthian. Both units have transport controls as well if that matters.

long story short has there been any progress on native bt in zynthian or a process write up/ walkthrough for us less cmd line folks, for native or dongle bt integration?

This would be huge for me, my enjoyment of this pastime almost depends on the ability to turn on and get devices linked up as quickly as possible(bt is a joy in this regard)

I apprecieate all your efforts to satisfy my goals and ineptitude. :wink:

Yes - BLE MIDI will be implemented in the next stable release. We have a proof of concept running in dev which works fairly well but needs some polish.

2 Likes