LTSpice (audio) help...

I had started a thread a while back (cant seem to find it again)… where I was questioning the values I had used in my audio/amp output (filters) …etc…

It was suggested, that I use LTSpice (which I had never used before)

I downloaded… loaded the sample file given to me by a member here. (Wawa? or Pito? perhaps… I cant recall unfortunately)

Basic (original) summary was:

I have two (SMD) boards…

1 x had headers soldered onto it… and is in a breadboard so I can test things and easily prototype.
I have certain resistor/caps there were NOT populated on the board… but instead had female leads soldered to the board, so I can easily swap out values…etc

1 x is the same board above… but NOT in a breadboard… same resistor/caps not populated and same female leads soldered, so I can quickly change values to match what I test with in the breadboard scenario above.

(with me so far?)

here so pics for visuals… (please lets leave breadboard capacitance/resistance out of this dicussions, form what I recall in this application it doesnt matter/apply)

breadboard setup:

standalone setup:

The breadboard version ‘sounded’ good… but the standalone one didnt match the same audio quality… so it started me to make my initial post months and months ago… (hence the suggestion to use LTSpice to emulate things)

  • I sorta chalked things up to: I had fat-fingered a cap value on the standalone board (hence why it didnt sound the same as the ‘breadboarded’ version…

I plan on making the change to the breadboard version… (to whatever LTSpice shows me the way is!)… and then I’ll assemble another ‘stand alone’ board and see if it mirrors the range/volume of the bread-boarded one.

Here is the schematic portion I Had question of values on: (right click >> view image to see large size)

I believe the R5 (8k) & R6 (2k) values are ok…

and the focus was on R8, C18 & C21 mostly… (more so the caps)…

I had been ‘randomly’ changing values and deciding by ear if it was ok or not… but I know this is ‘factual’

Here is the LTSpice example I was given… (attached)

Having very little to no experience with LTSpice… I can change values… but am not clear on what my GOAL is to be (visually) when looking at LTSpice results/output.??

Am I looking for all lines to be ‘together’? all lines to be at top? bottom? (I just dont have any direction here with this app)

I hoping to finally stumble upon a value set that I am CONFIDENT sounds really good (for what I have)… (I assemble these boards myself… and want to try outsourcing, but need to be confident in my final values for the schematic…etc)

Anyways… to re-cap those 3 (5) values are the ones I had/have questions on… and am looking for how to ensure whatever combination I use gives the best results.

thanks for any suggestions/directions… (467 Bytes)


anyone guide me on what I am 'looking' for as far as using LTSpice to 'fine tune' my values for audio?

I don't know what you mean with "sound good" or "not the same". I'll try to explain what the parts do.

R1,C1 is a low-pass filter (high cut). If you run the graph, you see that ~10khz (high frequencies) are ~10db down from ~1khz. That makes the sound dull. Change the 10n cap to 4n7, and run the graph again. You see that 10khz is now ~5db down (less high cut). !! LTspice is auto-ranging (Grrrr). That could trip you up. Always look at the values, not just the shape of the graph.

R2,R3 (R5,R6) is a voltage divider. A volume pot set to 20%. Could be replaced with a 10k trimpot. 20% is about the max input voltage the LM386 can handle before clipping.

C2 (C21) and the 10k divider form a high-pass filter (low cut). 1uF is almost no bass cut. Bass cut might be needed if you use a small speaker. Try 100n. C20 (speaker output cap) is quite low in value. I would use a common electrolytic 470uF/16volt. C20 and the speaker also form a high-pass filter, but more complex because of the frequency related speaker impedance. C15,R7 prevent the amp from oscillating.

Search for "Arduino digital amp board" on ebay. A 2x3w class-D amp might be a better option than the ancient LM386. Leo..

Thanks for the reply. (I think it was you who originally got me to download LTSpice to begin with! and the sample LTSpice file to load/use.) (cant find original thread though)

What is the R1/C1 stuff? what does hat translate to on my board/schematic?

R8 & C18?

Yes R1, C1 on the Spice circuit corresponds to your R8, C18.

The spice analysis is giving both the amplitude (top trace) and the phase (lower trace) response and shows the amplitude response to be 3 dB down at about 3 kHz - OK for speech but not for music. For music you need about 20 kHz upper 3 dB point so you should reduce the value of C18 by a factor of about 6.6.


Thanks everyone.. (audio is quite difficult for noobs/hobbists!) lol.. at least to get good audio it is!.. I'm ok with the output quality on the test bed version I have.. but it was really just guess work, trial & error.. without a true understanding.. which is what I'm hoping to gain.

(still at work)..

but I see that my starting values to play with should be roughly:


Low-Pass Filter: R8 = 10k C18 = 4.7nF (I think I currently have a 3.3n cap after my initial LTSpice 'initiation'

Voltage Divider: (for statis values are these ok? I have played with several values but didnt notice much difference, although the values were too extreme) R5 = 8k R6 = 2k

  • I actually -do- have a pcb that has a footprint for a pot, instead of two resistor... (but would rather have it static values for a permanent solution)

High-Pass Filter: C21 = 100nF (instead of the 1uF/1000nF I currently have in place)


As far as using the LM386 chip/amp .. well its my first audio amp attempt, and was a common schematic to use/follow... its already part of the 'all-in-one' pcb... but if I need a standalone, I'll search for the boards mentioned on ebay! (thanks)

  • I need to beat a dead horse here.. :)

So going back to using LTSpice as an 'aid'.. (the above comments kind of confuses me a bit about the graph).. but that aside..

changes values changes the graph.. but for beginners like myself, that are totally new to audio and no experience with LTSpice..... what 'shape' of the graph are going for?

I mean.. you adjust the values in LTSpice.. in order to meet what 'end' here? all lines 'together'? all lines together at the top? Middle?

I know there are many factors here.. (and the above comment about 'auto-ranging'..not sure what that means though)... but you ultimate change values and use LTSpice to give you some indication of better or worse values that you using.. how do you tell/benchmark that?)


