TGX4 - Teensy based guitar/bass amp emulation

Started by free electron, July 31, 2024, 07:40:59 AM

Previous topic - Next topic

free electron

Here is something i've been working on for the last 6 months:

TGX4 - Guitar amp emulator



It all started with my old quest for a nice sounding Cabinet Emulation and experiments using convolution on Teensy4.1. At the end i had an almost complete guitar rig emulation including:

  • Input Channel Selector
  • Compressor
  • Wah, 8 models, controlled via expression pedal (BIG thanks for Transmogrifox!)
  • Boost (oversampled waveshaper based on a triode curve, tone shaping)
  • Octave up built into the Booster
  • 8 amp models (neural network modeller based on GuitarML Seed implementation)
  • 7 guitar cab IRs + 3 bass ones as speaker emulation, in stereo
  • special Doubler mode which emulates two tracks spread in panorama
  • modulated stereo ping-pong delay, which can also do chorus/flanger sounds + Freeze (infinite) option
  • 3 reverbs: Plate (+shimmer), SC (spacey, delay based one) and a Spring, two of them have Freeze option
  • Output section with Volume, Pan and master HiCut filter



Initial hardware tests with existing and a few custom AD/DA/codecs showed issues with high gain sounds - noise and self oscillation due to proximity of the inputs and outputs in an integrated codec chip. Some were better (WM8731), some worse (SGTL5000, ES8388). I went with a new design, optimized for huge gains, using separate 32bit ADC (AK5552) and DAC (AK4452).
PCB is 4 layer, majority of the components are easy to hand place (0805 or larger).



For the user interface i've used one of the commonly available now boards having a TFT display, touch screen, driven by an ESP32-S3 - WT32SC01Plus. This way Teensy can focus on more important things (audio DSP), leaving driving the display and a gui library (LVGL9) to the ESP32. ESP controls the Teensy via I2C.

However, this is not the only one option. Most of the GPIOs are available on two FPC connectors, the display can be replaced with other modules, like separate PCB with pots and switches, maybe a small SPI TFT to show the preset number, etc. Whatever works, the architecture allows lots of modding.

This also applies to the AD/DA converters. This whole section on the PCB can be left unpopulated and replaced with a solder on module having a different chip.

Hardware specs:
  • Stereo In/Out
  • Signal presence/clip indicator
  • NJFET based bypass
  • 32bit 44.1kHz AD/DA, all processing using 32bit float
  • up to 3 configurable pots
  • 3 footswitches: Bypass + 2 configurable (PresetUp/down by default)
  • 3 LEDs
  • USB device: Teensy as MIDI + Serial port
  • USB host: Teensy, currently not used
  • USB device: ESP32-S3
  • Expression pedal input (assigned to Wah by default, can be changed)
  • Power: 9VDC, 250mA



Another way to control the pedal is via simple HTML page using WebMIDI+WebSerial. The main part has all the controls, bottom part is the serial port console for various commands or to show the status.



There is 128 presets available, stored on the SD card, all parameters are MIDI controllable, it's easy to automate the sound directly from DAW. In fact for one of the previous versions i made a Reaper plugin with recreated the gui. It hasn't been updated, though.

The firmware is written using PlatformIO for both Teensy and the ESP32S3.
It can be compiled to run on simple Teensy4.1 + AudioAdapterBoard, using the HTML page as gui. I have also added a compile option for the Blackaddr TGA Pro board. It is not tested, though, as i don't have one.

To get all the effects, Teensy4.1 needs an 8MB PSRAM chip installed. It will work without it, some effects will be disabled or limited.

How does it sound? Here is a few examples:


This is one of the earlier tests of the neural amp modeller:

Here an interesting comparison: 24bit codec vs 32bit separate ADC+DAC in high gain sound

And a few WAH sounds:

Finally a whole track i recorded using this pedal:
https://soundcloud.com/hexeguitar/tgx4

Hope you like it! Enjoy!
Piotr

tommy.genes

