Stereo guitar/bass cabinet emulation

One major problem I see with the WM8731 is high DC offset that seems to originate from the internal gain stage. This directly impacts the ADC dynamic range to an unusable level, as the signal will clip on the affected side no matter how the HPF is configured.

I have 3 of these chips, and the best one I have (which happens to be from my TGAmkII) exhibits an offset of -0.0026 on one input, and -0.0035 on the other. Works kind of ok for simple effects, not so much for high gain applications

Yes, I'm using your library
While doing the calibration eliminates the DC offset from the I2S input, however if you feed it with a full scale signal, you'll see that it begins to clip much sooner than it should on one side.

I'll try the test program & report results shortly

This is what i'm getting, no calibration done, peak values taken for all gain settings (0x00-0x1F) over a 1 sec step between them. ADC is not muted internally, only the input audio via the jack contacts, there is an opamp buffer before the ADC.
Here's what I get with both #define MEASURE_CODEC_PERFORMANCE commented & uncommented (I let it run for +5min each):
Accumulator: 0
RAW RMS: 4.11
AudioEffectRmsMeasure: the RMS figure is -78.03 dBFS over 345 audio blocks

Is this representative of what you get with your boards in general? 78dB of dynamic range should be useable, but I feel like I'm not able to reach that. My theory is that the DC offset is subtracted at the bitstream level, after the ADC (probably before downsampling), i.e. the actual range becomes asymmetrical, with one side having less range than the other
I will try to find my USB scope, a picture would help to better illustrate the issue

Apologies for hijacking this thread, I would love to be able to run this on my TGAmkII board - I really appreciate the help!

If you mean with 'go bit crazy' that you go with higher quality, low latency converters then that sounds the way to go. You are spending lots of time with getting best out of those effects and doing fantastic job with that so it makes sense to use higher quality codecs or adc/dac's also.
I mean 32bit converters are a bit an overkill, but also a chance to play with them (literally too). Guitar signal with all the playing techniques is very dynamic. Plus the high gain - i'm curious how will they behave combined with the neural amp modelling.

Apologies for hijacking this thread, I would love to be able to run this on my TGAmkII board - I really appreciate the help!
No need to apologize. You highlighted an interesting problem, relevant to what is being done here.

I have done a worst-case scenario (only the analog input is muted via jack contacts, no internal adc mute, no HPF enabled) noise floor test for the two codecs i have, the SGTL5000 and the WM8731. 10 seconds for each gain step, both operate at 24bits (i2s components are modified for that).
Interesting results, around 0dB-5dB gain SGTL seems to be less noisy than WM8731. WM is then more consistent, pretty much flat over the whole gain range. I marked the 0dB and max for WM8731 +12dB points.
The test has been repeated several times and showed similar results.

Version 1.4 dropped in including:
  • new way to define and add hardware platforms. Minimal is now a standard T40 + Audio Adaptor Board
  • pre built hex files for T40 & T41 + Audio Board
  • added ES8388 codec (i'm quite disappointed with this one, but might dig deeper later on)
  • lots of under the hood finetunings.
I'd like to make the project relatively easy adaptable to custom hardware platforms, as some might like classic knobs and switches better, some like touch screens or go completely remote. The bare minimum is to supply a codec driver with correct configuration.

T40 or T41 without PSRAM won't have the ReverbSC enabled and the max delay time is limited. The rest works the same.

Don't forget to git pull the library or use Dependencies/Update in PlatformIO.

Also hacked one of my ESP32 boards with ES8388 to make a driver for it. Unfortunately it oscillates as the SGTL5000 with the high gain sounds. I hoped the diff ADC input + input noise gate will help, but i'm having problems with getting it to work. Might be also a layout related, this board was not designed for gain-domain effects. The new hardware using AKM AD/DA will be.
I followed Steve's suggestions and I'm now getting better results out of my TGA mkII board. Doing the offset calibration after a few minutes did the trick.
I'm running into a few compile issues with the Arduino versions; I might give up on it and switch to PlatformIO, at least for this project

Insane piece of work!
You have managed to squeeze so much out of the T4 with this project, I'm really impressed with the results

Thank you!
Hardware platform is in the works, i'm trying to make it versatile and mod friendly:

  • Teensy4.1
  • AK5552 + AK4552
  • ADC+DAC can be replaced with a separate module containing a codec + whatever it needs. I2S, I2C, differential ADC input and single ended DAC output are provided as pads. If the DAC has balanced outputs, the receiver will have to be on the module.
  • GUI via ESP32S3+Touchscreen. ESP will control the Teensy via I2C1/slave. I'll probably make some kind of midi over i2c
  • 3 Footswtich inputs, they are also routed to the ESP32 connector.
  • 3 optional Pot connectors
  • Output analog volume control.
  • External Dry/Wet mixer + bypass using JFETs, they can be slowed down and crossfade signals instead of rapid switching - less clicks.
  • Almost all Teensy GPIOS are routed to two FPC 20pin conncetors - this way any other means of control can be added instead of the touch screen. I2C, SPI are available there, a few ADC inputs and 3V3 power.
  • Power input is 9V DC, 5V high current digital supply (Teensy+ESP32) using a switching step down regulator. Low noise analog 5V for the input circuit, ADC and DAC. Output analofg section has a bit higher headroom - powered from the heavily filtered 9VDC.
  • Input signal presence LED + clipping indicator.
  • Will try to add more leds, maybe one over each footswitch.
  • Fits into the 1590XX/1790NS diecast alu enclosure.
  • 4 layer PCB
Man you're moving on fast :)
  • 1590XX is propably good choice as it's fairly common Hammond enclosure. And aluminium will provide shield.
  • AK5552 looks like very high quality adc but for AK4552 I only found some obsolete part from Digikey and datasheet from 2001. Maybe you mean AK4452 dac which seems like quality similar to AK5552? Those numbers are so confusing :|
  • There is one pot on 3d image that looks like output volume pot? I built pedal in 1590A enclose (that smallest Hammond) and I put connectors on bottom side of PCB and small Alpha 9mm RK09 pots on top side. With those pots height was not too much and I was "just" able to fit it in that box. 1590XX is slightly higher (3mm) so you might be (maybe) able to do the same thing to give you some more freedom for part placement. That pot looks like it's still trying to find it's place so maybe this is something you are working on.
  • maybe possibility for external expression pedal would be cool to control reverb time, modulation speed, delay time or something else by foot.
Good stuff!
Diecast boxes are pretty much standard for the stompbox builds.
AK4552 vs AK4452 - of course that was typo, i mean the 32bit 4452.
The volume pot will fit, tested many times in practice, the 3d model is not the type i'm going to use, i've just used this one as placeholder.
I managed to squeeze the Expression pedal input, but it's on the side. The top/middle area is reserved for more important things layout-wise.
It's also optional and can be disconnected from the Teensy. I think i'll run the signal directly to the ESP32, it will do all the controls + touch screen and send the combined parameters to the Teensy.
For a version without the touchscreen, using a custom control board - looks it fits with a careful pot placement. This is with the TT P0915N vertical PCB mount pots, they are a bit taller compared to the 9mm Alphas.
>>> Using the Lead amp i too have noise and a bif of whining tone.

If you're using the SGTL5000, be sure to disable its built-in highpass filter. While it is useful for ensuring that your signal has no DC offset, the filter can introduce a whine. See my post here:

The key command is: adcHighPassFilterDisable().

Btw, I'm the person who originated the OpenAudio_ArduinoLibrary, which is what you used as the base for your library. Great it to see it grow into new areas!

UPDATE: Oops...I see in later posts that you are indeed using this command to disable the HPF. good job. Sorry I didn't read the whole thread before responding.

If y'all are still looking around at alternative codecs, the Texas Instruments AIC3206 and 3212 are both supported by the Tympan Library (what I did after the Open Audio library), so either can be lifted out and dropped into this project with ease.

I'm not saying that the 3206 or 3212 are better or worse than the AICs you're using now (well, they are better than the STGL5000) but they are both options that are, from a software perspective, ready to go.

Last edited:
Hi Chip,
i tried both HPF settings. Somehow i couldn't reproduce the issue on all of my hardware (not using the Teensy Audio board). Although i did have issues with SGTL5000 going into crazy self oscillation, they were power decoupling related.
The oscillation in this project clearly comes from the input/output coupling + the huge gain of the amp model. It goes away when i reduce the input level. This is also the reason why i went with separate ADC+DAC chips.
Progress update:
populated two boards, one used as testing bed for each circuit block and the other as "final". No major hiccups so far, added only a few changes, nothing requiring board reorder (which was not cheap - 4 layers over 100mm). Also found a bug in KiCad component library in the process.
The analog power supply for the ADC/DAC is 5V, initially i thought the input gain x2 will be fine, but after testing it with different guitars the signal was clipped with a hard pluck on stronger humbuckers. The input gain is now set to 1.
Next step: write drivers for the AK4452 + AK5552 and get the I2S going.
Got the AK5552+AK4452 working with 32bit/44.1kHz. The difference is huge. Practically zero oscillation and much lower noise. Here is a visual comparison of the hi gain preset 5 output, inputs are shorted to GND: