Soothing background soundscape

45 views
Skip to first unread message

Toby Gifford

unread,
Nov 4, 2015, 12:01:51 AM11/4/15
to extemp...@googlegroups.com
(bind-func dsp:DSP
  (let ((a:float 1.01)
        (x:float 0.3342)
        (gain:SAMPLE (convert 0.3)))
    (lambda (in:SAMPLE time:i64 channel:i64    data:SAMPLE*)
      (if (< (random) (* 0.00005 (+ 1.0 (random))))
          (set! a (+ 1.00001 (dtof (random)))))
      (set! x (modulo (+ x (pow x a)) 1.0))
      (* gain (convert x)))))

Ben Swift

unread,
Nov 4, 2015, 12:59:20 AM11/4/15
to extemp...@googlegroups.com
Wow. I just fell asleep at my desk - it lulled me to sleep.

Cheers,
Ben

Ben Swift

unread,
Nov 4, 2015, 1:01:48 AM11/4/15
to extemp...@googlegroups.com
Also, you can get rid of some of the explicit type annotations:

(bind-func dsp:DSP
(let ((a 1.01)
(x:SAMPLE 0.3342)
(gain:SAMPLE (convert 0.3)))
(lambda (in:SAMPLE time:i64 channel:i64 data:SAMPLE*)
(if (< (random) (* 0.00005 (+ 1.0 (random))))
(set! a (+ 1.00001 (random))))
(set! x (modulo (+ x (pow x a)) 1.0))
(* gain x))))

Cheers,
Ben

Toby Gifford <toby.g...@gmail.com> writes:

Ben Swift

unread,
Nov 4, 2015, 1:02:12 AM11/4/15
to extemp...@googlegroups.com
Also, nice work :) I may well steal this in the future.

Cheers,
Ben

Toby Gifford <toby.g...@gmail.com> writes:

digego

unread,
Nov 7, 2015, 8:48:34 PM11/7/15
to Extempore, b...@benswift.me
Yeah, definitely needs to be a little more aggressive!

Toby Gifford

unread,
Nov 7, 2015, 8:56:21 PM11/7/15
to extemp...@googlegroups.com
except it only 'works' if a and x are floats (and SAMPLE might be a double?). Don't ask me why.

--
You received this message because you are subscribed to the Google Groups "Extempore" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extemporelan...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Swift

unread,
Nov 7, 2015, 9:46:43 PM11/7/15
to extemp...@googlegroups.com
Yeah, SAMPLE could *in principle* be a double, but there are bunch of
other places in the code base where we assume that it's a float, so if
you try and change SAMPLE to double then the below code not compiling is
gonna be the least of your problems :)

Fair point, though.
Reply all
Reply to author
Forward
0 new messages