Very impressive project! I've recently bought hardware to work on a Raspberry Pi system similar to MOD, MODEP or piStomp, but if that doesn't pan out, I will check this out next. I imagine a microcontroller system could be more performant than even an optimized Linux system, yes?
"A man works hard all week to keep his pants off all weekend." - Captain Eugene Harold "Armor Abs" Krabs

free electron

Bare metal will always be more efficient. RasPi might compensate it with more speed and memory.
With all enabled Teensy runs with ~90% CPU load.
Actually, i was thinking about making a spin off of this project - a dedicated guitar sound card for the RPi using these excellent AK converters.

free electron

Recorded a bit of music with the pedal:
 

taudio

Wow -- what a great project! It sounds amazing.

Quite impressive that you have all of the DSP running on a Teensy.
  • SUPPORTER

potul


Firesledge

I second that, this is very impressive.

Yeah 4 layer PCB is another world for me. It's probably the best way to use the ADC/DAC up to their max specs. Did you try the CS4272? I was quite happy with it, I never had feedback issues like that (background noise is -110 dBFS RMS with the guitar turned on). The AKM chips together are the same price as the Cirrus codec, but I would be a bit shy to solder 0.5 mm pitch QFN, I admit I never tried that.

How do you handle differential signals vs. unbalanced guitar in/out?
Pédale Vite, multi-FX pedalboard

MetalGuy

Great project and very well documented! Unfortunately too complicated for my humble tone needs but it's still impressive.

free electron

Quote from: Firesledge on August 02, 2024, 11:39:48 AMI second that, this is very impressive.

Yeah 4 layer PCB is another world for me. It's probably the best way to use the ADC/DAC up to their max specs. Did you try the CS4272? I was quite happy with it, I never had feedback issues like that (background noise is -110 dBFS RMS with the guitar turned on). The AKM chips together are the same price as the Cirrus codec, but I would be a bit shy to solder 0.5 mm pitch QFN, I admit I never tried that.

How do you handle differential signals vs. unbalanced guitar in/out?
Thanks!

Have you tried the CS4272 with a really high gain amp model + treble boost? That's when the oscillations happen. CS4272 pinout looks promising, though, the inputs and outputs should be separated enough. Question is what happens with the wire bonding inside the chip.
All 3 integrated codec chips i have tried suffered more or less from the oscillation issue. Separate ADC+DAC fixed that.
There is also a DC blocking filter built into some codecs (looking at the SGTL5000 and WM8731). If enabled it creates a constant pitch signal which adds more fun to the noise party. I've disabled all these filters in all hardware configs and i'm using a software DC blocker right at the input.

QFNs are actually pretty easy to solder using hot air + solder paste and lots of flux. I find them easier to work with than TQFPs.

Differential signals are handled by phase splitting the input unbalanced signal and using a differential amplifier (works also as an anti-aliasing lowpass filter) at the output.
Schematic in PDF is in the KiCad project folder.

Firesledge

#9
Quote from: free electron on August 03, 2024, 11:25:36 AMHave you tried the CS4272 with a really high gain amp model + treble boost?
I just tried on my pedalboard a configuration only made of:
– +60 dB of amplification with a standard diode clipper simulation (includes a 1-pole DC-killer HPF at 5 Hz)
– +20 dB of high-shelf EQ on the top of that.
So that's nearly +80 dB of amplification in the high frequency range.



Guitar volume and tone knobs are fully turned on.
Graphs below show a capture of the digital output. They don't exhibit any particular slef-oscillation. Visible spikes on the FFT scan are also present on the bypassed input.



Audio captures below, 10 s of mono 24-bit FLAC @ 44.1 kHz:

Gain, input, straight from the ADC
Gain, output, data sent to the DAC
Bypass, input, for reference. Output is the same, obviously. Very similar to the input with high gain processing.
Pédale Vite, multi-FX pedalboard

free electron

The results speak very nicely about the CS4272! It is a different price segment compared to the codec chips i tested, though. I might actually try it in this design. I have a second board with unpopulated ADC+DAC area which can be swapped with a separate solder-on pcb module containing a different codec


Firesledge

Ah, clever! So you can easily test different chips.
Pédale Vite, multi-FX pedalboard

Ice-9

Hi free electron, great work with this it looks and sounds brilliant.

