Have you ever wanted to use MIDI commands to control electrical lights or appliances? This article will tell you how using a Raspberry Pi, the GPIO pins controlled by some open-source software from McLaren Labs on GitHub, and a nifty device called the IOT Relay. Using the Relay is an affordable and SAFE way to control 120 VAC sockets and it makes this project a breeze.Read More »MIDI to GPIO for 120 VAC Control
The “McLaren Synth Kit” is an Objective-C framework for using MIDI and Audio on Linux computers with the GNUstep programming environment. It is distributed as a project including libraries, headers and example programs at https://github.com/mclarenlabs/McLarenSynthKit. You can use it to experiment with sound synthesis for your own personal projects. The project is designed to provide ready-to-compile examples after you clone the repo.
Working with sound is a delicate endeavor. The Synth Kit does a lot of the low-level work of opening devices, managing an audio thread and copying MIDI events to and from dispatch queues. This leaves the audio programmer free to think about designing sounds as a graph of processing units, called Voices.
Standard Voices in the Synth Kit provide envelopes and oscillators of various types, filters and a reverb algorithm. Using the features of modern Objective-C (blocks, ARC and dispatch queues) the Synth Kit makes programming sounds easy, or at least “easier.”Read More »Announcing McLaren Synth Kit
On Linux systems, Bonjour is implemented by the “Avahi” service. This is what McLaren Labs’
rtpmidi program uses to find Apple MIDI services on your network when you set it up. Usually
rtpmidi can find the iPhones and iPads on your network, but sometimes things do not go smoothly. That’s when you need to do some network debugging. One of the tools that you can use to learn about Bonjour services on your network is
If you have installed McLaren Labs’
rtpmidi, then there is a good chance that
avahi-browser is already installed. Try it out.
If it isn’t there, you can install it like this on Ubuntu systems.
Read More »Using avahi-browse to find Bonjour services on your Network
$ sudo apt-get install avahi-utils
Here at McLaren Labs we like to try all sorts of tools and development environments to see how they work together. We’ve been using
vscode (https://code.visualstudio.com/) on and off for about a year, but only recently decided to try using it for a more complete edit/debug/run cycle for an Objective-C Synthesizer project. We ran into an unexpected interaction between the Snap environment of
vscode and the ALSA (Advanced Linux Sound Architecture) PCM interface.
What we discovered was that when running a program that attempted to access an ALSA sound device was that the program malfunctioned. It worked correctly in a “normal” terminal, however.
We reproduced the behavior using the default
aplay command that is available in alsa-utils. See the screenshot below for what should appear in a terminal when it is run, playing an Ubuntu standard sound called “Front-Left”. Unless otherwise specified, this command opens the “default” sound device.
If your Ubuntu sound system is set up correctly, you will hear a woman saying “Front Left” … and it will come out of your front-left speaker.Read More »VSCode, Ubuntu Snaps and ALSA Sound Development
In version 0.5.2 of McLaren Labs’
rtpmidi, we made the use of locked memory the default. Locked memory dedicates fixed RAM to the rtpmidi process, and prevents it from being swapped to disk. The use of locked memory (through the mlockall() function call) can be a benefit to realtime applications like MIDI and Audio, but its use can be to the detriment of other processes. So it should be used carefully.
On Ubuntu 18.04 and 20.04 enabling memlock as the default option seemed benign enough. On Ubuntu 20.10, however, this default caused problems. With memlock enabled, the process printed strange errors and aborted. Example:
***MEMORY-ERROR***: rtpmidi: GSlice: failed to allocate 8176 bytes (alignment: 8192): Cannot allocate memory
Ubuntu 20.10 (Groovy Gorilla) accounts for locked memory pages differently, and even though the memory limit is higher, with all things accounted for, it is not enough.Read More »Enabling memlock for rtpmidi on Ubuntu 20.10
When you use our rtpmidi tool to connect two devices you have created a “session.” The session has an “initiator” side that started the connection, and “listener” side that accepted the invitation. Some devices, however, do not make good “initiators” and iPhones are a great example. An iPhone cannot initiate a network MIDI session.
But sometimes you want an iPhone to join the MIDI network of a stationary computer … without going back to the computer screen. McLaren Labs’ “favorite” option was created to handle this case.
A “favorite” is the name of a device that that rtpmidi automatically initiates a session with whenever the favorite appears on the network. This new feature takes advantage of the properties of Bonjour (Avahi). A Listener advertises its availability using Bonjour. When rtpmidi detects a Bonjour name matching a favorite, it automatically initiates a session with that name.
Use the “favorite” option from the command line like this.
$ rtpmidi gui -F 'myiPhone' -t Organ-Synth:0
Now, whenever rtpmidi sees the iPhone named “myiPhone” it will automatically call it and route MIDI information to “Organ-Synth”.
The video below shows how this works.Read More »Use the ‘favorite’ Option to Automatically Initiate a MIDI Session
Last year, in https://mclarenlabs.com/blog/2019/01/15/korg-microkey-air-37-bluetooth-midi-keyboard-with-raspberry-pi/, I described how to compile a Bluetooth update for your Pi and how to connect a Korg Bluetooth keyboard to your Pi wirelessly. Raspbian “Buster” includes bluez-5.50. The code for version 5.50 includes support for Bluetooth MIDI, but it is not enabled in the “Buster” distribution. This article describes what I discovered in compiling bluez-5.50 for “Buster” and how I installed it to get Bluetooth MIDI working on my Raspberry Pi4.Read More »Update: Korg Microkey Air 37 Bluetooth MIDI Keyboard with Raspberry Pi4 and Buster
A service is a program that the operating system automatically starts when it boots. On the Raspberry Pi “buster” operating system, the daemon that starts and stops services is called “systemd.” You can read about creating services here:
McLaren Labs rtpmidi can be run as a service so that whenever you start your Raspberry Pi rtpmidi can be ready to go. This is especially useful in a headless system where you want rtpmidi to route incoming RTP MIDI sessions to a specific MIDI destination.
One of our customers wanted to know how to do this, so we wrote up this HOWTO guide. Here we will show how to create a service that
- listens for incoming RTP-MIDI connections
- connects to MIDI Alsa port 128
- announces itslef on UDP Port 5006
- logs its output to Syslog