Help with audio circuit (OpAmp) - Page 1
Forum section: electronics / projects

author: SukkoPera
author_rank: Newbie
timestamp: August 19, 2024, 09:35:17 pm
content: Hi, first post here!I am designing an expansion cartridge for the good ol' Commodore 16/Plus4 which allows connecting an AY-3-8910 sound chip and a TLC7226 4-channel DAC to the machine.I can more or less get around digital electronics, so that part is OK: the chips are mapped somewhere in memory and I can read/write to them without any issues. Where I totally get lost is the analog part, in this case the output amplification. I have near-zero knowledge in this area, so please bear with me if I did anything stupid.Let me show what I got so far:AY circuit:DAC circuit:The idea here with both chips is that their output can be connected to external equipment through a jack connector. Through said connectors the audio can be picked up in a somewhat stereo fashion, where the multiple AY/DAC channels are somehow mapped to the L/R channels. Things were implemented like this on an old board and I'd like to replicate that idea. Here comes the first question: why do the series cap values have to be so different in the two circuits? I started using 4.7uF on the DAC too, but it sounded terrible, I got down to 100nF by trial and error. Then I tried using 100nF on the AY just as well but that makes it sound terrible in turn. Since the "mixing" resistors are the same values, I would expect the caps to have similar values but clearly it's not the case.Anyway, if nothing is connected to the jacks, the output of each chip must be mixed to mono and then the two must be mixed together and fed back into the computer through a dedicated pin (EXT_AUDIO), through which the signal will be mixed one more time with the built-in audio. Without further ado... OpAmp Circuit:(Yes, the 1-6 GAIN label is wrong, I'm aware)This was designed with input from other people but I'm sure I've messed things up. I only have a 5V power rail, so the opamp must work with 0-5V. For this reason I created a 2.5V level in order to offset the opamps. I used the inverting configuration twice, so the signals should be non-inverted in the end. The circuit sort of works, but there is a huge difference in the volume of the two chips! I measured the levels at the opamp inputs:- The level of the signal from the DAC measured at R23/24 is around 500 mV- The level of the signal from the AY measured at R9/10 is around 300 mVStill, with similar settings of RV1/2 (I know using a pot in the feedback loop is not a good idea, but they are not supposed to be tweaked once the sweet spot has been found), the output from the AY is muuuuch louder than that from the DAC and I cannot for the sake of me find out why. I have tried everything I could but to no avail, it looks like the DAC level can't get higher than some threshold, but then since I'm basically doing random things until it works, I decided it was a good moment to ask for help.So, any suggestions? Thanks in advance!

author: moffy
author_rank: Super Contributor
timestamp: August 19, 2024, 10:36:14 pm
content: The output caps act as a filter which is determined by the output impedance of the DAC/AY resistors and the input impedance of what they are feeding into. The resistors are not the same as the AY has a 1k attenuator dropping its output impedance relative to that of the DAC circuit. The DAC output is a little unusual having such a relative high impedance driving the 100n coupling cap.

author: SukkoPera
author_rank: Newbie
timestamp: August 20, 2024, 08:15:18 am
content: Thanks for your reply. The original DAC circuit used resistor values that were one tenth of what it's using now. I can go back to those if that helps, or change the cap of course. I am open to any suggestions.

author: moffy
author_rank: Super Contributor
timestamp: August 20, 2024, 08:53:46 am
content: Quote from: SukkoPera on August 20, 2024, 08:15:18 amIf you can reduce the DAC values that would provide less attenuation on the output, due to input loading, you might want to also increase C16/C17 to around 4.7nF. If the input impedance of the circuit that the DAC is feeding into is 10k, then you are loosing some bass as the 100nF cap forms a high pass filter @159Hz, changing the 100nF for 470nF would be good giving a HPF @33.8Hz.

author: SukkoPera
author_rank: Newbie
timestamp: August 20, 2024, 08:59:47 am
content: Sure, I can change anything, I will test what you suggest, thanks. Should I also reduce the values for the AY circuit? That would mean having 100 ohm resistors for the attenuation, shall I change the caps too, then?

author: moffy
author_rank: Super Contributor
timestamp: August 20, 2024, 09:31:52 am
content: Quote from: SukkoPera on August 20, 2024, 08:59:47 amNo, if they work as they are that's fine. The 1k output attenuator drops the output impedance to 1k and the 4.7uF cap will allow the bass through.

author: moffy
author_rank: Super Contributor
timestamp: August 20, 2024, 11:03:29 pm
content: If on the AY circuit you could replace C8 and C9 with non-polar capacitors, since the 1k resistor pulls any bias voltage down towards zero. A 470nF plastic capacitor like for the DAC circuit would work.

author: SukkoPera
author_rank: Newbie
timestamp: August 22, 2024, 09:30:55 pm
content: I have gone back to 1k/2.2k values on the DAC, + ~440nF (didn't have 470nF caps, used 2x220nF in parallel). I must admit that the sound has gotten worse, apparently the bass is distorted. Still the amplification is nowhere as near as the 10x it should be:Yellow is DAC pin 20, blue is opamp pin 8 (inverted). What I see is ~3x amplification, am I correct?

author: moffy
author_rank: Super Contributor
timestamp: August 22, 2024, 09:54:13 pm
content: The DAC output looks wrong, large fast steps, there doesn't seem to be any resolution or bit depth just large 1 to 2 bit jumps, no fine steps, at about 12-15kHz sampling rate. I've seen something similar when the bit order has been reversed and the LSB becomes the MSB. The amplification though low, looks relatively clean, remember the output of Pin 20 is attenuated by the other resistors.

author: SukkoPera
author_rank: Newbie
timestamp: August 23, 2024, 08:24:56 pm
content: The TLC7226 datasheet never states which is the LSB but I think I got it correct. The output sounds good to me and it is very similar to what I get from another board with a R-2R DAC. Don't forget that data is pushed to the DAC by a 6502 CPU running at less than 2 MHz, it's already quite of a miracle that it can reach this level.I'll be on holidays for one week, I'll resume experimentation when I'm back. Thanks for the moment!

author: moffy
author_rank: Super Contributor
timestamp: August 24, 2024, 02:26:28 am
content: Have a nice break, if you can when you get back, try outputting say a 100Hz high res sine wave out of the DAC and see what the waveform looks like.