[sdiy] Square to Sine
Tom Wiltshire
tom at electricdruid.net
Tue Apr 4 15:11:31 CEST 2017
>From the document:
"Present implementations limit magic sinewaves to power line frequencies, possibly up to 400 Hertz."
and
"Unusual programming techniques are required as each and every microprocessor clock cycle is critical."
Sounds like exactly the sort of thing the SDIY list would get into!
and
"As many as 44,000 or more microprocessor instructions may be needed per power line cycle."
So it looks like full audio might be pretty demanding. Not impossible, perhaps, but at least demanding. For generating sines for a Hammond organ (just to take totally random example…) we'd only need up to 6KHz. Assuming the 44K-instructions-per-cycle guideline from above, that's a 264MHz processor!
Still, like you, I can't help thinking there must be a (simpler) way…
Tom
On 4 Apr 2017, at 13:26, rburnett at richieburnett.co.uk wrote:
> I have always wondered about magic sinewaves for something like this. For those not familiar they are sinewaves generated digitally using PWM techniques but the transitions in the PWM pulse-train are carefully chosen using some clever mathematics to force most of the low-order harmonics to zero. This *greatly* reduces how much you have to filter the signal in order to get a decent sinewave with nice low THD.
>
> http://www.tinaja.com/glib/msinexec.pdf
>
> Might not be appropriate here? ...but it's a neat trick nonetheless. It's used in power electronic "inverters" for driving motors, but can't help thinking it might have some uses in audio synthesis too?
>
> -Richie,
>
> On 2017-04-04 12:37, Tom Wiltshire wrote:
>> On 4 Apr 2017, at 11:32, Elaine Klopke <functionofform at gmail.com>
>> wrote:
>>> Does this actually work?
>> http://www.learningaboutelectronics.com/Articles/Square-to-sine-wave-converter-circuit.php
>>> I would assume that being 3 RC networks in series means quite the
>>> drop in volume.
>> Yes, it works, and yes, it'll kill the volume. It's a three-pole
>> passive filter. The recommendation (which they've ignored in this
>> example) is for each resistor to be ten times the previous one to help
>> avoid one stage loading the next. So it could be improved. There's an
>> example in my LoopEnv datasheet, pg.6:
>> http://www.electricdruid.net/datasheets/LOOPENV1Datasheet.pdf
>> It'll only work properly at one particular frequency, as you've
>> realised. Changing the input frequency will change both the level and
>> the harmonic content of the output (although perhaps not enough to
>> matter for small changes in input frequency - e.g. vibrato?)
>>> Also, in a related article they show two networks in series
>>> converting the square wave to a triangle.
>> Probably running the square into an integrator. That gives you a nice
>> triangle, but the same volume problem - the volume halves for each
>> octave you go up. Have a look at the stuff online about DCOs for more
>> about this, since this is the problem they had to overcome.
>>> All of the converters being dependent on the frequency of the input
>>> wave being roughly the same as what the RC networks are tuned to.
>> Exactly.
>> Tom
>> _______________________________________________
>> Synth-diy mailing list
>> Synth-diy at synth-diy.org
>> http://synth-diy.org/mailman/listinfo/synth-diy
More information about the Synth-diy
mailing list