When you say that you had some noise issues when using a full codec chip I wonder did you try the AK4619VN Codec. One of the pedals I have been working on recently also has a plug in board for using a different codec but the reason for that was codecs and ADC/DAC chips were not available at the time so I just had to use the idea of a plug board, that way I could use whatever chips became available. Anyway congratulations on the great work on your project. 8)
www.stanleyfx.co.uk

Sanity: doing the same thing over and over again and expecting the same result. Mick Taylor

Please at least have 1 forum post before sending me a PM demanding something.

free electron

Hey Mick,
thanks!
I haven't tried the AK4619, it's 4 channel codec, could be interesting - use the 2 channel as an FX loop.
As next, a spin off of this project i'm going to try the AK4558 in a small IR Stereo Cabsim/Reverb module, boards are already ordered:


Ice-9

That looks like another great project, I have seen those small round OLED displays, very interesting.

The AK4619 is indeed a 4 in 4 out codec chip, we have had some good results with this codec as far as low noise is concerned and the price is very good compared to others. I look forward to reading more about your IR cab sim/reverb.
www.stanleyfx.co.uk

Sanity: doing the same thing over and over again and expecting the same result. Mick Taylor

Please at least have 1 forum post before sending me a PM demanding something.

MetalGuy

QuoteAs next, a spin off of this project i'm going to try the AK4558 in a small IR Stereo Cabsim/Reverb module, boards are already ordered

Great!
1/ how many IR's can be uploaded?
2/ what's the max length of the IR?
3/ what are the dimensions (would it fit in a 1U rack unit)?
4/ I don't see any mounting holes on the PCB

free electron

It's still too early for firmware related questions. The plan is to have one "factory" IR stored in FLASH, the rest will be loaded from an SD card. The "factory" one will be used when no SD card or IR files are detected. For the length, not sure yet, TGX4 truncates the IR at ~46ms.

As for the hardware design, i do see 4xm2.5 mounting holes:


It's a tiny bit too large to fit in a 1U rack panel:


The general concept for this project is to have a quite complete system not needing any external hardware, except bypass. The planned features are:
- Power in: 9VDC, no need for any extra voltage regulators
- 32bit 44.1kHz AD/DA (AK4558)
- Buffered input (1M) and output. Codec input Z is about 10k. Many diy pedals run the volume pot wiper directly to the output, hence the input buffer - will not cause any volume drops. Buffers are made with rail-to-rail opamps.
- 4 Pot inputs to control different parameters (most likely HP filter, LP filter, Reverb, Volume).
- 4 buttons, which can be replaced by footswitches if necessary.
- separate Headphone output with optional HP volume pot.
- something i might add is a config pad to reconfigure the controls to operate with a rotary encoder instead of pushbuttons.

That's the plan.

Here's an older video showing all the built in IRs which are included in the current TGX4 version. Recorded on a different hardware (WM8731) and with external dist pedal (didn't have the amp modeler working at that stage), but it's the same cabsim firmware.


MetalGuy

QuoteIt's a tiny bit too large to fit in a 1U rack panel

The way it's shown on the pic it wont fit but what about if the display is rotated 90 deg? It can be connected to the PCB with a ribbon cable or similar (PCB mounted somewhere inside the enclosure, not on the front panel)?

free electron

It will be a relatively high speed SPI bus. Yes, it's possible, but the wires should be kept as short as possible.
The display is 240x240px, rotating the GUI won't need any rescalling, that should be easy.
Configuration will most likely be done via command line interface using a serial terminal, no special software needed + crossplatform.

free electron

Still need some time to document all the parts of the project before pushing it to github, it already works very nice.
All IRs are stored on an SD card (Teensy4.0 needs a custom adapter for a fast SDIO interface). It reads 8K IRs (8192 samples), processes in stereo. Tried a few shorter room type reverb impulses, works, too.

I made a new module for the controls and bypass: 4 pots + stereo latching relay bypass. It's separate from the Teensy and runs on a cheap 8pin PFC154 micro-controller.

Guitar track in the beginning of the video is a single mono take processed with the STEREO mode on.