Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Image-based music synthesiser

Name: Anonymous 2009-06-22 16:19

Imagine Brainloller, except instead of outputting characters and maybe doing a sum or two, it outputs noises and controls the attributes of a set number of oscillators. Perhaps different RGB values correspond to different operations and methods; consider logic-based control structures, complex polyphonic multiple-oscillator multiplicative synthesis combined with ENTERPRISE-LEVKidding. and waveform modifiability to boot.

Thoughts, /prog/? Contributive comments? Language? If it's anything other than C I'll be learning that as I go along. Am I reinventing a wheel somewhere?

I haven't read SICP in the last couple of days, and I just thought of this about 20 seconds prior to starting this post.

Name: Anonymous 2009-06-22 21:20

>>12
get a better algorithm.
makeFibs :: (Integer, Integer) -> [Integer]
makeFibs (a, b) = let f@(_:t) = makeFibs (a,b)
                      in a : b : zipWith (+) f t

fibs = makeFibs (0, 1)

twoFibs :: Integer -> (Integer, Integer)
twoFibs 0 = (1, 0)
twoFibs n = let q = shiftR n 1
                r = n .&. 1
                (a, b) = twoFibs q
                x = a * a + b * b
                y = b * (2 * a + b)
                in case r of
                        0 -> (x, y)
                        1 -> (y, x + y)

fib n = let q = shiftR (abs n) 2
            r = n .&. 1
            (a, b) = twoFibs (q + r)
            in case r of
                    0 -> b * (2 * a + b)
                    1 -> a * a + b * b

fibsFrom = makeFibs . twoFibs

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List