square to sine wave blending?

Started by corbs, May 27, 2005, 04:43:53 AM

Previous topic - Next topic

corbs

funny but i just thought this was going to be easily possible.



this is the effect i'm after - to  be controlled by a pot. would i have to set up two seperate wave generators and try to blend the signals? is there an ic geared towards this?

cheers for any ideas

Paul Perry (Frostwave)

I have made an oscillator that goes from triangle to sine to square with a pot, all it is, is an OTA (operational transconductance amplifier) that is fed with a triangle wave, you increase the drive & first the triangle starts to turn into a sine, then as you increadse drive further it goes to a rounded square, then a pretty squarish square.
There aren't any more CA3080s being made, so use half of a LM13700 or NE5517.

gez

Paul, I can only guess that slew distortion is responsible for the phenomena you mention as I've been unable to get it to work at 'low' (9V supply) voltages.  

Doesn't matter if I starve the amp (resistor to Iabc pin in the meg range) or whatever, just can't get it to work (just goes straight into sharp clipping)... :cry:
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

RobB

Clipping a sine wave is one way of approximating a square wave.  

If you're not bothered about, or think you can overcome changes in amplitude then you could try feeding a sine wave into a diode clipper fitted with a Jack Orman style “warp” control.  

Just a suggestion.

corbs

well i should say that i'm wanting to use this for controlling the flashing of an led/ldr combo, not to create a synth. the simpler the circuit the better really, a close approx would be fine.

but i'm thinking this without the output :)

gez

Quote from: gezPaul, I can only guess that slew distortion is responsible for the phenomena you mention

Scrub that, signal wouldn't be moving fast enough... :oops:
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

80k

Commonsound has a waveshaper mod that uses a pot to blend between triangle and square wave.  it is pretty easy and works great (i have it on my phasor).

Check the kits page and look for tremulus lune, phaseur fleur, or triwave picogenerator and check out their waveshaping mod.

Here's the link to the phaseur fleur
http://www.commonsound.com/phaseur/phaseurbigwave.pdf

corbs

some very useful starting points ppl - thanks.

i'm still having real trouble getting my head round it tho :D. i'm starting with a 555 and gonna move on from there methinks.

Paul Perry (Frostwave)

Gez, I don't understand the actual mechanics of the overdriven OTA muself, but I think the principle is, that the gain control structure slowly runs out of gain as the amplitude of the input voltage (and hence current) increases.
The tri to sine OTA application is quite widespread (or was, in the days of analog!) you can get to a sine within 2% accuracy, it is alleged. Anyway, it sure looks neat on the scope, cranking up the drive & seeing the shape shift. Some people use my commercial Frostwave Resonator box (copy of the Korg MS20 synth filter) aas a general signal warmer, with the resonance controls down & the filters opened completely wide, the OTA effect is what you are getting (four times!).

gez

Quote from: Paul Perry (Frostwave)Gez, I don't understand the actual mechanics of the overdriven OTA muself, but I think the principle is, that the gain control structure slowly runs out of gain as the amplitude of the input voltage (and hence current) increases.

That's what I was thinking Paul, which is why I was trying to starve the amp, to reduce gain.  A similar thing happens in inverters, i.e. gain craps out as output approaches the rails, but you only get a rounding of a triangle's point, nothing that resembles a true sine wave.
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

corbs

paul + gez - what circuits have you used the LM13700 type ic in?

ExpAnonColin

There is simply no good, small, and reliable way to turn sine to square.

A square wave is a sine wave plus the sum of all of it's harmonics.

Take a look at this picture:


There's a sine wave shown with all of it's harmonics.  Note that on each harmonic, the frequency gets greater and the amplitude smaller.  Now let's imagine you cank eep going until you get the infinite harmonic, which is infinitely small and infinitely high frequency.  Now, starting from there, start adding all of the harmonics it took to got there, the infinity-1 harmonic, infinity-2, all the way to the first and second harmonics.  Now you have a square wave, see?  Each harmonic, when added together, produces the perfect amount to fill out the area between the x-intercepts (points of no amplitude) and the peaks, until it's just a square.

