Last active
December 19, 2015 02:48
-
-
Save candera/5885148 to your computer and use it in GitHub Desktop.
A Prismatic Graph for doing sound operations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:i1-channels (plumbing/fnk ^long [] 1) | |
:i1-duration (plumbing/fnk ^double [] 60.0) | |
:i1-amplitude (plumbing/fnk ^double [^double t] (Math/sin (p/* t 440 2.0 Math/PI))) | |
:i2-channels (plumbing/fnk ^long [] 1) | |
:i2-duration (plumbing/fnk ^double [] 60.0) | |
:i2-amplitude (plumbing/fnk [^double t] (let [x (-> t (p/* 440 2.0) long)] | |
(if (even? x) 1.0 -1.0))) | |
:m1-channels (plumbing/fnk ^long [^long i1-channels] i1-channels) | |
:m1-duration (plumbing/fnk ^long [^long i1-duration] i1-duration) | |
:m1-amplitude (plumbing/fnk ^double [^double i1-amplitude] (p/* 0.1 i1-amplitude)) | |
:m2-channels (plumbing/fnk ^long [^long m1-channels] m1-channels) | |
:m2-duration (plumbing/fnk ^double [^long m1-duration] m1-duration) | |
:m2-amplitude (plumbing/fnk ^double [^double m1-amplitude ^double t] (if (p/< t 10.0) | |
(p/* (p/div t 10.0) m1-amplitude) | |
m1-amplitude)) | |
:m3-channels (plumbing/fnk ^long [^long i2-channels] i2-channels) | |
:m3-duration (plumbing/fnk ^double [^double i2-duration] i2-duration) | |
:m3-amplitude (plumbing/fnk ^double [^double t ^double i2-amplitude] (p/* 0.15 i2-amplitude)) | |
:m4-channels (plumbing/fnk ^double [^long m3-channels] m3-channels) | |
:m4-duration (plumbing/fnk ^double [^double m3-duration] m3-duration) | |
:m4-amplitude (plumbing/fnk ^double [^double m3-amplitude ^double m3-duration ^double t] | |
(if (p/< (p/- m3-duration 10.0) t) | |
(p/* (p/div (p/- m3-duration t) 10.0) | |
m3-amplitude) | |
m3-amplitude)) | |
:m5-channels (plumbing/fnk ^long [^long i1-channels] i1-channels) | |
:m5-duration (plumbing/fnk ^double [^double m2-duration ^double m4-duration] (min m4-duration m2-duration)) | |
:m5-amplitude (plumbing/fnk ^double [^double m4-amplitude ^double m2-amplitude] (p/+ m4-amplitude m2-amplitude))} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment