MUFF WIGGLER Forum Index
 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

How to Make Cosine from Sine?
MUFF WIGGLER Forum Index -> Eurorack Modules Goto page 1, 2  Next [all]
Author How to Make Cosine from Sine?
luketeaford
The Subcon Vampire has a cosine output which is a one octave up sine wave shifted 90 degrees if I am not mistaken. I don't have mine mounted at the moment and don't want to put it back in just to test this.

The STO's sub output has an interesting sound and I remember recreating it somehow using the vampire-- so my theory is it's the cosine divided by two.

Is there a way to patch this up using a sine wave from any old oscillator? I am aware that filters shift the phase and an octave up effect can be made with ring mod or full wave rectification, but am struggling to put these two ideas together and get the result I'm looking for. I'm thinking maybe there is a way to do this with logic/mixing?
JohnLRice
Depending on what you want to do, sometimes an audio delay can work for this?
acgenerator
cosine is a a phase shift of sine.

https://en.wikibooks.org/wiki/Trigonometry/Graphs_of_Sine_and_Cosine_F unctions

unless you have something that has a unique synchronization to a specific phase of the waveform, they can be used interchangeable. If you need it to be sync, use a hard sync, phaser, PLL to ensure the cycles align as needed.
luketeaford
JohnLRice wrote:
Depending on what you want to do, sometimes an audio delay can work for this?


The only proper delay I have is an Echophon, but thank you for this because it got me thinking and I used an ASR sampling the sine wave and held by the square wave and then mixed the four outputs in the scan and pan which is a neat approximation-- it makes like a phasing effect as I had predicted. thumbs up
luketeaford
acgenerator wrote:
cosine is a a phase shift of sine.

https://en.wikibooks.org/wiki/Trigonometry/Graphs_of_Sine_and_Cosine_F unctions

unless you have something that has a unique synchronization to a specific phase of the waveform, they can be used interchangeable. If you need it to be sync, use a hard sync, phaser, PLL to ensure the cycles align as needed.


Ah yes, I mean that the subcon vampire's cosine is an octave up from the sine wave.
Navs
I think that deriving the cosine from a sine is not easy, at least not from an arbitrary signal, where you'd need a dome filter - the sort of thing found in frequency shifters.

Otherwise, the simplest way is to generate it at source, like Doepfer's A-143-9, which is a filter as oscillator - the cosine can be 'tapped'.

Some wavefolders will generate a cosine, like the Toppobrillo TWF. Similarly, you could use a sawtooth animator to phase shift by 90 degrees.

For the patch with logic, search for the Toppobrillo Sport Modulator manual. This relies on two integrators, firing one after the other much like you'd do with two sections of Maths (EOR triggers slope 2, slope 2's EOC triggers slope 1 etc).
atl
sin^2 x = 1/2 (1 - cos 2x)

take the sine signal, square it (multiply it by itself) and then subtract the resulting signal from a quarter of the original p-p voltage.

So feed the input to both inputs of a ring mod, and you have a cosine up an octave, at 1/2 amplitude, and 180 out of phase.
edit:
https://en.wikibooks.org/wiki/Trigonometry/Graph_of_Sine_Squared

A couple clicks on from the earlier link. Luke, you pretty much had it with the ring mod. The full wave rectification would be up an octave, but it would've had a lot of rich overtones, and decidedly not cosine (it's a special case of a wavefolder).
pieter
Since sine and cosine are related via differentiation/integration, perhaps you can use Maths to integrate the signal? Put the cosine into the signal in of channel 1 and take the output of channel 1 with the integral sign. You will have to find the right settings for the rise, fall, and curve (I haven't tried this myself, so it's pure theory at this point).
honeyb
atl wrote:
sin^2 x = 1/2 (1 - cos 2x)

So feed the input to both inputs of a ring mod, and you have a cosine up an octave, at 1/2 amplitude, and 180 out of phase.

