Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Bass Preamp Project

  1. #1
    Junior Member
    Join Date
    Sep 2018
    Location
    Newberg, OR
    Posts
    8

    Bass Preamp Project

    A couple years ago I started working on a bass guitar preamp using a Teensy 4.0 and the Audio Shield. I was able to try lots of different topologies for gain and tone controls and used it on stage for a few live gigs(!), but there was always some annoying background noise in that setup that I was never able to get rid of.

    Recently, I decided to revive this project and try to see if I could find the source of the noise and eliminate it. Here is what I tried and what I learned.

    The Usual Suspects

    Power and Ground were the cuplrits. There is no separation of Analog and Digital grounds on the Audio Shield. Also, VDDA (3.3V) for the codec is derived from Digital VDD with a CLC filter, which doesn't completely eliminate the digital noise on the supply rail. Fixing these issues did the trick.

    Analog Power Supplies

    I built two linear power supplies to power the Teensy and Audio Shield. A linear 5V supply provides power to the Teensy. A separate 3.3V linear supply provides VDDA to the codec. These both powered by a 12V wall wart, but each supply is isolated from the other via RC filters on the inputs. Separate Analog and Digital grounds are established.

    On the Teensy, the USB power pad is cut and the board recieves 5V on the Vin pin and Digital ground on a Gnd pin.

    On the Audio Board, the ferrite inductor is removed and VDDA and Analog ground wires are soldered across the VDDA bypass caps.

    Grounding Strategy

    The boards are mounted in a copper-clad box which is connected to Analog ground. Digital ground is maintained as an isolated net. The two grounds connect at the AGND pin on the codec chip.

    Gain Structure

    Codec input and output levels are set to maximum voltage inputs levels and the ADC Highpass filter is disabled

    • LineInLevel(0)
    • LineOutLevel(13)
    • HighPassFilterDisable()

    A JFET preamp boosts the input signal from the bass to drive the ADC input. A gain pot on the front panel sets the level of drive needed for the ADC. Clipping diodes on the ADC input limit the input voltages to protect the codec.

    Next Steps

    There are 5 knobs and a switch available on the front panel that can be programmed for any variable. I'm planning to investigate alternative tone control algorithms and some compressor/limiter functions. Looking forward to using this at some gigs this Summer! :-)


    Click image for larger version. 

Name:	20210419_095211.jpg 
Views:	36 
Size:	142.0 KB 
ID:	24491


    Click image for larger version. 

