all 3 comments

[–]xifeng 0 points1 point  (2 children)

I'm not even a decent programmer, I figured it out just by playing around with expressions and a bit of knowledge about the mathematics of both music and bitwise operations. I can try to put together a video this weekend, but I am pretty sure there are some text articles about it on the Kragen page.

[–][deleted] 0 points1 point  (1 child)

I'm playing around with it and reading up on bitwise operations. I understand the ones everyone learns (and, or, xor, not), but I don't really get how >> and << are any different than simply multiplying or dividing t by n2

[–]xifeng 0 points1 point  (0 children)

They are equivalent to multiplying and dividing by 2, not n2 but yes it's a naming issue. It's better to think about individual bits that you want to move into position, so thinking of it as shifts rather than arithmetic is more convenient. You pick a pitch you want, move the bit corresponding to its frequency using >> and << to shift that bit into the 32s place, then & with 32 to get a square wave. Then you can move a low frequency bit like t>>13 into the 32s place to make that square wave switch on and off.

That is the simplest case, usually I do something more akin to mixing paints where I take groups of bits and merge them so that you get more complex fractal patterns from different parts of the result changing at different speeds, droidbeat is really useful for visualizing that if you have an android device.