Audiobus: Use your music apps together.

What is Audiobus?Audiobus is an award-winning music app for iPhone and iPad which lets you use your other music apps together. Chain effects on your favourite synth, run the output of apps or Audio Units into an app like GarageBand or Loopy, or select a different audio interface output for each app. Route MIDI between apps — drive a synth from a MIDI sequencer, or add an arpeggiator to your MIDI keyboard — or sync with your external MIDI gear. And control your entire setup from a MIDI controller.

Download on the App Store

Audiobus is the app that makes the rest of your setup better.

Show 'n Tell: Raspberry Pi BLE Midi Bridge Thingy

wimwim
edited October 2020 in General App Discussion

So ... as often seems to be the case, I made a thing that I personally don't have a practical use for, but couldn't resist as a geek challenge.

It's a MIDI host made from a Raspberry Pi. It interconnects USB Midi devices, and allows you also to connect to it by Bluetooth. What this means is all the connected devices can send midi to/from each other and to/from an iOS device connected via Bluetooth.

So, if for instance you have a Novation Circuit, a Digitakt, and a MIDI keyboard all connected to a hub, you can connect to the host from an iPad, and all four devices will be able to share MIDI. Why would you do that when you could just hook the iPad up to the same USB hub as the rest? Well ... I dunno! But it's cool. I guess, if you had your hardware setup in one place and wanted the flexibility to run it all from across the room or something. Or, if you have hardwire that can't talk to other hardware except through a host. Or something?

I built it on a $10 Raspberry Pi Zero W, chosen for the low cost, tiny size, and low power consumption. Any Pi with Bluetooth would do however. I added a small LCD display, but opted later to make a web server for it that would show the status instead. This cuts down the cost and makes for a simpler and less fragile device.

Here's a picture of the unit with the display:

And without, using the web status page:

The idea and 90% of the configuration came from here:
https://neuma.studio/rpi-as-midi-host.html. I wrote the web-display piece, which actually isn't all that necessary since the device is really connect and forget. But it's nice to see what's going on, especially if things aren't working as they should.

If anyone is thinks they'd have a use for something like this, or is just interested in a a bit of geeking out, I'll be happy to discuss.

«1345678

Comments

  • wimwim
    edited October 2020

    Notes:

    • Routing is non-specific. Everything that can talk to each other does. It's dependent on the connected devices to avoid midi loops, etc.
    • There is no channel alteration, so the midi is on whatever channels the devices are configured for. This means that in AUM, etc, you need to be able to configure each device channel on the hardware if using more than one device at a time.
    • Connection is stable on iOS, but not so great on my 2015 MacBook Pro. I dunno why.
    • Only one Bluetooth device is active at a time. So, you can't connect a phone and an iPad and have them both participate. The last one connected wins.
    • I was able to send midi clock over the Bluetooth connection. I didn't measure accuracy yet though. I wouldn't honestly expect it to work great, but we'll see.
    • In the pictures above the Pi Zero is being powered by the powered USB hub that I have the controllers plugged into. It can also be powered separately.
    • The USB port on the Pi Zero isn't hot-pluggable. It's OK if you plug a hub into it, then your devices into the hub, but if you plug a hub or anything else into it directly while running, it reboots. The bigger cousins are more forgiving in this regard.
  • Very cool. Looks like high-tech wizardry to me, tbh. If I understand this correctly, the connections are n to n?

  • wimwim
    edited October 2020

    @Philandering_Bastard said:
    Very cool. Looks like high-tech wizardry to me, tbh. If I understand this correctly, the connections are n to n?

    Yes, as far as I've tested with the limited gear I have, this seems to be the case. The only thing is you can only have one Bluetooth MIDI connection at a time.

  • Very cool.

    If you get a chance could you measure Jitter from iPad to a device/instrument? (Non Bluetooth.)

  • @wim said:

    @Philandering_Bastard said:
    Very cool. Looks like high-tech wizardry to me, tbh. If I understand this correctly, the connections are n to n?

    Yes, as far as I've tested with the limited gear I have, this seems to be the case. The only thing is you can only have one Bluetooth MIDI connection at a time.

    I think that neuma midi script uses the 'aconnect' utility to establish connections. He probably has it defaulting as n to n, but you should be able to customize connections however you want. Here's documentation for aconnect, which is a command line utility, but I suppose there are graphical wrappers (maybe not so useful with the pi-zero, but usable on a regular raspi):
    https://www.systutorials.com/docs/linux/man/1-aconnect/

  • wimwim
    edited October 2020

    @hes said:

    @wim said:

    @Philandering_Bastard said:
    Very cool. Looks like high-tech wizardry to me, tbh. If I understand this correctly, the connections are n to n?

    Yes, as far as I've tested with the limited gear I have, this seems to be the case. The only thing is you can only have one Bluetooth MIDI connection at a time.

    I think that neuma midi script uses the 'aconnect' utility to establish connections. He probably has it defaulting as n to n, but you should be able to customize connections however you want. Here's documentation for aconnect, which is a command line utility, but I suppose there are graphical wrappers (maybe not so useful with the pi-zero, but usable on a regular raspi):
    https://www.systutorials.com/docs/linux/man/1-aconnect/

    Yes, all that is possible. I like the simple plug-n-play nature of it this way though and don't have any plans to go any deeper with it.

    I did experiment with some Python scripting for reading from and sending to various ports, but just didn't see the practical application at this point.

    ALSA Patch Bay could be a useful starting point if one did want to take it farther:

  • edited October 2020

    This looks like quite a handy setup. I'm working with multiple MIDI controllers on Drambo and having one single wireless connection for all controllers looks very useful.
    Also the web server is useful for all kinds of stuff, thinking about Javascript...
    I also like the idea to use Python for MIDI processing because I neither get along with Mozaic nor with Streambyter code well.
    What's your Bluetooth MIDI link?

  • wimwim
    edited October 2020

    @rs2000 said:
    What's your Bluetooth MIDI link?

    That's the connection from the iPad to the Raspberry Pi. The Pi shows up as a peripheral that you can connect in AUM, etc. Once you connect, you have access to all the other devices.

    Device #1 ---+ H
    Device #2 ---+ U +--- RPi ---[ Bluetooth MIDI ] -- iOS
    Device #3 ---+ B

    Sending to hub connected hardware:

    Receiving from hub connected hardware:

  • heshes
    edited October 2020

    @rs2000 said:
    This looks like quite a handy setup. I'm working with multiple MIDI controllers on Drambo and having one single wireless connection for all controllers looks very useful.
    Also the web server is useful for all kinds of stuff, thinking about Javascript...
    I also like the idea to use Python for MIDI processing because I neither get along with Mozaic nor with Streambyter code well.
    What's your Bluetooth MIDI link?

    I generally prefer Python, too, but I think the Ruby-based Sonic Pi environment might be more fleshed out and better in many ways than what you'll find in Python for ios midi purposes. Sonic Pi is about a lot more than midi, but you can definitely focus on midi with it, and you have full power of Ruby in your scripting. Main constraint for using with ios, I think, might be that Sonic Pi can act as a midi clock host, but not as a slave. Beyond that, I haven't yet investigated much. Here's a start with link to some info on using Sonic Pi's midi functionality: https://sonic-pi.net/tutorial#section-11

  • @wim Hey, I didn't know the Zero has on-board Bluetooth. Nice!

    @hes Interesting. Thanks for that! It's not that Ruby would be an awful language ;)

  • I have a Pi Zero W laying around completely unused. I also have a great USB keyboard that unfortunately only works on Linux with USB at this point due to old unsupported drivers. It worked last I think on Windows XP and Snow Leopard. It happens to be integrated into ALSA so works on any Linux OS I’ve tried. It’s also 3.3v Midi so doesn’t work with most MIDI to bluetooth dongles. I’d love to get that connected up by bluetooth.

    How is the latency of the setup? Like if you were playing a live piano kind of sound or something where lowest latency is needed is it workable?

    I need to get back into the Pi. I was messing with it for a while for music, but it always ends up more fiddling than getting anything done. Still, I could use some new projects. I used to live by a Micro Center and it’s hard not to walk out with a 5 USD Pi Zero or a 10 USD Pi Zero W. So, I have each of those, a Pi 2, and my partner has a completely unused Pi 4.

  • @rs2000 said:
    @wim Hey, I didn't know the Zero has on-board Bluetooth. Nice!

    The Pi Zero doesn't, but the Pi Zero W has Bluetooth and WiFi (2.4 GHz only).

  • @wim said:

    @rs2000 said:
    @wim Hey, I didn't know the Zero has on-board Bluetooth. Nice!

    The Pi Zero doesn't, but the Pi Zero W has Bluetooth and WiFi (2.4 GHz only).

    Oh thanks, good to know which one to purchase then.

  • @DMan said:
    I have a Pi Zero W laying around completely unused. I also have a great USB keyboard that unfortunately only works on Linux with USB at this point due to old unsupported drivers. It worked last I think on Windows XP and Snow Leopard. It happens to be integrated into ALSA so works on any Linux OS I’ve tried. It’s also 3.3v Midi so doesn’t work with most MIDI to bluetooth dongles. I’d love to get that connected up by bluetooth.

    Humm - that's a usage I hadn't thought about ... getting a non class-compliant device to work with iOS by going over Bluetooth. Cool idea.

    Since you already have the zero, all you would need is an SD card and a couple of hours to try it out. If you follow the steps in that guide carefully, you'll be good to go. I've done it several times now without any problems.

    How is the latency of the setup? Like if you were playing a live piano kind of sound or something where lowest latency is needed is it workable?

    The latency feels to be about the same as any Bluetooth MIDI connection, which is fine for me, but ymmv. I plan to do some more detailed testing. I just haven't gotten there yet.

    I need to get back into the Pi. I was messing with it for a while for music, but it always ends up more fiddling than getting anything done. Still, I could use some new projects. I used to live by a Micro Center and it’s hard not to walk out with a 5 USD Pi Zero or a 10 USD Pi Zero W. So, I have each of those, a Pi 2, and my partner has a completely unused Pi 4.

    Yeh, I never bothered with the Pi as I couldn't think of anything useful to do with it. Then I stumbled across that project and just had to try it.

    I have another zero W here that I'm going to try SunVox on just for giggles. I'm getting a few breadboards and pots to learn about making MIDI controllers, but don't expect anything useful to come of it.

  • @rs2000 said:

    @wim said:

    @rs2000 said:
    @wim Hey, I didn't know the Zero has on-board Bluetooth. Nice!

    The Pi Zero doesn't, but the Pi Zero W has Bluetooth and WiFi (2.4 GHz only).

    Oh thanks, good to know which one to purchase then.

    I thought you already had a Pi laying around? Or did I misremember?

  • Hi @wim , interested project !
    Did you managed to use a 5.x rt kernel ? It’s seems incompatible on the older raspberries
    If not , I suggest you configure your raspberry as read only to avoid soft shutdown (added as an option to the latest kernels :) )
    Also , how is the BT connection established ? Is there any script to automate it?

  • @wim said:

    @rs2000 said:

    @wim said:

    @rs2000 said:
    @wim Hey, I didn't know the Zero has on-board Bluetooth. Nice!

    The Pi Zero doesn't, but the Pi Zero W has Bluetooth and WiFi (2.4 GHz only).

    Oh thanks, good to know which one to purchase then.

    I thought you already had a Pi laying around? Or did I misremember?

    Yes, an old B but the Zero might be small/flat enough to squeeze into a USB power bank more easily. 😊
    But now that you're asking - I have an old Roland UA-100 audio/MIDI interface that's supported on the Raspi, I even had some Python code running already, maybe it's a better idea to put everything inside this box...

  • wimwim
    edited October 2020

    @Korakios said:
    Hi @wim , interested project !
    Did you managed to use a 5.x rt kernel ? It’s seems incompatible on the older raspberries
    If not , I suggest you configure your raspberry as read only to avoid soft shutdown (added as an option to the latest kernels :) )

    Yes, it is set to read only so that it can be shut off without a soft shutdown. However, I plan to add a button to the web control to do a soft shutdown anyway. It's pretty hard for an old IT guy to trust that it's OK just to remove power. Kernel is 5.4.51+ with latest Pi OS (Buster). I didn't bother trying to do a realtime kernel. Presumably this should be enough for just plain midi.

    Also , how is the BT connection established ? Is there any script to automate it?

    The connection is initiated from the iOS end just like you would connect to any other BLE Midi peripheral. It's not initiated from the RPi end. However, there are dev rules on the RPi that automatically connect all the USB and the Bluetooth together whenever anything is added or removed. Check the linked website to get a better idea of how it fits together.

  • wimwim
    edited October 2020

    @rs2000 said:

    @wim said:

    @rs2000 said:

    @wim said:

    @rs2000 said:
    @wim Hey, I didn't know the Zero has on-board Bluetooth. Nice!

    The Pi Zero doesn't, but the Pi Zero W has Bluetooth and WiFi (2.4 GHz only).

    Oh thanks, good to know which one to purchase then.

    I thought you already had a Pi laying around? Or did I misremember?

    Yes, an old B but the Zero might be small/flat enough to squeeze into a USB power bank more easily. 😊
    But now that you're asking - I have an old Roland UA-100 audio/MIDI interface that's supported on the Raspi, I even had some Python code running already, maybe it's a better idea to put everything inside this box...

    Depends on if the old B has Bluetooth, I guess.
    But for $10 plus maybe $7 for a case, it's hard to go wrong with the Zero W. It's just so gosh darn cute. <3 o:)

    I recommend a clear case, or one with a clear top to be able to see if it's powered on or not. You won't need a heat sink or anything like that.

  • @wim said:

    I have another zero W here that I'm going to try SunVox on just for giggles. I'm getting a few breadboards and pots to learn about making MIDI controllers, but don't expect anything useful to come of it.

    I’ve definitely done a lot of SunVox testing when I had the Pi 2 as my first pi. I’d say the zero isn’t as good. I know I have tested the zero, but can’t remember the results. The end conclusion for me is it wasn’t worth bothering with. I had a version of Debian Linux on this old 2008 EEP PC netbook and SunVox worked better there than the Pi 2 let alone the zero. Also, my old iPhone 6 was much better than all of those for SunVox other than the tiny screen.

    If you want some projects there is this classic Samplerbox. It’s okay but just a basic sample player. https://www.samplerbox.org/

    Usually, it’s more time than it’s worth if you just want to make music. When I get back from my trip I should definitely try to set up my old keyboard with bluetooth MIDI though.

  • @DMan said:
    If you want some projects there is this classic Samplerbox. It’s okay but just a basic sample player. https://www.samplerbox.org/

    Samplerbox is great for creating a nice set of keyboard patches as it supports key zones and velocity layers.

  • @DMan said:
    Usually, it’s more time than it’s worth if you just want to make music. When I get back from my trip I should definitely try to set up my old keyboard with bluetooth MIDI though.

    Yeh, to be honest, this is the first and only project I've found that's really of any practical use. It's been an interesting diversion. Not for the Linux learning (had more than enough of that), but for learning about the interaction with electronics (LEDs, encoders, motors, etc.). Interest is fading now that I've gotten my head around that.

    This little project is quite satisfying though, and is actually kind of useful. Now all I need to do is go buy thousands of dollars of gear to plug into it. :D

  • @wim You really made my day! I'm gonna build it!

  • wimwim
    edited October 2020

    @Keyb said:
    @wim You really made my day! I'm gonna build it!

    Lemme know if you run into any hiccups. It should go smoothly, but there can be bumps in the road, depending on your level of Linux knowledge.

    You don't need a display of the connections since they happen automatically, but the little web-page extension I did for it can be kind of handy if you don't have ready access to ssh. I'd need to write up some instructions for how to do that.

    If you do want to do the web piece, it's a tiny bit easier if you don't do the steps to enable read-only until after that bit, but still doable.

  • @hes said:

    @rs2000 said:
    This looks like quite a handy setup. I'm working with multiple MIDI controllers on Drambo and having one single wireless connection for all controllers looks very useful.
    Also the web server is useful for all kinds of stuff, thinking about Javascript...
    I also like the idea to use Python for MIDI processing because I neither get along with Mozaic nor with Streambyter code well.
    What's your Bluetooth MIDI link?

    I generally prefer Python, too, but I think the Ruby-based Sonic Pi environment might be more fleshed out and better in many ways than what you'll find in Python for ios midi purposes. Sonic Pi is about a lot more than midi, but you can definitely focus on midi with it, and you have full power of Ruby in your scripting. Main constraint for using with ios, I think, might be that Sonic Pi can act as a midi clock host, but not as a slave. Beyond that, I haven't yet investigated much. Here's a start with link to some info on using Sonic Pi's midi functionality: https://sonic-pi.net/tutorial#section-11

    Sonic Pi is pretty cool. I haven't tried it on the Pi Zero W since it needs the GUI environment (I think?) and I don't especially want to go there.

    But! I just experimented with Orca Midi Sequencer on it, and it's pretty cool. Can send to an iOS device over BlueTooth, or to any of the USB connected devices. I need to experiment a bit more, since in some cases it seemed to bork connections from other controllers to the Bluetooth. But generally it worked.

  • @wim

    Awesome.

    Bookmarked.

  • Regarding the read-only option. The instructions in the linked web page work just fine. However, I noticed that Raspberry Pi OS Buster has an option for read-only "overlay" file system in the raspi-config program. This may be a more robust option. I'm going to test.

  • @wim timely. I've been thinking about putting together an external midi controller and patch bay and I had just remembered last night that I have a pi sitting in a box waiting for it's day in the sun...I'll let you know how I progress. It's been sitting in my mind for a little while, but this might just be the spark...thanks for putting this out in the world.

  • One is not a midi thingy pisound https://blokas.io/pisound/

    One is a midi thingy midihub https://blokas.io/midihub/

    Both a pi based.

    Back to @wim and his project.

  • heshes
    edited October 2020

    @wim said:

    @hes said:

    @rs2000 said:
    This looks like quite a handy setup. I'm working with multiple MIDI controllers on Drambo and having one single wireless connection for all controllers looks very useful.
    Also the web server is useful for all kinds of stuff, thinking about Javascript...
    I also like the idea to use Python for MIDI processing because I neither get along with Mozaic nor with Streambyter code well.
    What's your Bluetooth MIDI link?

    I generally prefer Python, too, but I think the Ruby-based Sonic Pi environment might be more fleshed out and better in many ways than what you'll find in Python for ios midi purposes. Sonic Pi is about a lot more than midi, but you can definitely focus on midi with it, and you have full power of Ruby in your scripting. Main constraint for using with ios, I think, might be that Sonic Pi can act as a midi clock host, but not as a slave. Beyond that, I haven't yet investigated much. Here's a start with link to some info on using Sonic Pi's midi functionality: https://sonic-pi.net/tutorial#section-11

    Sonic Pi is pretty cool. I haven't tried it on the Pi Zero W since it needs the GUI environment (I think?) and I don't especially want to go there.

    I think most people use the gui ide specific to Sonic Pi, but the main part of Sonic Pi runs as a server that you can interact with without a gui. Using the gui first helps to sort out how it works and what's actually happening, but there are projects that bring most of the gui's functionality to vim, emacs, vs code, maybe other editors. I think all of these work by interfacing with a command line utility that sends the actual text commands to sonic pi server, receiving output from the server, and syntax highlighting all of it in a friendly way. Here's link to what I think is the standard project for Vim, haven't used it yet myself but that's probably the one I'd go with:
    https://github.com/dermusikman/sonicpi.vim

    I assume it would all work fine on a pi zero, but of course there's not a lot of processing power on those. At some point it becomes like the dancing bear: amazing not because it can dance so well, but more just because it can dance at all.

Sign In or Register to comment.