The program shown below, written in Serpent, works with several Soundcool modules to generate a very interesting sound texture. The Soundcool modules consist of a variable speed sample player with five (5) short noise sounds connected to a feedback delay module. The program is a simple loop that runs about 10 times per second. The program uses the function send_afloat to send an OSC message containing one floating point number to a given address. At each iteration, the program chooses randomly to perform any of 8 actions: (1-5) trigger a sample from the sample player, (6) change the delay time, (7) change the delay feedback level, and (8) change the player speed (transpose the apparent pitch of the samples). The time interval between events will approximate a negative exponential distribution, which is perceptually and musically interesting. By changing the SPEED parameter, the density of events increases from a sparse texture with great variety – due to pitch changes and feedback delay changes – to a dense texture that could be compared to granular synthesis.
# osc to soundcool # Roger B. Dannenberg # Feb 2016 print "LOAD samples.soundcool INTO MSpeaker.maxpat!!" def startup() addr = osc_create_address("", "8000", false) def send_afloat(a, x) osc_send_start() osc_add_float(x) display "send", a, x osc_send(addr, a) sounds = ["/4/push1", "/4/push2", "/4/push3", "/4/push4", "/4/push5"] SPEED = 10 def sometimes(p): return random() > (1 - (1 - p) * SPEED) def run() startup() while true for i = 0 to 5: if sometimes(0.99): send_afloat(sounds[i], 1.0) time_sleep(0.01) send_afloat(sounds[i], 0.0) time_sleep(0.01) if sometimes(0.9): send_afloat("/1/fader2", random() * 1000) if sometimes(0.9): send_afloat("/1/fader1", random() * 1) if sometimes(0.95): send_afloat("/4/fader1", random()) time_sleep(0.1) run()