Last active
August 29, 2015 14:21
-
-
Save colinbdclark/2899e76db466a8fa1ec5 to your computer and use it in GitHub Desktop.
Granulated sines
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
| var duration = 21 * 60, | |
| fadeOutDuration = 10, | |
| bufferName = "inside-21m-16-48000"; | |
| var leftFadeIn = { | |
| ugen: "flock.ugen.line", | |
| start: 0, | |
| end: 0.05, | |
| duration: 4 | |
| }; | |
| var leftFadeOut = { | |
| ugen: "flock.ugen.line", | |
| start: 0.05, | |
| end: 0, | |
| duration: fadeOutDuration | |
| }; | |
| var rightFadeIn = { | |
| ugen: "flock.ugen.line", | |
| start: 0, | |
| end: 1.0, | |
| duration: 4 | |
| }; | |
| var rightFadeOut = { | |
| ugen: "flock.ugen.line", | |
| start: 1.0, | |
| end: 0, | |
| duration: fadeOutDuration | |
| }; | |
| var synth = flock.synth({ | |
| addToEnvironment: false, | |
| synthDef: { | |
| ugen: "flock.ugen.writeBuffer", | |
| options: { | |
| duration: duration, | |
| numOutputs: 2 | |
| }, | |
| buffer: "inside-21m-16-48000", | |
| sources: [ | |
| { | |
| id: "left", | |
| ugen: "flock.ugen.granulator", | |
| numGrains: { | |
| ugen: "flock.ugen.sequence", | |
| list: [2, 3, 1, 2, 3, 1, 3, 1, 2, 3, 1, 5, 2, 3, 1, 2, 3, 1, 3, 1, 2, 3, 7], | |
| loop: 1.0, | |
| freq: 1/55 | |
| }, | |
| grainDur: 1, | |
| delayDur: 1, | |
| mul: { | |
| ugen: "flock.ugen.lfNoise", | |
| freq: 1/110, | |
| mul: leftFadeIn, | |
| add: leftFadeIn | |
| }, | |
| source: { | |
| ugen: "flock.ugen.sin", | |
| freq: { | |
| ugen: "flock.ugen.sin", | |
| freq: 1/1100, | |
| mul: 110, | |
| add: 110 | |
| } | |
| } | |
| }, | |
| { | |
| id: "right", | |
| ugen: "flock.ugen.granulator", | |
| numGrains: 100, | |
| grainDur: { | |
| ugen: "flock.ugen.change", | |
| time: 92, | |
| initial: 0.5, | |
| target: { | |
| ugen: "flock.ugen.lfNoise", | |
| freq: 1/92, | |
| mul: 2, | |
| add: 2.5, | |
| options: { | |
| interpolation: "linear" | |
| } | |
| }, | |
| crossfade: 2.0 | |
| }, | |
| delayDur: 1, | |
| mul: rightFadeIn, | |
| source: { | |
| ugen: "flock.ugen.sin", | |
| freq: { | |
| ugen: "flock.ugen.sin", | |
| freq: 1/88, | |
| mul: 4, | |
| add: 88 | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| }); | |
| flock.environment.asyncScheduler.once(2, function () { | |
| synth.play(); | |
| }); | |
| flock.environment.asyncScheduler.once(duration, function () { | |
| synth.set({ | |
| "left.mul.mul": leftFadeOut, | |
| "left.mul.add": leftFadeOut, | |
| "right.mul": rightFadeOut | |
| }); | |
| }); | |
| flock.environment.asyncScheduler.once(duration + fadeOutDuration + 2, function () { | |
| flock.environment.stop(); | |
| flock.environment.saveBuffer("inside-21m-16-48000", "int16"); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment