thelwyn / GuitarEffects

A low latency guitar effects processor suitable for running on a raspberry pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Guitar Effects Processor

A low latency guitar effects processor in C++ suitable for running on smaller boards (e.g. a raspberry pi).

unit in case

How it works

High level overview

The web UI calls into the web server which then manipulates the pedal board.

Sound card interface

The AudioTransformer class uses RtAudio to interface with the sound card.

The values read from the soundcard are then streamed into the provided transformation function and written back out to the output device.

Pedals

pedal.h defines an interface for all pedals to conform to.

Transformation

The root of it is the Transform function which takes an input signal, performs any kind of transformation, and returns an output. All input and output values should remain in the range [-1, 1] otherwise you'll produce some really gnarly popping and cracking.

Many of the pedals utilize the Q library for some signal processing primitives (e.g. filters, compression, etc.). Some other utility classes can be found in the fx directory of this repo.

Knobs

The Describe function advertises the current state of the pedal, primarily the knobs. These knob name and values will be used to display in the UI (covered later).

AdjustKnob provides a knob from the UI and relies on the implementation to make the required changes to the pedal. These changes should be applied in a way such that subsequent calls to Describe will reflect these changes (otherwise the UI won't update).

Registration

Each pedal should register itself via the REGISTER_PEDAL macro. This connects the pedal to the PedalRegistry so that other components can find it without explicitly knowing about its existence.

Pedal Board

The PedalBoard essentially just wraps a list of pedals and chains their Transform functions.

Web Server

The web server uses the crow library to expose endpoints that manipulate the pedal board.

The PedalRegistry is used here to automatically expose newly added pedals. You only need to add an include statement within the handlers file to trigger the registration.

Web UI

The web UI uses React. The bulk of the logic lives in app.jsx.

Building the server

  1. First clone the repo: git clone --recurse-submodules https://github.com/Quinny/GuitarEffects

  2. Then install RtAudio. The steps here depend slightly on the platform you are building on. See install.txt from the RtAudio repo. After following all the steps there run make install in the RtAudio directory so that the library files can be linked properly.

  3. Install boost using your package manager (e.g. brew, apt-get, yum, etc). If you Google "Install boost using <package_manager> you should find the corresponding package name.

  4. Install sdl2 using your package manager (e.g. brew, apt-get, yum, etc.). If you Google "Install sdl on <platform> you should find more detailed instructions.

  5. Run make server from this repo's root.

  6. Open a github issue if I missed a required dependency.

Running the server

From the web directory, run sudo ../bin/server (sudo is required to run on port 80).

Setting up on a Raspberry Pi

My current setup is as follows:

  1. A raspberry pi 4 connected to a 7 inch touch screen
  2. A Behringer audio interface connected to the PI's USB port
  3. My guitar is plugged into the audio interface input port, and then the output of the audio interface runs into my amp (or into the start of your physical pedal chain)
  4. The server program from this repo runs on the raspberry pi
  5. Chromium runs and connects to localhost so that I can interface with the pedals from the touch screen

You can mix and match whatever components you want, any audio interface with an input and output port should work, and you can run the server program on any device you can plug an audio interface into. I've run this setup using my Macbook with similar results (though bulky and less portable).

Note that since the server program exposes an HTTP server you can actually navigate to the IP address of your PI from any device connected to the same wifi and control your pedal chain from there.

About

A low latency guitar effects processor suitable for running on a raspberry pi


Languages

Language:C++ 85.8%Language:JavaScript 8.2%Language:HTML 2.4%Language:Makefile 1.6%Language:C 0.8%Language:Python 0.7%Language:Shell 0.3%Language:CSS 0.2%