Author Topic: offsetting an audio signal above 0V?  (Read 3855 times)

0 Members and 1 Guest are viewing this topic.

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
offsetting an audio signal above 0V?
« on: January 11, 2016, 02:25:59 am »
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.
« Last Edit: January 11, 2016, 02:28:11 am by dentaku »
 

Offline Connoiseur

  • Regular Contributor
  • *
  • Posts: 104
  • Country: in
Re: offsetting an audio signal above 0V?
« Reply #1 on: January 11, 2016, 02:39:35 am »
The simplest solution would be a capacitor with voltage divider (the kind used in CE transistor amplifiers).
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: offsetting an audio signal above 0V?
« Reply #2 on: January 11, 2016, 02:44:36 am »
The simplest solution would be a capacitor with voltage divider (the kind used in CE transistor amplifiers).

Is 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.
« Last Edit: January 11, 2016, 02:47:41 am by dentaku »
 

Offline Connoiseur

  • Regular Contributor
  • *
  • Posts: 104
  • Country: in
Re: offsetting an audio signal above 0V?
« Reply #3 on: January 11, 2016, 02:57:33 am »


Is 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.

Yes the capacitor prevents dc from flowing into the headphone jack. Basically what this circuit does is
1) Voltage divider creates a dc bias point
2) 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.
 

Offline Connoiseur

  • Regular Contributor
  • *
  • Posts: 104
  • Country: in
Re: offsetting an audio signal above 0V?
« Reply #4 on: January 11, 2016, 03:00:43 am »
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.


oops typo... I mean attenuation in the low frequency range
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: offsetting an audio signal above 0V?
« Reply #5 on: January 11, 2016, 03:24:56 am »
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.


oops typo... I mean attenuation in the low frequency range

I was going to mention that because it forms a highpass filter and not a lowpass.

I guess tomorrow I'll try something like this.
 

Offline Connoiseur

  • Regular Contributor
  • *
  • Posts: 104
  • Country: in
Re: offsetting an audio signal above 0V?
« Reply #6 on: January 11, 2016, 04:00:26 am »

I guess tomorrow I'll try something like this.


That'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?
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: offsetting an audio signal above 0V?
« Reply #7 on: January 12, 2016, 11:35:22 pm »

I guess tomorrow I'll try something like this.


That'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?

I'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.
 

Offline Audioguru

  • Super Contributor
  • ***
  • Posts: 1507
  • Country: ca
Re: offsetting an audio signal above 0V?
« Reply #8 on: January 13, 2016, 12:14:12 am »
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.
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: offsetting an audio signal above 0V?
« Reply #9 on: January 13, 2016, 12:19:14 am »
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.
« Last Edit: January 13, 2016, 12:23:44 am by dentaku »
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: offsetting an audio signal above 0V?
« Reply #10 on: January 13, 2016, 12:21:28 am »
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.

I 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 :)
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: offsetting an audio signal above 0V?
« Reply #11 on: January 13, 2016, 12:22:50 am »
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?
« Last Edit: January 13, 2016, 12:54:09 am by dentaku »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19514
  • Country: gb
  • 0999
Re: offsetting an audio signal above 0V?
« Reply #12 on: January 13, 2016, 09:53:05 am »
The simplest solution would be a capacitor with voltage divider (the kind used in CE transistor amplifiers).

That 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf