update on gain setting tool

thch
10+ year member

MSEE, Design Engineer
i've been working a bit on the gain setting tool (see previous thread, i'll post link later when i'm not in links).

So far i've hit three concerns.

1.) of most importance, the opamp in question is not stable with the envelope detector load. I may have to abandon the opamp in favor of a different model, or discrete transistors. the opamp i typically use is a lm837n which is cheap and very low noise. its found in some commercial audio equipment as well (note that even the tru amps use "lowly" tl07x parts...). i was not wanting to use the lm324 opamp because it is class-C biased. the lm324 is more suited to 9V use -- the 837 is made more for traditional analog filtering, which uses 30V or so.

2.) the device will not work nearly as well with tube amps or amps expected to have unwanted even distortion. most solid state amps clip fairly symetrically which corresponds to odd distortion. to improve detection of even distortion, full-wave rectification is needed.

3.) i'm still tangling with the math. It should be possible to determine distortion less then a given percentage, but more difficult to know "how much less". bascially it has to do with phase issues and peak detection. the peak value of the distortion signal may be signifigantly higher then its average value. I've been working on a solution to this as well.

This will delay production a bit. i don't forsee any of these being impossible to fix, but at the same time they probably won't be solved until after christmas.

 
currently i'm setting up a 64bit linux server with gentoo. i have no GUI to speak of. so i'm using links, a text-based web browser. i cannot see images or determine font sizes. it would be difficult to get the link to the original post.

there is a post in which i describe the idea for a gain setting tool that looks for the amount of energy in distortion, assuming a 60hz sine wave input. such circuitry could be built fairly easily.

thus far, the results show that there are some design issues, which i am detailing in this thread.

 
Is your envelope detector a capacitive load? High slew rate wide bandwidth opamps don't like capacitive loads, they go unstable and oscillate. BTDT.

Low noise and high performance aren't all that important for the kind of task you have. Consider the venerable LM358 dual amps.. I've driven 0.1 uF with them without stability issues.

I like the concept of what you're doing and encourage you just for technical reasons. Curious what your criteria will be for clipping detection. Rate of change (derivative) of input signal being different than the output would show when the output starts to deviate in waveshape. Real distortion measurements are difficult in low parts count.

Good luck, in any event.

 
Is your envelope detector a capacitive load? High slew rate wide bandwidth opamps don't like capacitive loads, they go unstable and oscillate. BTDT.
Low noise and high performance aren't all that important for the kind of task you have. Consider the venerable LM358 dual amps.. I've driven 0.1 uF with them without stability issues.

I like the concept of what you're doing and encourage you just for technical reasons. Curious what your criteria will be for clipping detection. Rate of change (derivative) of input signal being different than the output would show when the output starts to deviate in waveshape. Real distortion measurements are difficult in low parts count.

Good luck, in any event.
the opamps really had more issues with the capacitance removed, which was unexpected. putting an 800ohm resistor inline with the opamp output worked fairly well, but i don't really get a decent resolution. with a 100mV peak input signal, i get only a 3mV deviation from pure wave to full clipping. this is insufficient. the envelope detectors have a class A bias so the diode loss shouldn't affect anything.

the concept is spectrally based. in a 60hz sine wave there should be no 180hz components, but if there is an 180hz component, there is distortion.

I passed on the derivitive method because clipping with sagging or no PSRR would fool the detector becuase the tops would not be flat and possibly could be changing fastest during clipping, in the case where the power supply ripple is unfiltered.

 
Interesting idea. Looking for odd harmonics might work. Distortion analyzers usually use a notch filter that eliminates the fundamental frequency and whatever is left is harmonics. Rather complicated and limited to one frequency unless it's tunable which makes it REALLY complicated.

The derivitive test would require sampling the input signal and comparing it to the output. Independant of frequency it'd even work with music. Downside is it assumes the input is clean to begin with.

You should be hangin' with these guys: http://www.diyaudio.com

Have fun.

 
Interesting idea. Looking for odd harmonics might work. Distortion analyzers usually use a notch filter that eliminates the fundamental frequency and whatever is left is harmonics. Rather complicated and limited to one frequency unless it's tunable which makes it REALLY complicated.
The derivitive test would require sampling the input signal and comparing it to the output. Independant of frequency it'd even work with music. Downside is it assumes the input is clean to begin with.

You should be hangin' with these guys: http://www.diyaudio.com

Have fun.
yeah, i was also looking into making a DSP version with a microcontroller. as it is i have no analog way of sampling so to say. i could make a ghetto sample and hold, but eh, i don't think its needed.

i think a phase locking loop could allow for a high quality notch that autodetects the input frequency and locks onto only it. similar to coherent AM modulation. maybe I should do that, though i don't know off the top of my head any oscillators with the required spectral purity or phase detectors with sufficiently low noise for the resolution needed.

DSP might be a way to do this as well. just need a multiply instruction for the FFT. oh, and sufficient resolution. not sure how much that would cost.

man, now i'm wanting to go the DSP route with some nice resolution enhancing ideas.

i'll work on this again tomorrow.

 
i built a simple proof of concept design. no autoscaling, simple desing, and a testing amplifer. i've moved away from the high performance opamps i have.

the test amp was just a simple clipper circuit. basically it allows for progressive distortion to be added to the signal.

the POC testing was very favorable -- the thing i threw together worked at 80hz (this was just from parts laying around), and detected a signal with maybe 5% distortion as being "clipped" from the test amp. note that this was also a bit of soft clipping and the wave was still fairly clean!

it easily determined that a triangle wave was not a sine wave.

phase of the distortion will probably be the biggest failing of the device. it may come down to forceing LEDs to stand for "less then X% distortion", rather then "this is X% distortion". this means that if you want to set the amp around 5% distortion, you may get a false positive at 4% or 1% distortion -- both would be less then 5%.

 
Activity
No one is currently typing a reply...
Old Thread: Please note, there have been no replies in this thread for over 3 years!
Content in this thread may no longer be relevant.
Perhaps it would be better to start a new thread instead.

About this thread

thch

10+ year member
MSEE, Design Engineer
Thread starter
thch
Joined
Location
SIUE
Start date
Participants
Who Replied
Replies
17
Views
1,421
Last reply date
Last reply from
Raven
IMG_20260516_193114554_HDR.jpg

sherbanater

    May 16, 2026
  • 0
  • 0
IMG_20260516_192955471_HDR.jpg

sherbanater

    May 16, 2026
  • 0
  • 0

New threads

Top