Guitar Speaker Sim v2

Intro

Ever since I started playing (electric) guitar I've craved making a good sound; over time it morphed into being a driven valve amp type sound, my favourites being an Vox AC15 and some of the 80's Marshall's.

At some point I realised building valve amps was doable, but getting that pushed/driven sound required using them at full volume. Even a 3W amp at full volume is too loud for my house, and too loud for my church (which is where I mostly use them). In fact, even a 0.5W amp is too loud...

My current main amp has power scaling (B+ scaling) and sounds at its best between 0.75W and 3W. And I really wanted a way of using it at low volume, preferably with earphones without sounding horrific. Eventually (probably back in about 2006) I discovered cabinet impulses (google it) that sound (to my ears) like a mic'd cabinet, and that was good enough for me. But making a rig that can do this in realtime and is robust has kept me busy for a while now. My first proper rig has it's own page (https://sites.google.com/site/audioalienprojects/home/pemmk1), but I started wanting to add reverb (and some other effects), and this was beyond it. By now single board ARM computers were available, so version 2 was born...

How does it sound? This should give you an idea:

<Video here>

Hardware

The Hardware started as a Raspberry pi, but somewhere along the road I realised the Orange Pi PC was a little cheaper (not a massive deal), had proper Ethernet (Big deal for sound over IP, which I want to play with), and you can use the I2S in raw form, so don't have to write a kernel driver for sound cards.

Full details of the journey with the sound is below if you want the grizzly details, but in short I've ended up with:

  • <Annotated photo here>

1x Orange Pi PC (£17)

1x USB foot pedal (using an Arduino Leonardo) (£10). Allows control of the effects being used, and has the amount of reverb on an expression pedal. Is actually a DIY midi footpedal. See below for more details.

1x UDA1380 board (£7) doing sound input/headphone out duties

1x PCM5102 DAC (£6) doing sound output (cheapo from Ebay/AliExpress). This is only necessary as there is a slight repetitive clicking on the output of the UDA1380 which I can't fix (see below for details), and it was easier to add a second sound output than fix it.

1x Waveshare 5" resistive touchscreen (£20), 800x480 HDMI screen and touchscreen for UI.

1x LM2596 Buck regulator for power (£1.50)

1x Aiken dummy speaker to provide a dummy load for the speaker (£5 ish)

1x SPI touchscreen to USB (using another Arduino Leonardo) (£4). This is unecessary as the XPT2046/AD7846 is well supported in Linux, but I didn't want to face compiling a kernel, so doing a touchscreen=>USB Mouse converter seemed easier. At some point this hsould probably be fixed.

1x 3d Printed case (£6 of filament)


Software

The aim is to run Guitarix with none of the amp modelling, leaving just the speaker sim and the brilliant Zita Reverb (Rev1) as Reverb. This is only tapping into a small part of what Guitarix does (but it does a really great job of it), and I would love to explore it more in the future.

I enjoy varying the amount of reverb dynamically to push the guitar from the front to the back of the mix to suit the song, so I really wanted it on an expression pedal. This was achieved using the midi floorboard, with the expression pedal hooked up to the Dry/Wet mix of the reverb.

Linux wise, it was important to be able to pull the power without shutting down and without damaging the system. TinyCore Linux seemed to fit this bill, so I modded piCore to run on the OrangePi.

Compiling Guitarix turned out to be an absolute pain... It depends on soooo many packages that TinyCore didn't have in the archives, so took hours. I eventually ended up with a working version, but then accidentally deleted all the build files so I'm stuck on this version for now. in the future I am going to look at using Armbian/Ubuntu binaries, it would save a *lot* of time.

The whole boot process takes around 1 minute 05, which is too long. The Orange Pi takes an age (30 seconds) to boot anything as it's got to boot uBoot first. I haven't looked at whether this could be improved. Then TinyCore loads of the SD (I think in about 10 seconds), all the packages are loaded (15 seconds), X starts (5 seconds), and my script loads Jack then Guitarix (5 seconds). These could probably all be improved.

Unfortunately Guitarix doesn't fit on the screen. This could either be fixed by modding guitarix or running a version of X at higher res then scaling to fit on the 800x480 display.

Sound Hardware

The sound caused me a *lot* of headache.

USB attempts

First attempts were using a Behringer UCA202 USB sound card. It worked reasonably well, but the USB wasn't hugely reliable, and I couldn't get the round trip latency below 15mS. I even tried with Preempt_RT kernels and we would get XRuns in JACK (with audible clicking), and occasionally (every few hours) the sound would drop out entirely and need a reboot to fix it.

I also tried a cheapo USB guitar interface which was OK quality wise (just) but had the same USB issues. USB just wasn't good enough..

I2S

I then went to using the UDA1380. It's supported in Linux, but the sound subsystem needs a middleware driver to be written for each card/SBC combo. It's not a hugely difficult job, but I wasn't sure of enough of it that I figured it would take quite a long time to get working, so I skipped using it altogether:

Usefully, you can run the I2S interface on the OrangePi directly. It's not well documented, but I got it to work with some simple editing of script.fex

<paste changes here>

The Gremlins (Clicking sound)

The Audio in works really well (78db noise floor, which for a £7 sound card is better than expected, and more than enough for what I need). Unfortunately the Audio output has a soft ticking sound all the time. When you're playing guitar it's inaudible, so not a huge problem for practice, but when everything goes quiet you can hear it; it would be totally unacceptable for putting through a PA system, which was my intended application.

I tried loads of things to fix it, but ultimately failed. The fail logs are here:

  • Clicking every 0.235s at about -35db
  • Appears on the output only, the input is clean (-78db!!)
  • Still happens when the RXData line is grounded
  • Still happens when the soundcard is not being used (Jackd/alsa)
  • Doesn't happen when the Mclk is disconnected
  • Doesn't happen when WS is disconnected
  • Doesn't happen when the OP is disconnected and codec put in master mode
  • The I2S looks fine on the logic analyzer. Sadly I can't trigger off the click (without building an amp/schmitt trigger for it) so it's not 100% confirmed, but it looks fine, and the PCM5102 doesn't click with the same inputs.

I unfortunately could not work out how to put the OrangePi I2S in slave mode; it looks like this would have solved the problem, but I think it would require some kernel changes which were beyond my time allowance.

Finally I bodged around it by adding a second I2S DAC (the PCM5102) in parallel with the UDA1380. It sits on the same I2S bus so requires no additional configuration, but provides a perfectly clean (phono) output. Sadly the DAC I bought doesn't have a headphone out, so I tend to use the clicky one for headphones.


The Case

<photo here>

I have access to a 3d printer (through a very generous friend), and so designed a custom box for everything in FreeCad. I'm no mechanical designer, so it took a *long* time to do this. (And FreeCad is great, but has some extremely annoying quirks that take a long time to get used to).

I eventually landed at the design shown, it mostly works, and takes about 30 hours to print so I'm in no hurry to change it.

The Floorboard

<photo here>

The Floorboard has 6 foot switches and an expression pedal hooked up to an Arduino Leonardo that provides USB Midi signals for them.

This is enough to control Guitarix.

The box is made of plywood, then painted black.

The Future

The big change I would like to make is Software wise; Once everything on this version is up and running well I would like to start again, use Armbian (and have access to different kernels, proper build scripts for kernels so I can role my own, and the package archives).

It would be great to have LV2 plugins available (I never got that working in my build), the latest version of Guitarix, and custom builds of Guitarix to work on the GUI, different effects, try some different reverbs (I would love a good shimmer reverb if possible), and possibly see how the Guitarix Amp models are.

Other fun things: I've used the really great tool in Guitarix which writes an impulse response by comparing two files to try to make one sound like another (I forget its name) to massively improve my Acoustic guitars pickup sound. (The process is : Record the acoustic guitar by mic'ing it (sounds wonderful) and through the pickup, then use this tool to write an EQ that tries to make the pickup sound like the Mic'd version.). Its such a powerful concept I would love to take it further.

I once had plans to use Audio over Ethernet to create a digital sound system where everyone had personal monitors, and the only connections needed would be a box like this and the ethernet. Maybe maybe it would still be good to develop this.

Want to know more?

This is already a really long page, but I'm aware there is no source, no build files and a load of detail I haven't gone into. That's just because I haven't got around to it; in principle I'm happy to open source everything and share any knowledge I have. Please ask if you have questions!