So how do you take a square wave and turn it back into a sine wave?  Well, take out the harmonics of course!  Since all of the harmonics are higher in frequency than the fundamental frequency, all we need is a lowpass filter, right?  Well yeah, a lowpass filter that will filter out every single frequency higher than the fundamental, without loweing the fundamental in amplitude at all.  Gee, that's an easy one! ;)

And to make matters worse, you're altering the frequency of your square wave.  When you use a lowpass filter like this, you have to assume you're always using the same frequency, or else, as you can imagine, as you go higher in frequency, well the lowpass filter will filter it out!  and we don't want our filter to destroy the LFO at higher frequencies, or at the very least, make it... un-amplitude stable!  (dun dun dun)

So what we need is a lowpass filter of infinite poles and an infinitely sharp rolloff point that varies in cutoff frequency directly proportional to the frequency of the square wave.  And if that was easy, or simple, someone would have posted a schematic already :)

There are other ways to get the square wave to look like a sine wave without the low-pass-filter (IE with diodes, but that is using slow diodes so as to filter out the high frequencies anyways) but none are muche asier.

In short, square to sine is not easy whatsoever.  But why start with a 555 when you can just start with a single dual OA chip and get a triangle (plenty sine wave enough for your application, I think) and a square wave.

-Colin

gez

Quote from: corbspaul + gez - what circuits have you used the LM13700 type ic in?

Phasers, tremolo, oscillators, (a LM13700 and a dual op-amp will get you a really simple quad triangle LFO) filters (you can do a lovely SVF wah with the LM13700) etc.  Any circuit that requires voltage-controlled variable resistance...
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

gez

Quote from: ExpAnonColinThere is simply no good, small, and reliable way to turn sine to square.

I'd say Paul's way is pretty simple, just doesn't seem to work at voltages lower than those shown in schematics.
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

gez

There's a simple dual op-amp sine LFO you sometimes see in commercial boxes and schematics that has a sine and square output.  You could mix the outputs with a blender.  

I use it now and again when I'm pushed for space, but you can get a little distortion of the wave form at the lower end of low frequencies.  :)
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

gez

Quote from: gezThere's a simple dual op-amp sine LFO you sometimes see in commercial boxes and schematics that has a sine and square output.  You could mix the outputs with a blender

This thing:



If you use a different amp from the ICL7621 the waveform will probably suffer a little; using this chip I was able to strip down the circuit a little.  If you do sub something else in use an amp with a symmetrical output.

Cheap and cheerful, but it works. The divider at the square wave output determines amplitude, though you might run into problems with some op-amps if you try increasing the sine's amplitude too much.
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

puretube

yep: make square out of sine - then blend...  :)

Khas Evets

I believe the Boss TR-2 has this feature. You might give that a look.

Paul Perry (Frostwave)

It certainly is possible to simply blend a triangle & sine, but... it depends whether you are happy withthe shapes you get along the way. (try drawing it out on squared paper for various ratios!)

As for varying the gain of the OTA, changing the supply voltage isn't really the way to do it, if you want to progressively distort the triangle tips.

And as for what I have built wiht LM13700s and NE5517s? oscillators (square, sine, triangle), voltage controlled amplifiers, high and low pass filters. I never built a phaser from one, but I think Bob Moog has built quite a few :wink:
For LM13700 ideas, check the data sheet, it has a LOT of stuff! and the stuff in the CA3080 application notes can be bent into 13700 form as well.

gez

Quote from: Paul Perry (Frostwave)As for varying the gain of the OTA, changing the supply voltage isn't really the way to do it, if you want to progressively distort the triangle tips.

That's not quite what I meant Paul, I was overdriving the OTA with the chip run off a fixed supply voltage, but for some reason it just goes straight into hard clipping when the chip is run at voltages lower than those specified in schematics, i.e. 9V or less.  For this reason I then started starving the amp to reduce gain in an attempt to get softer clipping...didn't work. :?
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter