Stereo guitar/bass cabinet emulation

Been playing around a bit more. I got the high/lowpass filter and peaking filters working. I cant for the life of me figure out how to map the controls from "0-100" to what they actually are. I think it might be in the bundle.js file, but thats over my head. I also cant get the codec input/output levels to map correctly, so thats just a place holder for now.
Im still getting a lot of internal feedback at higher gains, especially on the two lead amps.

I also haven't installed the buffer, because it would be really cool to get this to work without it - the price of entry would just be the Teensy, audio shield and two jacks.
Since installing your newer version with delay, I havent had any issues with the info at the bottom of the screen appearing.

Screenshot 2024-02-26 at 5.19.14 PM.jpg
 
Also, how do you get away with not using any regular audio memory? I thought you had to allocate a tiny bit even if using F32... but this doesnt
Screenshot 2024-02-27 at 8.26.54 AM.png
 
Been playing around a bit more. I got the high/lowpass filter and peaking filters working. I cant for the life of me figure out how to map the controls from "0-100" to what they actually are.
It's MIDI, so the raw values for CC are always 7bit int, 0-127. Look at the CC receive callback. It's converted to float 0.0 - 1.0 there.
Dials are set to show 0-100 range instead of raw midi value. This can be changed in the html file. More info on that is in the TouchMidi documentation.
Im still getting a lot of internal feedback at higher gains, especially on the two lead amps.
I don't have the stock default set (T41 + Audio board) at hand at the moment, so i can't test it. All of my diy Teensy hardware use separate voltage regulators for digital and analog part of the codec (digital is shared with Teensy) plus a lot more decoupling capacitance. It probably have some impact on the noise level and feedback with high gain amp sims.
Also, how do you get away with not using any regular audio memory? I thought you had to allocate a tiny bit even if using F32... but this doesnt
Regular (16bit integer) audio memory pool is only needed if there are regular AudioLib components used along the _F32 ones. Some examples use the I16 I2S input and output + another converter component outputting the F32 stream. The amp project is using _F32 components only.
 
Following the world's best version control practices i'm finishing working on the final_final version of the Amp Emulation.
The number of controls started to grow rapidly, i decided to split them into 3 tabs:
1. Amp:
T41GuitarFX_amp.png
New items are:
- Input signal selector. In general i want it to be a stereo device, since i'll be using it with my stereo guitar rig. The selector can send the L or R channel to both outputs. Useful when a mono jack is plugged in.
- Stereo compressor - based on the compressor included in the OpenAudio library with a few tweaks, bypass etc.
- Booster - in case the amp models deliver too little distortion, the booster (oversampled wave shaper using 12AX7 transfer curve) can add more harmonics, cut the low end and pre shape the signal coming into the amp emulation. Another option here is a Dry/Wet mixer for Bass guitar use. Together with the Bottom control only the mid/high frequency band will be distorted and mixed with clean signal. It's a common used trick in getting a nice not too overdriven bass sound with harmonics in the upper band and clean low end.
2. Delay:
T41GuitarFX_delay.png
Delay controls moved to a new tab
3. Reverb:
T41GuitarFX_reverb.png
All three Reverbs are now included, yet only one can be set active:
- Plate Reverb
- Reverb SC
- Spring Reverb (enabled by default).
Freeze button works for the Plate and SC reverbs.

What i plan to do now is to add a Preset System with 8 presets available as buttons. Each preset will be a snapshot of all controls.
Oh, and the Reaper plugin will need an update...
 
This is very impressive!

I was looking for those impulse responses but I could not find them and wondered if they could be changed? I would like to try using impulses I created for my acoustic guitar when I get missing parts to my Teensy 4.1 (memory, pin headers etc.).
 
There is a way to add/use different impulse responses, but i haven't gotten to test it thoroughly yet. I have made a python script that converts the wav files into c arrays. Will be added in the foreseeable future. If you want to play with it, the data is placed in the library:
hexefx_audiolib_F32/src/filter_ir_cabsim_irs.cpp.
Resample the WAV into 44.1kHz if necessary, remove any silence at the start and the end of the file and export raw float values. The data table has two values more: length of the wav at [0] and the gain at [1], followed by the actual raw values. Gain is used to match the volume between different IR's.


Still working on the final_final version.
TeensyGuitarAmp_v1_3.gif
The recent changes include:
  • Moved the FX on/off buttons for the Amp page, being the main one. Delay are Reverb tabs are used to configure the parameters only. Switching happens on the main Amp page.
  • Reverbs and Delay are put in parallel. Did that because of the new Delay feature: Freeze - as the reverbs, the delay can be set to infinite and create a rhythmic pattern, kind of a short looper/glitch effect I did not like the sound of delay running into reverb in that mode. There is a crossfade mixer to set the balance between the delay and the reverb. If one of them is disabled, the crossfade can be used as level control fot the enabled effect.
  • All the reverbs + delay got a new configurable bypass mode: either cut off the output in bypass (when not using the internal mixer), pass the dry input signal to the output (if the internal mixer is used) or "trails" mode, where only the input us muted when in bypass, allowing the reverb/delay tail to naturally fade out. One disadvantage of that mode is the FX is processing data in bypass, thus using more CPU cycles.
  • Another crossfade mixer is used to set the balance between the Dry amp output and the time based effects (delay+reverb). This way the output voilume is always kept at constant level (controlling the FX level + Dry at 100% might lead to clipipng) and the user can set the output to full wet signal if analog mixer is used externally.
  • Preset system is working. There are 8 default presets which are can be overwritten. A preset is a snapshot of all the controls. Last used preset is also stored in EEPROM and loaded on boot.
  • The status/info part can now be switched between the info page (as shown above) and a CLI, which gives another way to add more features. The "Term" button does that. For now there are only two commands: 1. Restore default presets and 2. Print more detailed memory info. CLI has history and autocomplete.
I think i'll create a new repository for the project as it grew up beyond being just an example of how to use the library. Looks like it will replace half of my pedalboard ;)
 
A short sound sample using the Delay in Freeze mode to create a stereo sound layer + playing over it with one of the Crunch Sounds + Plate reverb, later on adding modulation to the delay loop.

(can't embed streamable)

Also, after playing a bit more with codec configuration, i've set the ADC/DAC to use the full 24bit. Oh, and the highpass filter in the WM8731 is noisy as hell, too.
 
Soon, i went into the latency rabbit hole trying to optimize it a bit, but it would require a new audio system.I'll leave it for now. It's perfectly usable and playable.
I think i'll add a master high pass filer, have it on my second IR cabsim box and it's very useful to make the sound sit better in the mix.
 

I have added one more HW configuration: for the Blackaddr TGA Pro board. I don't have one to test, but would be great if anyone could try the included in the bin folder precompiled hex file. There is also one for the Teensy Audio board.
I'm working on a few demo videos, sound samples. Actually recording a new track with all guitar/bass sounds made entirely on Teensy. Will post the project in a new thread. Have also plans for a dedicated hardware in form of a pedal + touch screen and a few pots and footswitches.
After seeing this post:
i'd like to add a bit simpler version that can run on Teensy4.0. Would be really nice to have a full amp emulation built into a guitar with a headphone ouput. Not sure though if it wouldn't require a new cavity routed in the guitar, for the LiPo packs :)
 
Alright what am I doing wrong... I cant get this new version to work. The html controls don't seem to work and Its stuck on the default clean amp and its heavily distorting. I loaded the older version and its working fine.
 
Maybe something went wrong with the default settings/presets written to eeprom on the 1st boot.
Please try the following:
- open the stats.cpp file
- in the stats_init() function, line 51, change statsMode = STATS_MODE_INFO; to statsMode = STATS_MODE_CONSOLE;
- this will make the teensy to boot with CLI enabled instead of the status report
- on the next boot, connect to the serial port, press enter, a > prompt should show up. Type preset-rst (autocomplete should kick in).
- the command will repopulate the eeprom with all the default data
 
Working on the simpler version for Teensy4.0. I do have it with a SGTL5000 codec, default input gain it too much for a guitar. I think i copied it from an example. LineIn gain is is set to 10, but 5 is the optimal value - tested with a 7string + active pickups.
Will update it soon.
- edit -
Oh, and the SGTL produces a lot louder feedback in high gain settings compared to WM8731. I have set up the gain to 0 and still, the noise gate has to be set more aggressively.
 
