Square to Sine wave conversion?

Started by GREEN FUZ, September 02, 2007, 03:10:19 PM

Previous topic - Next topic

GREEN FUZ

I am currently working my way through several Tremolo circuits in my quest to find the ultimate trem. A pointless task perhaps as there is no such thing.
In doing so I have avoided some of the better known ones, EA, Pulsar, Tremulous Lune etc. No particular reason, just a stubborn compulsion to tread lesser travelled paths and maybe present something 'different' back to the forum. What I`m working on at the moment is not so different but at least lesser known. It`s a circuit from one of the Penfold books based around a Cmos 4011 functioning  as a square wave oscillator. I really like it, mainly for the great range of speeds it exhibits and am considering doing a PCB layout for it.

Now to the matter at hand. To give it some versatility I`ve been looking into the question of square wave to sine wave conversion. It seems it`s not the easiest trick in the world to pull off but I`d be happy with at least an approximation. Ideally with as small a parts count as possible.

Two possibilities are either THIS idea by Gez Paton although I`m sure he would have mentioned if the idea was as applicable to square waves as it is to triangle.

The other is THIS which seems to rely on an obsolete component + I`m having some difficulty making out the values. Does anyone know where to find an MF6 or something that would substitute?

Would it be easier to start with a Sine wave tremolo and filter it to produce a square?

Any other suggestions gratefully accepted.

nordine

you can use the classic square to triangle to filtered triangle (which is like a sine) ...any two opamp oscillator features this conversion (at least the two first steps)

marginally ON topic, i'd like to suggest you, as you are experimenting with tremoloes, to give a shot to a transcon opamp tremolo (eg. CA3080)... these sound sweeet  :icon_biggrin:

GREEN FUZ

Thanks, I`ll look into the CA3080. It did crop up a couple of times while I was searching.

Not sure if the square to triangle trick is applicable to the 4011 but if anyone can point me in the right direction...

brett

Hi
what you need are an integrator to accumulate the square voltages into triangles, then a "shaper" to convert triangles to sine.

For the integrator: imagine that you are continually adding up a positive voltage (top of a square wave).  You get a straight, rising line.  Then, when the square wave flips to a negative voltage, it becomes a straight, falling line.  Integrators are common and simple.  If IRC, they are often just an op-amp amplifier with an extra cap (in the feedback loop?).

Triangle to sine is fairly easy shaping.  Many circuits use diodes and resistors to "round out" the peaks and troughs with clipping.  Again, op-amps are often used, and usually two pairs of (diode and resistor) in each direction. 

You can see the integrator and clipping stages in this crude sine wave generator / oscillator.  It's dead simple and not too bad, especially considering it only usues 2 shapping diodes instead of four (two each way).
cheers

Brett Robinson
Let a hundred flowers bloom, let a hundred schools of thought contend. (Mao Zedong)

Paul Perry (Frostwave)

True enough Brett, but the problem there is that while the square integrates to a triangle nicely enough, the amplitude of the triange is inversely proportional to the frequency of the square. And the shaping network assumes a particular (fixed) amplitude for the triangle coming in.

gez

Paul's absolutely right.  You need steady amplitude of any signal if you go down the route of shaping.

The Simple Sine-on circuit increases amplitude of the 'sine' with increasing freqency, thereby compensating for the decrease that would normally occur.  The second integrator acts like a filter, but doesn't cause the distortion that simple passive filters can cause.  Although the resultant sine isn't mathematically perfect, it's pretty close (it looks sinusoidal, and not like 'Frankensine' - diode shaping can cause little 'corners', giving a crude end result).

As for shaping a sine from a square.  Fine if you're dealing with one frequency, but over a range you're going to have to design a tracking filter. 
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

R.G.

Then there's the FrankenCircuit approach - which I know is not appropriate here because it's not a small circuit and few parts.

Take your square wave. PLL upvert it by maybe 64X with a CD4046 PLL and a CMOS divider chip. Use that as a clock into a shift register sine wave generator. With a 64X clock, the first harmonic in the resulting sine wave is at 63x the basic sine wave. You can follow that with and R-C and no tracking and get really good sines.

Likewise, you can do the whole sine-making in a PIC, either by making both the sine and square from a table lookup, or if you already have a square you want to use, put just the sine shaping inside the controller. Doing it from a PIC only, maybe a 12C508, gives you sine and square in a single 8 pin package, no timing caps and a $1.50 chip.

'Course the rest is A Simple Matter of Programming.  :)
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

gez

Quote from: gez on September 16, 2007, 10:48:36 AMAlthough the resultant sine isn't mathematically perfect, it's pretty close (it looks sinusoidal, and not like 'Frankensine' - diode shaping can cause little 'corners', giving a crude end result).

Found this in my files:



I didn't post it in the Simple Sine-on thread as the above was the result of a CMOS version of the circuit, which wasn't as good.  Anyway, it gives you a rough idea of the quality of the sine that the circuit kicks out (though the op-amp version is much cleaner).
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter