Skip to content

Instantly share code, notes, and snippets.

@jahpd
Last active August 5, 2016 23:41
Show Gist options
  • Save jahpd/f7ebcc2c499d7d64576d2192277b73ef to your computer and use it in GitHub Desktop.
Save jahpd/f7ebcc2c499d7d64576d2192277b73ef to your computer and use it in GitHub Desktop.
# A global variable
sound = {}
# Like processing
# we can setup the things
@setup = ->
sound.freq = [Math.random() * 22, 22+Math.random() * 220]
sound.offset = [Math.random(), Math.random()]
# tau ant t are preloaded variables,
# tau is equal to 2 * Math.PI
# t is the current sample in seconds
@dsp = ->
i = 0
for freq in sound.freq
s = perlin1D(sin, freq, sin(freq,0.71), sound.offset[i])
sound.offset[i] += 0.00001
i += 1
s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment