Audio output circuit - comments? + specific question - Page 1
Forum section: electronics / beginners

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 13, 2021, 03:57:41 pm
content: HiI would like if possible to get some feedback about this Audio output circuit?The requirements:1) The output of the circuit should handle both headphones (>32Ohm) and balanced line inputs (usually around 50kOhm)2) The output should either be Left=Right (Mono signal for headphones) or Left&Right at 180 degres out of phase (balanced mono line output)3) Have a gain of either +8dB or -22dB (S1 is digitally controlled)The input of the circuit is the DAC output which is very sensitive to loads, hence the first buffer.Thank you for any feedback, and of course please ask for any questions)SimonPS:I do have a specific question though:I am playing very short sounds (like quick samples of about half a second), and in order to reduce noise, I switch off S1 right before sending the audio and switch it on right after (so the gain jumps from -22dB to +8dB and back to -22dB).I added the C2 cap because without it there was a tiny voltage offset with Half_VCCA, which was fine but meants that there was a click sound when switching the gain.My question is: if I play a low frequency signal, say f.x. 100Hz, it is partially filtered by C2 and R9, and it seems the voltage is not quite back at Half_VCCA when I switch the gain, that creates again a little "click" sound. Should I just "wait" a bit before switching the gain back to -22dB, or do you have any other idea? Thank you!

author: Terry Bites
author_rank: Super Contributor
timestamp: February 13, 2021, 10:46:30 pm
content: Is your switch suited to single supply operation?What is your supply voltage?How much power do you need in your phones?What kind of feeble DAC are you using?What op-amps are you using?You are asking lot of you're op-amps. I doubt they have the output current drive you need. It would be a good idea to make the attenuator passive to reduce charge injection charge into from S1 into the summing junction of U3.2. Set a fixed gain and switch in the reduction. You need to buffer your half way point else all kinds of unintended coupling will occur. eg attached.Do you want to switch between DAC and Line in?

author: David Hess
author_rank: Super Contributor
timestamp: February 14, 2021, 03:29:31 am
content: The only potential problem I immediately see is the input buffer. Are you sure that the DAC output is centered close to half of the supply voltage? And if the DAC output is AC coupled, then the non-inverting input of the buffer has no path for its input bias current.Both problems can be solved by AC coupling the input with a high value divider to supply the input bias current.

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 14, 2021, 10:37:50 am
content: Thank you both for your replies! It really helps, and it gets me thinking!@Terry Bites:* I am using an analog switch IC which can handle analog signals from 0 to VCC (for example Diodes 74LVC1G3157 but any similar would work I think?). I tested it and it works.* VCCA=3.3V* I get about 1V RMS max with 250 Ohm studio headphones, which is already very loud. Cheap 32 Ohm ear-buds get a much lower voltage, but are also a lot more sensitive (especially on the high freqs), so also really loud.* The DAC is a TM8211 from Titan Micro Elec (chinese brand), it is super cheap and works as long as the input buffer is there.* Opamp is a quad package GS8634-SR from Gainsil (also chinese brand). It is a low-noise opamp.Quote from: Terry Bites on February 13, 2021, 10:46:30 pmSorry I really do not understand that - why do you think S1 is such an issue, when it's on it just "connects" R4 in parallel (and adds a few Ohms), or did I miss something? I do not know what "charge injection from S1" meansQuote from: Terry Bites on February 13, 2021, 10:46:30 pmMy bad, I was not clear - the input is always the DAC, it is the output I want to be able to switch between headphones and balanced line output (to send it to the line input of a mixer for example). This is done by the physical SPDT switch.

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 14, 2021, 10:39:35 am
content: @David HessQuote from: David Hess on February 14, 2021, 03:29:31 amGood point - but the DAC output is very close to the Half_VCCA, like I said it could even work without C2, but then the gain change amplifies the few mV difference and makes a little click sound when switching gain.But I think you're right I can move the AC coupling (i.e. C2) before the input buffer, add a slight load (like 1MOhm) for the input bias current, this should solve my issue with low frequency signals as it removes the high-pass filter made by C2 and R9! I'll try it

author: Terry Bites
author_rank: Super Contributor
timestamp: February 14, 2021, 03:44:32 pm
content: The DAC datasheets shows an RC power filter. If you have used it, check the series resistor is correct. If it is too high the output current may be too low. This may be why you are having to use a buffer. it also suggests using an active low-pass filter. Without this you won't get a clean signal, could it be the source of your noise even. You can design a filter with 8dB of gain if needed.Clipboard01.jpg(149.39 kB. 1759x809 - viewed 82 times.) Why mute to -22db exactly instead of going all the way?The pop is probablycharge injection. Google it. When the 74LVC1G3157 changes state it typically injects a 5pC charge (page 13 of datasheet) into your circuit. Q=CV so say 5pC find its way on to your op-amp input capacitance which may be in the region of 5pF and a 1V pulse appears- in theory anyway.So it is often better to isolate the switching from the opamp. There are "clickless" audio switches available- at a price.Improved filter

