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

lolol sussman theme snake ^__^

Name: Anonymous 2008-04-27 6:58

% ghc sicp.hs && ./a.out > /dev/dsp (or | aplay for real men)
module Main where
import Data.Char
makeU8 x freq = (((sin (x * (2 * pi) * (freq / 8000))) + 1) * 128.0)
tone freq length amplitude x =
  if x >= length
    then []
    else (floor ((makeU8 x freq) * amplitude)) : tone freq length (0.99925 * amplitude) (x + 1)
tones = [("c2", 65.406), ("d2", 73.416), ("e2", 82.407), ("f2", 87.307), ("g2", 97.999), ("a2", 110.00), ("b2", 123.47), ("c3", 130.81), ("d3", 146.83), ("e3", 164.81), ("f3", 174.61), ("g3", 196.00), ("a3", 220.00), ("b3", 246.94), ("c4", 261.63), ("d4", 293.66), ("e4", 329.63), ("f4", 349.23), ("g4", 392.00)]
t x = case lookup x tones of
        Just y -> (tone y 2000 0.75 0) :: [Int]
        Nothing -> []
main = do
  putStr $ map chr $ concatMap t ["g3", "a3", "b3", "d4", "c4", "c4", "e4", "d4", "d4", "g4", "f4", "g4", "d4", "c4", "g3", "a3", "b3", "c4", "d4", "e4", "d4", "c4", "b3", "a3", "b3", "g3", "f3", "g3", "a3", "d3", "f3", "a3", "c4", "b3", "a3", "b3", "g3", "a3", "b3", "d4", "c4", "c4", "e4", "d4", "d4", "g4", "f4", "g4", "d4", "b3", "g3", "a3", "b3", "e3", "d4", "c4"]

Name: Anonymous 2008-04-27 11:42

>>1
[i]ONE WORD THE FORCED INDENTATION OF CODE THREAD OVER

OH MAN PYTHON CODE FUCKING PISSES ME OFF!!![/i]

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