Name:	20210419_102204.jpg 
Views:	31 
Size:	197.1 KB 
ID:	24492

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,101
    Any chance for a photo with the instrument plugged in and being played?

  3. #3
    Thanks, John, for sharing this!
    I would be interested in the schematics of your input preamp.
    I am thinking about some similar thing but for guitar. When I did some experiments some time ago, I was not completely happy about the dynamic range of 16 bit resolution, if I wanted to use some sort of overdrive in or after the digital processing with its high gain. So I wonder, how I could make sure to actually use full resolution near saturation. I think, I have to go into saturation of peaks "moderately often". I wonder, if 2 antiparallel leds as limiters might be good.
    Perhaps it would be good to use some pre- and de- emphasis for optimum resolution.
    Up to now, I was thinking to use MCP602 rail-to-rail-opamps as active elements. They might be better than a jfet circuit in suppressing supply noise and can be used at 3.3V.

    When I did my experiments some time ago, I used a touch display and I am tempted to try this again, but there was noise from the i2c into the analog side. So perhaps it is a better idea just to use a couple of potentiometers?
    Christof

  4. #4
    Junior Member
    Join Date
    Sep 2018
    Location
    Newberg, OR
    Posts
    8

    Smile

    Quote Originally Posted by cebersp View Post
    Thanks, John, for sharing this!
    I would be interested in the schematics of your input preamp.
    I am thinking about some similar thing but for guitar. When I did some experiments some time ago, I was not completely happy about the dynamic range of 16 bit resolution, if I wanted to use some sort of overdrive in or after the digital processing with its high gain. So I wonder, how I could make sure to actually use full resolution near saturation. I think, I have to go into saturation of peaks "moderately often". I wonder, if 2 antiparallel leds as limiters might be good.
    Perhaps it would be good to use some pre- and de- emphasis for optimum resolution.
    Up to now, I was thinking to use MCP602 rail-to-rail-opamps as active elements. They might be better than a jfet circuit in suppressing supply noise and can be used at 3.3V.

    When I did my experiments some time ago, I used a touch display and I am tempted to try this again, but there was noise from the i2c into the analog side. So perhaps it is a better idea just to use a couple of potentiometers?
    Christof
    Here's what I did for the preamp. I used LND150 MOSFETs because I've been using them for other experiments - they're good up to 600V :-). Other FETs would probably work fine with some resistor tweaking. I'm running the whole system with a 12V supply, so I used that voltage (with an RC filter) for the preamp. The output voltage from the preamp with my bass is typically less than 3.3V p-p with the volume pot set to max, so I haven't put any protection on the ADC input (yet). A pair of schottky limiting diodes to VDDA and Analog ground would meet the Absolute Max Voltage spec in the codec data sheet.

    I also attached my power supply schematic. I found USB supplies tend to have lots of high frequency noise, so just using old-school analog supplies seemed like a good idea. This seems to be working ok for me so far! :-)
    Attached Images Attached Images

  5. #5
    Senior Member Blackaddr's Avatar
    Join Date
    Mar 2017
    Location
    Canada
    Posts
    309
    Quote Originally Posted by cebersp View Post
    Thanks, John, for sharing this!
    I am thinking about some similar thing but for guitar. When I did some experiments some time ago, I was not completely happy about the dynamic range of 16 bit resolution, if I wanted to use some sort of overdrive in or after the digital processing with its high gain. So I wonder, how I could make sure to actually use full resolution near saturation.
    Christof
    16-bit resolution is more that adequate if you use it correctly (i.e it's fine for transport, not always for intermediate math). The extra precision w.r.t. saturation and non-linear processing (i.e. distortion) is only required during the intermediate calculations in the digital processing. Extra bits are not needed for sampling (an analog drive pedal in front of the codec ADC) or at the output DAC. If this wasn't true (16-bit is good enough for sampling distorted guitars) the guitars on your 16-bit audio CDs would sounding like crap, wouldn't they?

    16-bit audio is fine for transport, sampling, and DACing. So if you to create distortion through digital modelling, take 16-bit audio into your distortion effect convert it to 32-int or float inside the AudioProcessor, do your high procession non-linear processing. You may also have to perform some internal upsampling, especially for saturation effects. Then covert back to 16-bit integer and regular sampling rate to transmit out of the AudioProcessor block.

    As for optimizing the input gain, it's probably less critical than you think, as long as you don't clip. Ever notice digital reverb, delay, chorus/flanger pedals DON'T have an input gain knob? Your guitar signal is still feeding a CODEC. How do they get the input gain set correctly?

    Answer, they don't. They use a companding circuit which will squash down the input signal dynamic into a known "good gain level" so it's guaranteed not to clip, and not to be so quiet that you get poor SNR, then they expand it after the codec and you are probably none the wiser.

    In terms of Hi-Fi audio, this would be a travesty. In fact if you did this with a fully mixed audio music track it would sound crappy. But the reality is it's a guitar, not a music track, the signal is not full range as it's pretty band-limited. Also you often are colouring or distorting the signal on purpose, so it sounds fine.

    Nobody complains their BOSS digital delay sounds like crap when you feed it a distorted guitar signal because it doesn't have enough bits. But people complain a lot when digital multi-effect processors with an input gain knob only have 16-bits because it's somehow not good enough.

    There are limited number of real reasons to use 24-audio and higher sampling rates but honestly for a guitar pedal, it's more marketing then audio science.

  6. #6
    Well, I meant: If you go through a 16bit System and then into a higher gain device, you will hear noise. At least this is my own experience with the Teensy 16bit audio.
    I own 24bit devices, which can deal with higher dynamic range and produce less noise. Not a question but a fact.

  7. #7
    @John:
    Thanks for sharing your schematics! (I could only open this with my PC today, not with the mobile phone.)
    I own some LND150. But up to now I have only had these in mind for high voltage applications. Always learning....

    Edit: Interesting: 0.22uF reduces the Amplitude for lowest tones ~40Hz significantly. So you are doing some pre emphasis too?
    Click image for larger version. 

Name:	LND150Preamp.jpg 
Views:	12 
Size:	157.2 KB 
ID:	24658

    Edit2: With a different drain resistor together with the output potentiometer, the circuit can be tuned to soft clip symmetrically at about output amplitude 1.6V. - Makes a lot of sense for me.
    Click image for larger version. 

Name:	LND150Preamp_Clip.jpg 
Views:	13 
Size:	159.2 KB 
ID:	24659
    Last edited by cebersp; 04-30-2021 at 08:51 AM.

  8. #8
    Junior Member
    Join Date
    Sep 2018
    Location
    Newberg, OR
    Posts
    8
    Thanks for posting the simulations! I was aware of the LF roll-off issue. When I picked the 0.22uF output cap, I thought the pots I had were 25K, but it turned out they were 10K When I realized that, I decided to just go ahead and test it as-is before I got the soldering iron out again...

    LF roll-off is one of the main things I am trying to optomize in the overall design. I want to get plenty of "thump" on (loud) low notes, but I don't want to fry my speakers In the design I tried this past weekend, I had a 20Hz Hi-Pass filter (SVF) right after the I2C input. My "Bass" control filter is a SVF Lo-Pass at 50Hz and the knob range is 0dB to 6dB. That seemed to feel pretty good playing with a guitar player and drummer at a rehearsal.

    A pleasant surprise was how cool the Compressor from the OpenAudio_ArduinoLibrary sounded. I'm certainly going to explore possibilities there! Next step will be switching things over to the Floating Point Audio Library.

    Here's a shot of the preamp in operation last Saturday:

    Click image for larger version. 

Name:	20210501_145131.jpg 
Views:	7 
Size:	98.8 KB 
ID:	24699

    This is a close-up of the mods I did to the Audio Shield. The Ferrite is removed and VDDA and AGND from the Analog 3.3V supply are connected across the VDDA filter caps:

    Click image for larger version. 

Name:	S20210419_0001.jpg 
Views:	7 
Size:	100.3 KB 
ID:	24700

    And finally, here's a shot of my workbench this morning. I'm running a 2.5KHz LPF from "TestBiquad"in the Floating Point Audio Library and looking at the response on my (old) AudioControl RTA

    Click image for larger version. 

Name:	20210503_075500.jpg 
Views:	13 
Size:	140.7 KB 
ID:	24701

  9. #9
    Junior Member
    Join Date
    Sep 2018
    Location
    Newberg, OR
    Posts
    8
    I used the Bass Preamp at a gig this weekend and it worked pretty well. The power supply noise is essentially gone - now there's no more background noise than with any other guitar/bass rig I'd typically use. Pretty happy about that!

    I've also eliminated another source of noise: Chatter from the pots. I found that the analogRead() values were always moving around +/- a few LSBs and that was causing 'static' on the output signal. To fix that, I wrote some code to take the average of the previous 100 samples and then apply sort of a Median filter which only allows the output to change if the are 50 consecutive average sample at the new value. After that, I reduce the resolution from 1024 steps to 256 steps. That further reduces the noise and still provides plenty of steps to make the pots feel 'smooth' when making changes I can post that code if anyone is interested.

    While working on the pot noise problem, I discovered that the 'real' source of the noise are the clock signals going from the Teensy to the Audio Shield. If I disable the Audio Shield the noise essentially goes away! But obviously that's not a good solution. My filtering algorithm worked great on the pots connected to A0, A1, A2 and A3, but the one I had connected to A8 turned out to be unusable. Looking at the layout, the A8 pin is right between MCLK and BCLK, so not too surprising there's more digital noise there! Fortunately, having 4 stable pot inputs will meet my needs just fine.

    The floating point Compressor2 works great! I have the knee set to -15dB and a hard limit at -3db. That feels pretty 'musical' to me and keeps the output from clipping on peaks. I had an in/out switch for it, but on my next iteration, I think I'll just keep it on all the time.

    The only thing I didn't like about my current design were the tone controls. I used Biquads from the floating point library and had parallel LP, BP and HP filters for the Bass, Mid and Treble controls. I played around with different center frequencies in the lab, but at the gig it was just too 'tweaky'. Either too boomy or kind of honky, depending on the knob settings - Hard to use on stage.

    I've started testing a new tone control algorithm based on some ideas in this patent:

    https://patents.google.com/patent/US6222110B1/en

    It uses just two LP filters and gets the Mid and Treble output with sum/difference mixers. I'm using regular biquads instead of the single pole filters in the patent and that appears promising - it sounds more like a traditional Fender Tone Stack

    Anxious to get my code tweaked and try it again at a gig!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •