56223
Level 25 Mixist
cce
post #56223 ::
2015.04.15 11:57am :: edit 2015.04.15 12:00pm
Baron Knoxburry and Flaminglog liēkd this
Baron Knoxburry and Flaminglog liēkd this
Making of documentary:
generate single saw
t
two octaves higher
t*3
switch between two octaves
t * (3 + (t >> 12) % 2)
t >> 12 is same as t / (2^12) = t / 4096
move the offset 4 octaves higher
t * (3 + (4 + ((t >> 12) % 2)))
the added offset is multiplied by (t >> 10) to add movement (the magic!)
t * (3 + ((4 + ((t >> 12) % 2)) * (t >> 10)) % 7 )
then we take the remainder with 7, to restrict the values to 0 - 6
the formula is now of the form t * (3 + (a % 7)), where a is the magic
we AND the generated sawtooth wave with 0x80 to produce a square wave at 50% volume
((t * (3 + ((4 + ((t >> 12) % 2)) * (t >> 10)) % 7 )) & 0x80)
add a volume scaling term (0.15 + (((t>>9) % 2))) that multiplies the pulse wave either with 0.15 or 1.15 depending on the scaled timer t >> 9
((t * (3 + ((4 + ((t >> 12) % 2)) * (t >> 10)) % 7 )) & 0x80)* 0.5 * (0.15 + (((t>>9) % 2)))
party!
generate single saw
t
two octaves higher
t*3
switch between two octaves
t * (3 + (t >> 12) % 2)
t >> 12 is same as t / (2^12) = t / 4096
move the offset 4 octaves higher
t * (3 + (4 + ((t >> 12) % 2)))
the added offset is multiplied by (t >> 10) to add movement (the magic!)
t * (3 + ((4 + ((t >> 12) % 2)) * (t >> 10)) % 7 )
then we take the remainder with 7, to restrict the values to 0 - 6
the formula is now of the form t * (3 + (a % 7)), where a is the magic
we AND the generated sawtooth wave with 0x80 to produce a square wave at 50% volume
((t * (3 + ((4 + ((t >> 12) % 2)) * (t >> 10)) % 7 )) & 0x80)
add a volume scaling term (0.15 + (((t>>9) % 2))) that multiplies the pulse wave either with 0.15 or 1.15 depending on the scaled timer t >> 9
((t * (3 + ((4 + ((t >> 12) % 2)) * (t >> 10)) % 7 )) & 0x80)* 0.5 * (0.15 + (((t>>9) % 2)))
party!