jamos
Joined: Jun 01, 2004 Posts: 514 Location: Eugene, Oregon, USA
Audio files: 4
G2 patch files: 41
|
Posted: Mon Feb 21, 2005 6:21 pm Post subject:
Sawtooth Phase Shift w. offsets? |
|
|
Hey all;
I'd like to generate 8 sawtooth waves that are integral multiples of 45 degrees apart in phase. Currently I'm using LFO B; I'd like to use the Shape LFO (for the Dir input), but that puts me over 100%. So I'd like to use a single shape LFO, and generate the other phases through offsets and comparators.
Does anyone have this patched up and lying around, to save me the hassle?
TIA if so |
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Wed Feb 23, 2005 5:11 pm Post subject:
|
|
|
Nobody?
then I´ll give it a go. What you need is a modulus function. The fun with saw waves is that if you perform a mod operation on them the output will still be a saw. This means that mod[amplitude] will make a saw delayed by adding constant values to it (like we are going to do) and that mod[factor of the amplitude] will pitch shift saw waves (at the expense of volume).
First of all, a normal oscilator has a amplitude of 2·64=128 units. 45° is a 1/8 of that so we need 16 units of offset (and multiples thereoff), provided we can get the modulus to work.
Ok, because we aren´t going to go more than 360° out of phase our mod function does not need to be recursive. Also, if we can keep all phase offsets positive it can be quite simple;
"If the input is larger then 64, substract 128 from it."
Asuming we are only adding to the signal of the original osc, this will nicely wrap it round since it can never get below -64 and itll never be further out of range than +128.
However, because of the finite (and realy quite small) headroom of the G2 this will get us in trouble. The largest offset we´ll need will be +112 which will sometimes be added to values as large as 64 and so will cause clipping.
There are two things you can do about this.
*You can define your offsets on either side of your input signal, then use a mod function that will add 128 for input values below -64 in adition to what the sugestion above already does. This is mathematically nice and will keep your sound quality but it´ll make your mod function -of which you´ll need 7 copies- twice as expensive.
*You can also devide all values, including your original osc´s volume by two, then amp up the end result again. Since we are only adding and substracting it´s perfectly legal to multiply everything involved by .5, then amp up the result to compensate. This will cost you a bit of sound quality (litterally).
Either ought to do the trick, I´d grab the second one.
All together now, to the tune of Queen´s We will rock you;
We.... need,
We need,
More Math!
*boom, boom clack*
*boom, boom clack*
We..... need,
We need,
More Math! _________________ Kassen |
|
jamos
Joined: Jun 01, 2004 Posts: 514 Location: Eugene, Oregon, USA
Audio files: 4
G2 patch files: 41
|
Posted: Fri Feb 25, 2005 9:19 am Post subject:
|
|
|
I figured out how to do it; I'll post it as a building block in a few days (I'm on the road now.. love that G2 demo!) |
|