Make an LED Strip peak volume meter with RNBO on the Raspberry Pi

Make an LED Strip peak volume meter with RNBO on the Raspberry Pi

LED strips are usually one of the first things people want to experiment with on a microcontroller - "NeoPixels" (WS2812) are the most common type you'll often see and are really easy to use. In this article we'll learn the basics of using a small NeoPixel strip to respond to the volume of our RNBO patcher on the Raspberry Pi.

⚙️
Before attempting this tutorial, make sure you're already familiar with the basics of exporting your RNBO patchers to the RPi and that your audio interface is working correctly with it.

Things you'll need:

  • A NeoPixel strip (8 LEDs)
  • Hook up wires
⚠️
Important Note: Driving LEDs at full brightness draws a lot of current. I don't recommend using more than a strip of 8 for the following tutorial. I'll cover going beyond small strips in a future article.

We'll start by exporting the following patcher to the Raspberry Pi target:​

RNBO Generative Polyphony LED mod

<pre><code>

----------begin_max5_patcher----------

13361.3oc68k1jaiij1et8uBDZ9fOFY0DfmZiM5nOrm8s12ssczt64KcOgBJ

Ipp3XIRsjTkc0SL929hD.jhGfmhTRkJ4tcUxjTf.YBj3IOPl+qm8Mil6+Emv

Qn+Czui9lu4e8ru4aXWBtv2H92eynM1eYwZ6P1iMxNJJXm6nw7as0NZwctd2

NKvYQDuYHZSTFivJVreoq.+hPlnf9Ghui2tMtdqchXsGVbQnYYs+hcQ9qVE2

9tKYWze9+70XyQ6a.+cQ4ags1A1abhbBl43YOesCbOEw83OdzCac38wQiP+C

3N+6m8L3Gia3Xeg+lMNdQw8iHmuvFyi9Q6P2En+KGOm.6H26cPeve8Cauy26

gZoSDFYRUwj8K8TjoU9dQqrW3jdLtyaoSvZWuLWTJ8LMgSUNgSI0KJz8OYsI

qSs+xdTJJqc9eri7G0iTrOdm+mCQQ24f1F3u0IHx0ID4uhcke4c+36Q+989t

Kb9GH5..nX0QFM4SyLLX+RotYaonNDRITmdbz9CKXyJ96vPJrhwhJFOQeLRS

iMllxlS.iuFOXvJUypmuatXkAtOYlQ1Q6pZbQLLYiKE0Ipo+iIdLxPo0iRqg

bPtwILz9VmBCRxjpFflrkwLFW5+naRGZSgwd4R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p4nrOK9mBSfkML5Xc6Bli6e8rxiukDu6UQ1EPXANwqcbmdOjZdOp8z6AWy

6AS5oWjRcuHbO7hLZvKJsC467KRuAuHsd38PLNRunrAiY0A.zg8hZvj6o8z6

o1oB8z6A2f2S1o1bYQ1a2lROF1qXzF6+I2xtVieVrxNIErxQANfP0T58LxNX

wctQzML1EvEQ9ECdl0dzF+kNAd6bEANFSJ+9.0NbqMebvNhXO6e+r+OTyJho

H

-----------end_max5_patcher-----------

</code></pre>


We're going to use the value from [peakamp~] to drive our LEDs.  We'll write a quick python script on the Raspberry Pi to use alongside the rnbo runner that's running the sequencer patcher.

ssh in, or connect up a keyboard and monitor. We'll use a library that should already be on your RPi image called gpiozero and another for communicating with the runner via OSC. You can use any OSC library you like, this example will use pyliblo3. We'll also need the rpi_ws281x package to control our NeoPixels (ws2812 LEDs).

To install pyliblo3 run the following three commands from the terminal on your RPi. In order to use the PWM on the RPi we need sudo privileges, so our packages need to be accessible. You can use a venv if you'd prefer.

$ sudo apt install liblo-dev
$ sudo pip install pyliblo3
$ sudo pip install rpi_ws281x

Now create a file called RNBOPi_NeoPixels.py by using nano or any other text editor you prefer.

$ nano RNBOPi_NeoPixels.py

Paste in the following script, then save the file.

from rpi_ws281x import PixelStrip, Color
import liblo as OSC
import time
import sys

# set up OSC client - send all messages to port 1234 on the local machine (rnbo runner)
try:
    target = OSC.Address(1234)
except OSC.AddressError as err:
    print(err)
    sys.exit()

# set up OSC server - listening on port 4321
try:
    server = OSC.Server(4321)
except OSC.ServerError as err:
    print(err)

def db_callback(path, args):
    dB = args[0]
    print("dB:", dB)
    peak_meter(strip, dB)

# register callback methods for server route
server.add_method("/rnbo/inst/0/messages/out/dB", 'f', db_callback)

# Set up RNBO OSC listener
OSC.send(target, "/rnbo/listeners/add", f"127.0.0.1:4321")

# LED strip configuration:
LED_COUNT = 8        # Number of LED pixels.
LED_PIN = 18          # GPIO pin connected to the pixels (18 uses PWM!).
# LED_PIN = 10        # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
LED_FREQ_HZ = 800000  # LED signal frequency in hertz (usually 800khz)
LED_DMA = 10          # DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS = 100  # Set to 0 for darkest and 255 for brightest
LED_INVERT = False    # True to invert the signal (when using NPN transistor level shift)
LED_CHANNEL = 0       # set to '1' for GPIOs 13, 19, 41, 45 or 53

def clamp(n, low, high):
    return max(low, min(n, high))

def peak_meter(strip, dB):
    # scale dB level to the number of LEDs in the strip
    thresh = -48
    peak = (1 - (dB / thresh)) * strip.numPixels() // 1
    peak = clamp(peak, 0, strip.numPixels())
    for i in range(strip.numPixels()):
        p = (i + 1 <= peak) * LED_BRIGHTNESS
        r = int((i / strip.numPixels()) * p)
        g = clamp((p - r), 0, LED_BRIGHTNESS)
        color = Color(r, g, 0)
        strip.setPixelColor(i, color)
    strip.show()

def colorWipe(strip, color, wait_ms=50):
    """Wipe color across display a pixel at a time."""
    for i in range(strip.numPixels()):
        strip.setPixelColor(i, color)
        strip.show()
        time.sleep(wait_ms / 1000.0)

# Main program logic
if __name__ == '__main__':
    # Create NeoPixel object with appropriate configuration.
    strip = PixelStrip(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
    # Intialize the library (must be called once before other functions).
    strip.begin()

    print('Starting transport: Press Ctrl-C to quit.')
    OSC.send(target, "/rnbo/jack/transport/rolling", 1)

    try:
        while True:
            server.recv(100)
    
    except KeyboardInterrupt:
        OSC.send(target, "/rnbo/jack/transport/rolling", 0)
        colorWipe(strip, Color(0, 0, 0), 10)


Now sudo poweroff the RPi, and disconnect the power. Let's create our circuit:

To run the script (PWM access requires sudo privileges)

$ sudo python RNBOPi_NeoPixels.py

Going further with more LEDs

You can drive many more LEDs using the RPi - although most folks use a different board like the ESP32 etc to drive larger amounts of strips - but there are a few considerations with power supply and safety you will need to consider before going forward. In a future tutorial I'll cover how to scale this up and incorporate other boards like the ESP32 into your RNBO project.

lys.//

lys.//

I'm an audio programmer, data scientist, grad researcher and media artist from Melbourne, Australia. I specialise in DSP and interactive coding for sound design across a wide array of platforms.
Australia