offsetting an audio signal above 0V? - Page 1
Forum section: electronics / beginners

author: dentaku
author_rank: Frequent Contributor
timestamp: January 11, 2016, 02:25:59 am
content: I want to offset an audio signal coming from a headphone output so that it stays above 0V for a circuit that is powered by 0V/5V.What I want to do is then take this signal and square it up using a comparator.What's the best way to offset this audio signal and not potentially damage the headphone output of the device playing the audio?For example, in this image I would like to move the blue trace up so it stays all above 0V.

author: Connoiseur
author_rank: Regular Contributor
timestamp: January 11, 2016, 02:39:35 am
content: The simplest solution would be a capacitor with voltage divider (the kind used in CE transistor amplifiers).

author: dentaku
author_rank: Frequent Contributor
timestamp: January 11, 2016, 02:44:36 am
content: Quote from: Connoiseur on January 11, 2016, 02:39:35 amIs the capacitor simply to avoid sending DC back into the audio device through the headphone jack?I'm also thinking that you would have to choose the right size capacitor and resistor so it doesn't form a highpass filter that would cut out any low frequencies that you might still want.

author: Connoiseur
author_rank: Regular Contributor
timestamp: January 11, 2016, 02:57:33 am
content: Quote from: dentaku on January 11, 2016, 02:44:36 amYes the capacitor prevents dc from flowing into the headphone jack. Basically what this circuit does is1) Voltage divider creates a dc bias point2) AC flowing via the capacitor disturbs this bias point in relation to the signal swing.Of course you'll have to size the components properly, otherwise you'll get a lot of attenuation in the higher frequency. Also, if the capacitor is too large, it will take a long time before it charges to the equilibrium voltage.There's one more solution- the clamper circuit, however the bias point will depend on the signal swing.

author: Connoiseur
author_rank: Regular Contributor
timestamp: January 11, 2016, 03:00:43 am
content: Quote from: Connoiseur on January 11, 2016, 02:57:33 amoops typo... I mean attenuation in the low frequency range

author: dentaku
author_rank: Frequent Contributor
timestamp: January 11, 2016, 03:24:56 am
content: Quote from: Connoiseur on January 11, 2016, 03:00:43 amI was going to mention that because it forms a highpass filter and not a lowpass.I guess tomorrow I'll try something like this.

author: Connoiseur
author_rank: Regular Contributor
timestamp: January 11, 2016, 04:00:26 am
content: Quote from: dentaku on January 11, 2016, 03:24:56 amThat's a very good solution. Offsetting the inverting input of Opamp allows you to precisely control the bias level. I think most opamps have enough gain bandwidth product to avoid any distortion in the higher frequency notes.BTW what are you going to do with the output signal? Some form of class D amp?

author: dentaku
author_rank: Frequent Contributor
timestamp: January 12, 2016, 11:35:22 pm
content: Quote from: Connoiseur on January 11, 2016, 04:00:26 amI'm actually doing this because I want to convert audio from a synth to a harsh sounding squared signal and use it to clock a 74HC393D Dual 4-bit binary ripple counter so I can divide it down by 2, 4 8, etc. to create "sub-octaves", to use a synth geek term.I also have a circuit using a TC40H386P - Quad 2-input Exclusive-OR Gate and a 4013 D-type flip-flop to divide by three that I want to mess with.I'll probably end up lowpass filtering the output and mixing it with the original signal.It's all just experimenting with logic chips to create audio effects.

author: Audioguru
author_rank: Super Contributor
timestamp: January 13, 2016, 12:14:12 am
content: Your circuit will produce 0VDC all the time because the LM339 quad has comparators without anything to pull up the outputs, not opamps. You must add a pullup resistor from the output to the positive supply voltage. Try 22k or 2.2k. Usually a comparator circuit uses some positive feedback to provide hysteresis so that the output switches quickly without oscillating at the switching threshold voltage.

author: dentaku
author_rank: Frequent Contributor
timestamp: January 13, 2016, 12:19:14 am
content: I found some comparators in my bins last night (393, 339, 392) and built a simple circuit to test them out.The output was nothing like the simulation so I swapped the 392 with a 393, then another one and it was always the same.I then decided to use a 358 opamp instead and it worked just like Circuit Wizard showed.Hmmm. I realised that obviously the outputs in Comparators are different than in OpAmps.I checked the 393 datasheet and saw that all the example circuits have a pullup resistor on the output.I then checked the schematic and saw that the output is just connected to the collector of a darlington so it syncs current. I never thought about that before because I've never really used comparators for anything.The LM392 schematic is nice because it's basically a 393 and a 358 in one package so you can easily see the difference on the same page of one datasheet.Today I did a simulation in LTSpice and unlike Circuit Wizard it actually simulates correctly and only works with a pullup resistor on the output.

author: dentaku
author_rank: Frequent Contributor
timestamp: January 13, 2016, 12:21:28 am
content: Quote from: Audioguru on January 13, 2016, 12:14:12 amI just happens that you posted this message while I was still composing my post about discovering that I needed a pull-up on the output

author: dentaku
author_rank: Frequent Contributor
timestamp: January 13, 2016, 12:22:50 am
content: By the way, is there any reason why I shouldn't just use an LM358 OpAmp instead of a real Comparator for something like this?I see the edges on the output of the comparator are faster but would that be really that bad for what I want to use this for?

author: Zero999
author_rank: Super Contributor
timestamp: January 13, 2016, 09:53:05 am
content: Quote from: Connoiseur on January 11, 2016, 02:39:35 amThat will work.The lower 3db cut-off can be calculates using the following formula:F0= 1/(2piRC)Where C is in Farads and R is the equivalent value of both resistors connected in parallel.