After plotting the graph, leftclick on the vertical numbers on the left margin of the graph. Change the range numbers in the popup box. e.g. Top = -20db, Tick = 1db, Bottom = -30db Now you have a fixed 1db scale (not auto ranging). Ignore the dotted phase line.

For speech only (telephone sound), the frequency line should be within 1db variation between 300hz and 3khz. For music/LM386/small speaker, it should be flat/~1db between 100hz and 10khz. For HiFi it should be "flat" between 20hz and 20khz.

When you change a part and re-run the graph, Grrr, you have to manualy set the range again. Leo..

Thanks Wawa...

I'll give it a shot when I get home tonight!

And also thank you for introducing me to LTSpice (even though I dont know how to use it yet!) lol..

but I figure any tools that help take the 'guess' work out of values for me helps!

I'll post my LTSpice file once I walk through it..etc

If you want the response to be 3 dB at 20 kHz (or 1 dB at 10 kHz, the same thing here with a single pole) you need to reduce C18 to 1.5 nF as I suggested above).


Thanks Russell

*(noted).. I'll definitely play with the values over the weekend and post back with my results.. as well as an LTSpice file..etc

appreciate the time guys. :)

*( and I thought my one test bed version sounded good and loud already!.. I'm curious to see how things change with these new values)

It won't be any louder, just sounding better with more treble.


it was a general statement saying I thought the ‘one’ assembled board already ‘sounded’ good to me… and that I was excited to hear even more improvements. (wasnt specifically about the loudness)

ok… I had another round with LTSpice…

and outside of following the suggested values… unfortunately… I am no better off at understanding what I am going for than when I started the post. :frowning: (not from a lack of your effort of course) :slight_smile:

Attempt #1:

Low-Pass Filter:
R8 = 10k
C18 = 4.7nF
Voltage Divider:
R5 = 8k
R6 = 2k
High-Pass Filter:
C21 = 100nF


Attempt #2:

Low-Pass Filter:
R8 = 10k
C18 = 1.5nF
Voltage Divider:
R5 = 8k
R6 = 2k
High-Pass Filter:
C21 = 100nF


When I looked at the two different simulations…

*putting the probe on the TOP of the resistor @ R4, and clicking…

I dont see much/any difference on the LEFT side of the graph/plot lines.

  • didnt left click on the numbers in the left… and change to 1dB steps… and -30dB bottom range… but when I click on R4 or run simulation. it always goes back to -33dB bottom range value.

on the RIGHT SIDE however… I see some difference…

Attempt #1:

  • right column number range: 80°(top) - 80°(bottom)
  • dotted line: (left side) 20.5dB (roughly)
  • dotted line: (right side) 45° (roughly)
  • solid line: (left side) 32.5dB (roughly)
  • solid line: (right side) 70°dB (roughly)

Attempt #2:

  • right column number range: 80°(top) - 50°(bottom)
  • dotted line: (left side) 20.5dB (roughly)
  • dotted line: (right side) 50° (roughly)
  • solid line: (left side) 32.5dB (roughly)
  • solid line: (right side) 41°dB (roughly)

I cant seem to take screen shots or export to bitmap… and the plot lines never get captured/displayed.

Now, trying to take into account the comment russell made:

“If you want the response to be 3 dB at 20 kHz (or 1 dB at 10 kHz, the same thing here with a single pole) you need to reduce C18 to 1.5 nF as I suggested above).”

I’m not exactly clear what this means.

I understand @ 20kHz, I want my response to be 3dB (not really 100% what that means though)… but I’m guessing that @ 20kHz freq… the volume should be @ 3dB…

I’m not sure how to check/benchmark that?

  • I dont even see a 20kHz at the bottom of the graph
  • 3dB isnt not even displayed on the left side/column of numbers (range)…
  • when I look at the 10kHz… the plotted lines at roughly at the -30dB mark?

not only far from 3dB… but negative?

I dont see any ‘flat’ plotted lines… its starts at bottom… archs up…kind stays straight… then slopes back down at around the 10kHz mark?

LTSpice is just confusing me even more! haha…

(I just need to stick with it… until things start ‘clicking’ I guess)

  • One thing I -do- notice, having 10K resistor for R8 makes the sound dull/muted…

I have changed this to a 3.3k resistor… and it sounds much better.

when I swap out C18 for either 4.7n or a 1.5n cap… I cant audible hear a difference… when I removed it all-together… the audio still played normally and I didnt notice any (audible) difference.??
whats up with that? haha

  • I recall the comment above:

“R1,C1 is a low-pass filter (high cut). If you run the graph, you see that ~10khz (high frequencies) are ~10db down from ~1khz.
That makes the sound dull.
Change the 10n cap to 4n7, and run the graph again. You see that 10khz is now ~5db down (less high cut).”
(but no mention of what to update the R8 value to)

C21 has been swapped out for a 100n cap as well…
if I remove C21 completely from, the circuit… (no audio)… why does it seem that C18 doesnt do anything? (136 KB) (136 KB)

Do you have the grid enabled. Plot settings > grid. If you hover over the line@1khz, you see that it attenuates ~20.5db (-20.5db) at the point you have measured. Numbers appear right at the bottom of the window. Because the parts choosen do that, especially the 8k/2k resistor divider. Now hover over the line at 100hz area. You see it attenuates ~22.5db. The difference is ~2db. 10khz is about -25.5db, so 5db down. The -3db points (just audible) are ~75herz and ~7khz. That would cover e.g. a lead guitar, AM radio, or a PA system. Not wide enough for HiFi. Leo..

OK, let's try to clear a few things up:

A simple R - C filter like the first part of your circuit (R8, C18), ignoring for the time being the following components, will have a frequency response (graph of output voltage divided by input voltage) which is flat from dc upwards but starts to go down at higher frequencies and is 3 dB (or 0.707 times) down at a frequency of 1/(2 x pi x R x C). It is 1 dB down at half that frequency.

For you values of 10 kΩ and 10 nF that gives a 3 dB point at 1.6 kHz.

Now it's not quite that simple because at high frequencies C21 is almost a short circuit and you effectively have R5 + R6 across the capacitor, this reduces the resistance seen by the capacitor from 10 k to 5 k so your 3 dB frequency is doubled to 3.2 kHz which is about what you are seeing from the spice output.

I suggested reducing the value of C18 to 1.5 nF as that will move the 3 dB point by 10/1.5 to 21 kHz. Reducing the value of R8 will also move the 3 dB point but not in proportion due to the presence of R5,R6 it will also have the effect of changing the overall gain which you may not want.

Incidentally, the 3 dB point is commonly used to quote bandwidths as it corresponds to half power.

I hope that helps a little.


ok… I’m still trying here (not giving up even though I’m only grasping things here and there…sorry) haha

  • I turned grid on.

  • I hovered over the ‘solid’ line in the graph… @ both 1kHz and 100kHz as instructed… (I do see the actual values at the bottom to give me a better ‘reading’)

so not really trying to pay attention to the values this time… but more focused on getting a ‘flat’ line between 100kHz and 15kHz…

Attempt #3:

Low-Pass Filter:
R8 = 1k
C18 = 1.0nF
Voltage Divider:
R5 = 8k
R6 = 4k
High-Pass Filter:
C21 = 100nF

Attempt #3:

  • left column number range: -8dB(top) > -28dB(bottom)
  • right column number range: 81°(top) > -9°(bottom)
  • dotted line: (left side) -8dB (roughly)
  • dotted line: (right side) -9° (roughly)
  • solid line: (left side) -26.5dB (roughly)
  • solid line: (right side) 70°dB (roughly)

(attached LTSpice file) (136 KB)

xl97: so not really trying to pay attention to the values this time.. but more focused on getting a 'flat' line between 100kHz and 15kHz..

The idea of using a filter is to NOT get a flat line, but to put the [u]-3db points[/u] where you want them. Again, forget about the dotted line and the degree values on the right. Leo..

ok.. ignoring the dotted line and the right number column! :)

ok.. to recap my steps, and my goal:

1.) change values in schematic 2.) run simulator button 3.) click probe on the top of R4 in my design 4.) left click the left number column, and change range to be -20dB >> -30dB (1dB increments)

at that point.. I'm a little lost still as to where in the kHz I need to be 'checking'..

but with the new range set from above..

I want the 'solid line' to be as much of a 'de-cline' (sorry, not sure of a better term here).. (not flat).. from those two points on the (kHz) graph.....yes?

(sorry I was just a bit confused from this comment)

"For music/LM386/small speaker, it should be flat/~1db between 100hz and 10khz. For HiFi it should be "flat" between 20hz and 20khz."

but to re-think it.. I want a flat line from the left side of the graph.. all the way to the 10kHz mark at the bottom.. from that point.. I want an (downward) angle from the 10kHz mark to the 20kHz mark at the bottom?

I'm still not clear what a -3dB point is??

do I have this correct (finally?) (at least as far as the 'goal'?..not the

I should have used -3db. 3db down from the reference area (~1khz) is just an audible volume decrease.

For HiFi, you could set stricter norms of "flat within 1db" for all audible frequencies. Leo..

sorry… lol… (I’m sure your just dying inside right about now!) haha


so I want to ‘measure’ (or only care about) the plotted line on the graph from between 10kHz and the 20kHz mark… is this correct?

so when I put the probe on 10kHz … on the solid line… it says -20.7dB when I put the probe on the solid line at 20kHz… it says -23.05dB

but the values I used… dont really reflect some of the comments/suggestions given here??

I dont know the difference between ‘hi-fi’… and my LM386 here…

I want it to be as versatile as it can be of course… lol…

"“For music/LM386/small speaker, it should be flat/~1db between 100hz and 10khz.”

looking at the solid line from 0Kz to 10kHz… it dips from roughly -19dB to -20dB

(crikey this is just getting more and more confusing for me) :S

my component values are all over the place now… (814 Bytes)