Last edited:
Working on the simpler version for Teensy4.0. I do have it with a SGTL5000 codec, default input gain it too much for a guitar. I think i copied it from an example. LineIn gain is is set to 10, but 5 is the optimal value - tested with a 7string + active pickups.
Will update it soon.
- edit -
Oh, and the SGTL produces a lot louder feedback in high gain settings compared to WM8731. I have set up the gain to 0 and still, the noise gate has to be set more aggressively.
At least your experience with the SGTL is similar to mine. However my guitar doesnt have active pickups. I think the highest I saw when strumming strings hard was around 100-200mV.
I'll try the eeprom tonight - I thought that might be an issue since I was using eeprom on my last Teensy project.
 
It's just another reason to start a dedicated hardware design.
These are the settings for the SGTL5000 i'm using now:
Code:
codec.inputSelect(AUDIO_INPUT_LINEIN);
codec.volume(0.0f);
codec.micGain(0);
codec.muteHeadphone();
codec.lineInLevel(0);
codec.lineOutLevel(31);
codec.adcHighPassFilterDisable();
Maybe the built in noise gate can help a bit.
There is a larger update incoming. I made the components requiring PSRAM either stick to bypass mode (ReverbSC) or limit the buffers and fit them into DMARAM (delay) if Teensy4 is used or there is no PSRAM installed. There will be no need for a separate version for Teensy4.0 like i planned initially. Playing through it now and it can do all except the ReverbSC + the delay is limited to 200ms (actually it's twice that because ping-pong).
The plan is to make the project easy to adapt for different hardware platforms. All it needs is a codec driver+init, tell which I2S bus is used and which Teensy is used. This will be provided via platformio.ini.

Meanwhile, some very preliminary steps for a dedicated hardware has been made. This is the WT32-SC01-Plus (ESP32S3, 3.5" parallel display, capacitive touch) running LVGL9, which i plan to use as a controller.
TGX4_HW_0.jpg
 
Yes, it will be designed from scratch. Well, almost, i'll use whatever i learned from previous builds.
I have a sneaky plan which might work: design the pcb with the codec being a kind of module on the pcb - original can be cut off, removed and replaced with something else. Also provide analog pass through, maybe relay stereo true bypass, 3 footswitches and one, two analog pots for quick param adjustments.
ESP32 opens up a few other options, like phone app using TouchOSC controlling the pedal via WiFi.
 
Cool!! Do you think you'll use the PCM3168?
I was actually thinking about making a modular board, with breakout for a screen, and some pots/buttons. And then on the codec side make it modular so you could plug in guitars, or line, or mic preamp boards. Maybe it could have power filtering on it too. But thats beyond my abilities. Sounds like you're more interested in something smaller and for guitar only. Im actually surprised there isnt anything like that already with how popular these Teenys are.
 
Im getting this linking error when trying to compile:
"/.platformio/packages/toolchain-gccarmnoneeabi-teensy/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/teensy_audio_board/src/main.cpp.o: in function `_GLOBAL__sub_I_i2s_in':
main.cpp:(.text.startup._GLOBAL__sub_I_i2s_in+0x3d4): undefined reference to `AudioEffectGuitarBooster_F32::FIR_coeffs'
collect2: error: ld returned 1 exit status
*** [.pio/build/teensy_audio_board/firmware.elf] Error 1"

Any idea how to fix it? Thank you
 
git pull the library? Or update the dependencies in platformio, it will pull the latest changes.
 
Here is an interesting comparison: feedback + noise on high gain (Lead2 + Boost used to cut low end only) for the two codecs:
SGTL5000 + WM8731
Granted, the WM8731 on my board has a separate Vreg for the analog 3.3V rail and a lot more uF on all rails. The SGTL5000 is similar to the Audio board, analog supply filtered with an LC filter, a bit more uF, 10uF vs 2u2.
SGTL seems to be less noisy when the input signal is muted, but the amount of feedback ruins it.
A bit more noise on the WM8731, but no significant feedback, it's more like digital noise, clocks, edges amplified to the audible levels. Noise gate set to -60dB works well. For the SGTL i have to set it to -40dB and still some of the oscillation comes through.
Both chips are set to have close to 0dB input gain.
I think i'll go with a separate ADC + DAC for the final hardware. Tempted to go bit crazy with AK4552 + AK5552.
I'd also like to test the cheap ES8388, which can be configured for differential ADC inputs.
SGTL5000_vs_WM8731.png
 
Back
Top