author: Jan Audio
author_rank: Frequent Contributor
timestamp: February 14, 2021, 05:52:56 pm
content: U3.2 and U3.4 i would add a small capacitor from negative input to output against ringing problems.

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 14, 2021, 07:16:05 pm
content: Thanks Terry this helps a lot.I did not use the RC power filter, just filter caps.And actually I have no idea why I had in my head that the DAC could not take any loads - sorry about that - I just tested it and it handles a 18k Ohm load without problems (I literally get 0% voltage reduction).To answer your question about the -22dB it is for 2 purposes:* I get a bit of white noise when the +8dB gain is on. It is not loud but you can hear it when no audio is playing. When I switch the gain to -22dB it is very quiet.* Also I control the volume digitally by reducing the bittage, and I do not want to go lower than 12bits - so my idea was:** 16 bits = +8dB** 15 bits = +2dB** etc. until 12 bits = -16dB** then I can go back to 16bits and reduce the analog volume by -22dB** then -28dB with 15bits** etc. until -46dB with 12 bitsDo you think adding the active low-pass filter like you presented will reduce the white noise? Or is only to improve the audio?And thanks, I'll check charge injection, I did not know about that@Jan: Thank you - actually I did notice some ringing around 2.65MHz (of about 100mV) on the output. It only appears with one pair of headphones (and I tested many) which has a long "spiraly" cable, which I guess has a lot of capacitance. Am I right that adding these would help reduce the ringing?If say I want to cut above 100kHz, how to I get the value?Also - why only on U3.2 and U3.4 (and not U3.3 which is also output to the left channel)?

author: Terry Bites
author_rank: Super Contributor
timestamp: February 15, 2021, 10:28:18 am
content: Bandwidth limiting will hopefully reduce over all noise. Make sure your power supplies are properly decoupled. Check your grounding and supply arrangement for current loops.I have sharpened up the filter response a bit (and I forgot a resistor!). The voltage divider in your original circuit does not generate a solid reference point.So you do need to the decouple noise and buffer this halfway voltage so that it creates low impedance. A high impedance will be very sensitive to all kinds of stray signals and this too may appear as noise and possibly ringing because it provides an unintentional feedback path.

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 15, 2021, 11:20:00 am
content: I guess the resistor your forgot was R12?Interesting point about the noise coming from the half-way point, I did not think about that.Also, is there something missing at the bottom (next to C9)?And about C6, any particular reason for choosing 150n (instead of 100n f.x. which is used other places as decoupling)?ThanksSimon

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 15, 2021, 12:05:06 pm
content: So I tried to put the input of the circuit to ground (instead of the DAC output), and the white noise is completely gone - so I guess the noise is coming exclusively from the DAC.I'll try to (low-pass) filter then on the first opamp with a similar circuit to yours Terry and let you know if it helps

author: David Hess
author_rank: Super Contributor
timestamp: February 15, 2021, 12:51:42 pm
content: Quote from: simonlasnier on February 15, 2021, 12:05:06 pmIs the DAC part of a separate circuit? If so then the noise might be from a ground loop and not the DAC itself. My solution in this case has been to replace the input buffer with an instrumentation amplifier to make a balanced input with one line going to the DAC and the other line going to the DAC's ground or common, so noise from the ground loop is subtracted.

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 15, 2021, 03:32:05 pm
content: I did not know ground loops could create white noiseI though a ground loop noise would be more like low-frequency noise, typically catching the AC outlet frequency 60Hz.The DAC is not separate from the rest, the original circuit was on a PCB with DAC and opamps next to each other.But having a switchable -22dB gain works for me, then the noise is not hearable anymore.I also tried adding a filter, attached. I went for a Multiple Feedback instead of a Sallen-Key and I removed the input buffer (it was not needed as mentionned before).Unfortunately the filter makes no difference to the noise, which I think makes sense since the noise I care about is in the audible range and the filter was only filtering above that.The good thing though is that removed the 2MHz oscillations completely, even without extra caps on the two other opamps. I tried to remove C8 and R3 (shorting it), i.e. having almost the same circuit as before but with a 470pF cap between invertnig input and output of the first opamp. This also works perfectly fine, and is not ringing.And I checked the charge injection from S1 - but when no audio is playing no click/pop is hearable at all so I think the click is related to the coupling cap and the fact the level is not "back" yet when I switch back.I have a few general questions about opamps which I will ask in another thread. Then I'll come up with a new designThank you all

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 15, 2021, 04:20:58 pm
content: Actually Terry, just wondering, if I want to switch to -22dB like you suggested on your first replies (i.e. with an opamp gain of 8dB always and a passive attenuator before then opamp), then I do need two extra opamps - one for the half-way point and a buffer for the output of the DAC, correct?

author: Jan Audio
author_rank: Frequent Contributor
timestamp: February 15, 2021, 05:18:23 pm
content: Quote from: simonlasnier on February 14, 2021, 07:16:05 pmThe ringing is called instability of the opamp :https://www.eevblog.com/forum/projects/opamp-ringing/msg2459511/#msg2459511The ringing can apear at random if no sound plays in the opamp, any value capacitor will work,and indeed you can calculate for a 20KHz to remove some noise.Only 3.2 and 3.4 because you have short circuit the other 2 and it would be a useless component, pure logic.For the frequency i made this topic :https://www.eevblog.com/forum/projects/calculate-damping-frequency/msg3457702/#msg3457702For a 22K feedback resistor and a 350pf capacitor i use this calculation :FreqHertz = 1 / ( 2 * 3,1416 * 22.000 * 0,000000000350 ) (EU .,)

author: David Hess
author_rank: Super Contributor
timestamp: February 15, 2021, 05:27:16 pm
content: Quote from: simonlasnier on February 15, 2021, 03:32:05 pmThe ground loop itself does not create any noise. It is the return current for a different circuit which does that. In the case of a DAC, the return currents for the digital inputs and clock and any other associated logic could be getting into the audio input from the DAC through the ground loop.