A couple clicks on from the earlier link. Luke, you pretty much had it with the ring mod. The full wave rectification would be up an octave, but it would've had a lot of rich overtones, and decidedly not cosine (it's a special case of a wavefolder).


Love it! Works from basic trig identities to simple electronics.
sko87pro
Quote:
I used an ASR sampling the sine wave and held by the square wave and then mixed the four outputs in the scan and pan which is a neat approximation


This is very interesting. Using an ASR like this suggests your signal is a relatively fast-moving sine at audio frequency, and the 2nd or 3rd stage of the ASR achieves the level of delay (phase shift) that you need? The clock speed into the ASR is important also, what did you use for that? If the clock is too fast then the ASR won't achieve much delay and if it's too slow then you'll get a lot more than 90 degrees of delay (or things may look stepped on the ASR output).

Interesting approach, I must try this. Also a delay line might work, depending on how fine a control you have over the delay time.
luketeaford
Navs wrote:
I think that deriving the cosine from a sine is not easy, at least not from an arbitrary signal, where you'd need a dome filter - the sort of thing found in frequency shifters.

Otherwise, the simplest way is to generate it at source, like Doepfer's A-143-9, which is a filter as oscillator - the cosine can be 'tapped'.

Some wavefolders will generate a cosine, like the Toppobrillo TWF. Similarly, you could use a sawtooth animator to phase shift by 90 degrees.

For the patch with logic, search for the Toppobrillo Sport Modulator manual. This relies on two integrators, firing one after the other much like you'd do with two sections of Maths (EOR triggers slope 2, slope 2's EOC triggers slope 1 etc).


Thanks! I don't have a sport modulator but have plenty of Maths and an SSG around so I can play with it. So far nothing has gotten me as close to my end goal of recreating the STO sub sound-- so here we are playing a weird game where I describe a module know one knows (the vampire) being patched to recreate a specific STO feature and I'm relying on my memory of how I got closest to it so I can ask engineering questions that are over my electronics knowledge in the hope of figuring out just what the STO sub is actually doing Dead Banana
luketeaford
atl wrote:
sin^2 x = 1/2 (1 - cos 2x)

take the sine signal, square it (multiply it by itself) and then subtract the resulting signal from a quarter of the original p-p voltage.

So feed the input to both inputs of a ring mod, and you have a cosine up an octave, at 1/2 amplitude, and 180 out of phase.
edit:
https://en.wikibooks.org/wiki/Trigonometry/Graph_of_Sine_Squared

A couple clicks on from the earlier link. Luke, you pretty much had it with the ring mod. The full wave rectification would be up an octave, but it would've had a lot of rich overtones, and decidedly not cosine (it's a special case of a wavefolder).


Awesome-- I will try again with a cleaner ring mod and subtracting! Thanks!
luketeaford
sko87pro wrote:
Using an ASR like this suggests your signal is a relatively fast-moving sine at audio frequency, and the 2nd or 3rd stage of the ASR achieves the level of delay (phase shift) that you need? The clock speed into the ASR is important also, what did you use for that?


I'm using the Analog Shift Register in the Verbos Random Sampling and the signal to sample is the sine wave and the hold is the square from the same oscillator. It's not precise because there is a tiny bit of "flam" built into the random sampling and the effect is subtly different, but it does indeed sound like a low quality phaser to me.

I don't have any delays apart from echophon to try with. Obviously the most sensible thing would be to remount the vampire and try with that, but now I am curious exactly what the magic of the STO sub is (has a great sound).
Navs
Haha - it's a nice game, Luke. But now that I've re-read your OP I don't know what you're after hihi An octave up? I'm not sure I'd call that a cosine hmmm.....

The 'cosine' (phase-shifted?) sub or pulse should be easy as all you have to adjust is the threshold of a comparator, e.g. if the STO is a saw-core ...
luketeaford
The Subcon Vampire has a "cosine" output that is an octave up and phase shifted (if you believe the manual) and the STO has an unusual sub octave output. I somehow got really close to that sound and completely forgot how so I'm trying to piece it back together. Definitely had to do with that "cosine" output, dividing, and possibly mixing and summing 'cause those are my usual tricks.

I'll bump this thread if I ever figure it out again-- thanks for all the help as always! thumbs up
AndreasD
As a 12dB (2-pole) filter results in a 180 deg phase shift a.k.a. converts a sine into a cosine, just use eg. a HP below the filter freq, boost the signal and you have what you want.
FrogStar
From my understanding sine and cosine wave sound exactly the same until they are combined in some additive way.
That said, the STO sub-out is more complicated. It looks like this:
MRoyce
Cosine has a shift of 90° to the sine. That's the tricky bit, maybe a 1-pole(6dB/Oct) filter would do the trick @AndreasD mentioned?

@Frogstar, that is simply a square that's been highpassed, likely the DC filter in your ADC. Really simple way to get a sub that way, it's VCO->Comparator-> Flip-Flop.
Multi Grooves
URA opto-intergator?
natureclubcassettes
Navs wrote:
like Doepfer's A-143-9, which is a filter as oscillator - the cosine can be 'tapped'.


is this really how the circuit works in this quadrature oscillator? so it's like a dr. oct?



thank you for this info! never would have crossed my mind that it's a fully resonant low pass...
moremagic
MRoyce wrote:
@Frogstar, that is simply a square that's been highpassed, likely the DC filter in your ADC. Really simple way to get a sub that way, it's VCO->Comparator-> Flip-Flop.
i dont think the scopes shaping it much -- thats how the sub out on sto behaves
i fed mine as much negative offset to slow it down and listened to it modulate another vco and it was the jump and rise then a drop and fall
MRoyce
In that case the DC-filter is on the STO, which makes sense if MN wanted the sub-out to be bipolar.
red
incidental remark


- not sure about this interesting thread... from the view of music/sound there is no difference between sine and cosine - it's a continuous wave. Only in relation to other signals the phase shift of the cosine will interact different than a sine with other waves of the spectrum.
acgenerator
red wrote:
incidental remark


- not sure about this interesting thread... from the view of music/sound there is no difference between sine and cosine - it's a continuous wave. Only in relation to other signals the phase shift of the cosine will interact different than a sine with other waves of the spectrum.


That was my point. If you don't need it's synced or phase locked to something else... you can just use a sine wave. I.e. wait a fraction of a millisecond and that sine wave is a cosine wave.
sko87pro
Quote:
That was my point. If you don't need it's synced or phase locked to something else... you can just use a sine wave. I.e. wait a fraction of a millisecond and that sine wave is a cosine wave.


Yes, but there’s a catch here. A given sine at 100Hz is a cosine 2.5ms later:
1s / 100Hz = 10ms / 4 (90°) = 2.5ms delay

A delay of 2.5ms is easy enough, but for a 4kHz sine, the cosine is later by:
1s / 4000Hz = 0.25ms / 4 (90°) = 62.5us delay

I don’t think we can easily specify 62.5 microseconds of delay under CV control, and have this accurately tracked from Hz up to kHz? It’s similar to v/oct filter tracking across 5+ octaves. This is why it makes sense to derive cosine from the same circuit as the original sine generation. There are some practical difficulties of doing this using a delay line to achieve a phase shift of precisely 90 degrees at any frequency.

Wave folding and precision adding etcetera might be easier, I don’t know...

But as you say, acgenerator, if accuracy doesn’t matter (don’t need sync/phase lock) then there are several ways to get some phasing. Or choose some flanging instead. There’s nothing like a jolly good flange, I always say.
MUFF WIGGLER Forum Index -> Eurorack Modules Goto page 1, 2  Next [all]
Page 1 of 2
Powered by phpBB © phpBB Group