├── .gitattributes
├── .gitignore
├── .jshintrc
├── .npmignore
├── GPL-LICENSE.txt
├── Gruntfile.js
├── MIT-LICENSE.txt
├── README.md
├── build-support
└── js
│ ├── amd-footer.js
│ └── amd-header.js
├── demos
├── audio-file
│ ├── css
│ │ └── audiofile.css
│ └── index.html
├── audio-input
│ ├── index.html
│ └── js
│ │ └── audio-input.js
├── demos.css
├── media-element-input
│ ├── index.html
│ └── js
│ │ └── media-element-input.js
├── playground
│ ├── css
│ │ ├── playground.css
│ │ └── shake.css
│ ├── demos
│ │ ├── .jshintrc
│ │ ├── adsr.js
│ │ ├── am.js
│ │ ├── asr.js
│ │ ├── audio-in-granulated.js
│ │ ├── audio-in.js
│ │ ├── band.js
│ │ ├── bandlimited-impulse.js
│ │ ├── bandpass-filter.js
│ │ ├── bandreject-filter.js
│ │ ├── chop-buffer.js
│ │ ├── custom-envelope.js
│ │ ├── decay.js
│ │ ├── declarative-scheduling.js
│ │ ├── dejong-distortion.js
│ │ ├── delay.js
│ │ ├── dust.js
│ │ ├── fm.js
│ │ ├── for-ann-rising.js
│ │ ├── glissando.js
│ │ ├── granulator.js
│ │ ├── highpass-filter.js
│ │ ├── impulse-pm.js
│ │ ├── impulse.js
│ │ ├── latch.js
│ │ ├── lfNoise.js
│ │ ├── line-fm.js
│ │ ├── line-pm.js
│ │ ├── lowpass-filter.js
│ │ ├── moog.js
│ │ ├── mouse-click.js
│ │ ├── mouse-x.js
│ │ ├── mouse-xy.js
│ │ ├── mouse-y.js
│ │ ├── multiple-synths.js
│ │ ├── noise-fm.js
│ │ ├── pinknoise.js
│ │ ├── play-buffer.js
│ │ ├── playBuffer-trigger.js
│ │ ├── pm.js
│ │ ├── polyphonicSynth.js
│ │ ├── quadraphonic.js
│ │ ├── readBuffer-phasor.js
│ │ ├── readBuffer.js
│ │ ├── sample-accurate-scheduling.js
│ │ ├── saw.js
│ │ ├── scope.js
│ │ ├── sequencer.js
│ │ ├── sine.js
│ │ ├── square.js
│ │ ├── stereo.js
│ │ ├── sum.js
│ │ ├── tanh-distortion.js
│ │ ├── tarrabia-dejong-distortion.js
│ │ ├── tri.js
│ │ ├── trigger-callback.js
│ │ └── whitenoise.js
│ ├── index.html
│ ├── js
│ │ ├── demo-list.js
│ │ ├── demo-selector.js
│ │ ├── error-console.js
│ │ ├── playground.js
│ │ └── source-evaluators.js
│ └── live
│ │ ├── css
│ │ └── live-playground.css
│ │ ├── demos
│ │ ├── adsr.json
│ │ ├── am.json
│ │ ├── asr.json
│ │ ├── audio-in-granulated.json
│ │ ├── audio-in.json
│ │ ├── band.json
│ │ ├── bandlimited-impulse.json
│ │ ├── bandpass-filter.json
│ │ ├── bandreject-filter.json
│ │ ├── chop-buffer.json
│ │ ├── custom-envelope.json
│ │ ├── decay.json
│ │ ├── declarative-scheduling.json
│ │ ├── dejong-distortion.json
│ │ ├── delay.json
│ │ ├── dust.json
│ │ ├── fm.json
│ │ ├── glissando.json
│ │ ├── granulator.json
│ │ ├── highpass-filter.json
│ │ ├── impulse-pm.json
│ │ ├── impulse.json
│ │ ├── latch.json
│ │ ├── lfNoise.json
│ │ ├── line-fm.json
│ │ ├── line-pm.json
│ │ ├── lowpass-filter.json
│ │ ├── moog.json
│ │ ├── mouse-click.json
│ │ ├── mouse-x.json
│ │ ├── mouse-xy.json
│ │ ├── mouse-y.json
│ │ ├── noise-fm.json
│ │ ├── pinknoise.json
│ │ ├── play-buffer.json
│ │ ├── playBuffer-trigger.json
│ │ ├── pm.json
│ │ ├── quadraphonic.json
│ │ ├── readBuffer-phasor.json
│ │ ├── readBuffer.json
│ │ ├── sample-accurate-scheduling.json
│ │ ├── saw.json
│ │ ├── scope.json
│ │ ├── sequencer.json
│ │ ├── sine.json
│ │ ├── square.json
│ │ ├── stereo.json
│ │ ├── tanh-distortion.json
│ │ ├── tarrabia-dejong-distortion.json
│ │ ├── tri.json
│ │ └── whitenoise.json
│ │ ├── index.html
│ │ └── js
│ │ ├── live-demo-list.js
│ │ └── visual-editor.js
└── shared
│ ├── audio
│ ├── hillier-first-chord.wav
│ └── where-the-honey-is.mp3
│ ├── css
│ └── demos.css
│ └── js
│ └── demo-utils.js
├── docs
├── buffers
│ └── about-buffers.md
├── building-flocking.md
├── getting-started.md
├── responding-to-user-input.md
├── scheduling.md
├── synths
│ └── creating-synths.md
└── ugens
│ ├── buffers.md
│ ├── distortions.md
│ ├── mouse.md
│ ├── oscillators.md
│ └── triggers.md
├── favicon.ico
├── flocking-website.css
├── images
├── flocking-tentative-logo.png
├── pause.ai
├── pause.png
├── play.ai
└── play.png
├── index.html
├── package.json
├── src
├── audiofile-encoder.js
├── audiofile.js
├── buffers.js
├── core.js
├── evaluators.js
├── flocking-audiofile-compatibility.js
├── flocking-audiofile-converters.js
├── flocking-audiofile-worker.js
├── gfx.js
├── node-list.js
├── parser.js
├── scheduler.js
├── synths
│ ├── band.js
│ ├── frame-rate.js
│ ├── group.js
│ ├── model.js
│ ├── polyphonic.js
│ ├── synth.js
│ └── value.js
├── testing.js
├── ugens
│ ├── bandlimited.js
│ ├── browser.js
│ ├── buffer.js
│ ├── core.js
│ ├── debugging.js
│ ├── distortion.js
│ ├── dynamics.js
│ ├── envelopes.js
│ ├── filters.js
│ ├── gates.js
│ ├── granular.js
│ ├── listening.js
│ ├── math.js
│ ├── midi.js
│ ├── multichannel.js
│ ├── oscillators.js
│ ├── random.js
│ ├── scheduling.js
│ └── triggers.js
├── ui
│ ├── editor
│ │ ├── css
│ │ │ └── editor.css
│ │ └── js
│ │ │ └── editor.js
│ ├── play-button
│ │ ├── css
│ │ │ └── play-button.css
│ │ └── js
│ │ │ └── play-button.js
│ ├── selectbox
│ │ └── js
│ │ │ └── selectbox.js
│ ├── shared
│ │ ├── css
│ │ │ └── flocking-icon-font.css
│ │ └── fonts
│ │ │ ├── flocking-icon-font.eot
│ │ │ ├── flocking-icon-font.svg
│ │ │ ├── flocking-icon-font.ttf
│ │ │ └── flocking-icon-font.woff
│ └── third-party
│ │ └── normalize
│ │ └── css
│ │ └── normalize.css
└── web
│ ├── audio-system.js
│ ├── buffer-writer.js
│ ├── input-device-manager.js
│ ├── native-node-manager.js
│ ├── output-manager.js
│ └── webaudio-core.js
├── tests
├── manual
│ └── aiff-playback-11Khz
│ │ ├── README.md
│ │ ├── hockey.aiff
│ │ ├── hockey.wav
│ │ └── index.html
├── performance
│ ├── css
│ │ └── benchmarks.css
│ ├── html
│ │ ├── audiofile-benchmarks.html
│ │ ├── standalone-ugen-benchmarks.html
│ │ └── synth-benchmarks.html
│ └── js
│ │ ├── audiofile-benchmarks.js
│ │ ├── standalone-ugen-benchmarks.js
│ │ └── synth-benchmarks.js
├── shared
│ ├── audio
│ │ ├── long-triangle-int16-44100.wav
│ │ ├── long-triangle-int16-48000.wav
│ │ ├── long-triangle-int16-88200.wav
│ │ └── long-triangle-int16-96000.wav
│ └── js
│ │ └── audiofile-dataurls.js
└── unit
│ ├── all-tests.html
│ ├── html
│ ├── audiofile-decoder-tests.html
│ ├── audiofile-tests.html
│ ├── band-tests.html
│ ├── bandlimited-ugen-tests.html
│ ├── buffer-tests.html
│ ├── buffer-ugen-tests.html
│ ├── bus-tests.html
│ ├── core-tests.html
│ ├── core-utilities-tests.html
│ ├── dynamics-ugen-tests.html
│ ├── envelope-ugen-tests.html
│ ├── envgen-ugen-tests.html
│ ├── filter-ugen-tests.html
│ ├── gate-ugen-tests.html
│ ├── ioc-integration-tests.html
│ ├── listening-ugen-tests.html
│ ├── math-ugen-tests.html
│ ├── midi-ugen-tests.html
│ ├── model-synth-tests.html
│ ├── multichannel-ugen-tests.html
│ ├── nodelist-tests.html
│ ├── osc-ugen-tests.html
│ ├── parser-tests.html
│ ├── perf-tests.html
│ ├── phasor-ugen-tests.html
│ ├── playbuffer-ugen-tests.html
│ ├── random-ugen-tests.html
│ ├── require-tests.html
│ ├── scheduler-tests.html
│ ├── scheduler-timing-tests.html
│ ├── scheduling-ugen-tests.html
│ ├── synth-environment-tests.html
│ ├── synth-evaluation-tests.html
│ ├── synth-group-tests.html
│ ├── synth-instantiation-tests.html
│ ├── synth-note-target-tests.html
│ ├── synth-removal-tests.html
│ ├── synth-scheduled-tests.html
│ ├── synth-tests.html
│ ├── test-utils-tests.html
│ ├── trigger-ugen-tests.html
│ ├── ugen-tests.html
│ ├── webaudio-tests.html
│ └── writebuffer-ugen-tests.html
│ ├── js
│ ├── audiofile-decoder-tests.js
│ ├── audiofile-test-utils.js
│ ├── audiofile-tests.js
│ ├── band-tests.js
│ ├── bandlimited-ugen-tests.js
│ ├── buffer-tests.js
│ ├── buffer-ugen-tests.js
│ ├── bus-tests.js
│ ├── core-tests.js
│ ├── core-utilities-tests.js
│ ├── dynamics-ugen-tests.js
│ ├── envelope-ugen-tests.js
│ ├── envgen-ugen-tests.js
│ ├── filter-ugen-tests.js
│ ├── flocking-test-utils.js
│ ├── gate-ugen-tests.js
│ ├── ioc-integration-tests.js
│ ├── listening-ugen-tests.js
│ ├── math-ugen-tests.js
│ ├── midi-ugen-tests.js
│ ├── model-synth-tests.js
│ ├── multichannel-ugen-tests.js
│ ├── nodelist-tests.js
│ ├── osc-ugen-tests.js
│ ├── parser-tests.js
│ ├── perf-tests.js
│ ├── phasor-ugen-tests.js
│ ├── playbuffer-ugen-tests.js
│ ├── random-ugen-tests.js
│ ├── require-tests.js
│ ├── scheduler-tests.js
│ ├── scheduler-timing-tests.js
│ ├── scheduling-ugen-tests.js
│ ├── synth-environment-tests.js
│ ├── synth-evaluation-tests.js
│ ├── synth-group-tests.js
│ ├── synth-instantiation-tests.js
│ ├── synth-note-target-tests.js
│ ├── synth-removal-tests.js
│ ├── synth-scheduled-tests.js
│ ├── synth-tests.js
│ ├── test-utils-tests.js
│ ├── trigger-ugen-tests.js
│ ├── ugen-tests.js
│ ├── webaudio-tests.js
│ └── writebuffer-ugen-tests.js
│ └── testem.json
└── third-party
├── simjs
└── js
│ └── random-0.26.js
└── webarraymath
└── js
└── webarraymath.js
/.gitattributes:
--------------------------------------------------------------------------------
1 | dist/*.js binary
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
3 | /.vagrant/
4 | package-lock.json
5 | yarn.lock
6 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "white": false,
3 | "newcap": true,
4 | "regexp": true,
5 | "browser": true,
6 | "forin": false,
7 | "nomen": true,
8 | "bitwise": false,
9 | "maxerr": 100,
10 | "indent": 4,
11 | "plusplus": false,
12 | "curly": true,
13 | "eqeqeq": true,
14 | "freeze": true,
15 | "latedef": true,
16 | "noarg": true,
17 | "nonew": true,
18 | "quotmark": "double",
19 | "undef": true,
20 | "unused": true,
21 | "strict": true,
22 | "asi": false,
23 | "boss": false,
24 | "evil": false,
25 | "expr": false,
26 | "funcscope": false
27 | }
28 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | /tests
2 |
--------------------------------------------------------------------------------
/MIT-LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011-2016 Colin Clark
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/build-support/js/amd-footer.js:
--------------------------------------------------------------------------------
1 |
2 | window.fluid = fluid;
3 |
4 | return flock;
5 | }));
6 |
--------------------------------------------------------------------------------
/build-support/js/amd-header.js:
--------------------------------------------------------------------------------
1 | (function (root, factory) {
2 | if (typeof exports === "object") {
3 | // We're in a CommonJS-style loader.
4 | root.flock = exports; // Always create the "flock" global.
5 | factory(exports, require("jquery"));
6 | } else if (typeof define === "function" && define.amd) {
7 | // We're in an AMD-style loader.
8 | define(["exports", "jquery"], function (exports, jQuery) {
9 | root.flock = exports; // Always create the "flock" global.
10 | return (root.flock, factory(exports, jQuery));
11 | });
12 | } else {
13 | // Plain old browser.
14 | root.flock = {};
15 | factory(root.flock, jQuery);
16 | }
17 | }(this, function (exports, jQuery) {
18 | // To hell with isolationism.
19 | window.jQuery = jQuery;
20 |
--------------------------------------------------------------------------------
/demos/audio-file/css/audiofile.css:
--------------------------------------------------------------------------------
1 | @import url(https://fonts.googleapis.com/css?family=Nunito);
2 | body {
3 | margin-left: 2%;
4 | }
5 |
6 | .view {
7 | clear: both;
8 | }
9 |
10 | .selectors,#waveform {
11 | border: solid #888 5px;
12 | border-radius: 25px;
13 | }
14 |
15 | .selectors {
16 | margin-bottom: 1.5%;
17 | float: left;
18 | padding: 2%;
19 | width: 40%;
20 | }
21 |
22 | .dataUrlSelector {
23 | margin-top: 5%;
24 | }
25 |
26 | .dataUrlSelector label {
27 | float: left;
28 | margin-right: 2%;
29 | margin-top: 7%;
30 | }
31 |
32 | #dataUrlField {
33 | width:50%;
34 | height: 100px;
35 | }
36 |
37 | .speedSelector {
38 | padding-top: 1%;
39 | }
40 |
41 | .speedSelector label {
42 | padding-right: 1%;
43 | }
44 |
--------------------------------------------------------------------------------
/demos/audio-input/js/audio-input.js:
--------------------------------------------------------------------------------
1 | /*global fluid*/
2 | (function () {
3 | "use strict";
4 |
5 | fluid.defaults("flock.demo.audioInSynth", {
6 | gradeNames: "flock.synth",
7 |
8 | synthDef: {
9 | ugen: "flock.ugen.audioIn",
10 | mul: {
11 | ugen: "flock.ugen.sinOsc",
12 | freq: {
13 | ugen: "flock.ugen.mouse.cursor",
14 | add: 60,
15 | mul: 960
16 | },
17 | mul: {
18 | ugen: "flock.ugen.mouse.cursor",
19 | add: 0.1,
20 | mul: 0.9,
21 | options: {
22 | axis: "y"
23 | }
24 | }
25 | }
26 | }
27 | });
28 |
29 | fluid.defaults("flock.demo.audioIn", {
30 | gradeNames: "fluid.component",
31 |
32 | components: {
33 | synth: {
34 | type: "flock.demo.audioInSynth"
35 | },
36 |
37 | playButton: {
38 | type: "flock.ui.enviroPlayButton",
39 | container: "#play"
40 | }
41 | }
42 | });
43 | }());
44 |
--------------------------------------------------------------------------------
/demos/demos.css:
--------------------------------------------------------------------------------
1 | body {
2 | width: 50%;
3 | margin-left: 2%;
4 | }
5 |
6 | h1, h2 {
7 | font-family: sans-serif;
8 | margin-top: 9%;
9 | }
10 |
11 | h2 {
12 | margin-bottom: 5%;
13 | }
14 |
15 | .button-list {
16 | text-align: left;
17 | list-style: none;
18 | padding: 0;
19 | width: 55%;
20 | }
21 |
22 | .button-list li {
23 | display: block;
24 | margin-bottom: 3%;
25 | }
26 |
27 | .button-list li a {
28 | font-size: 125%;
29 | font-family: sans-serif;
30 | text-decoration: none;
31 | font-weight: bold;
32 | background-color: #eee;
33 | display: block;
34 | width: 100%;
35 | border-radius: 10px 10px 10px 10px;
36 | padding: 7%;
37 | }
38 |
39 | .button-list li:nth-child(2n) a {
40 | background-color: #ccc;
41 | }
42 |
43 | .button-list li a:hover {
44 | background-color: #999;
45 | border-color: #aaa;
46 | color: #fff;
47 | }
48 |
49 | a {
50 | color: #333;
51 | }
52 |
53 | a:visited {
54 | color: #555;
55 | text-decoration: none;
56 | }
57 |
58 | a:hover {
59 | color: #fff;
60 | text-decoration: none;
61 | }
62 |
63 | a:active {
64 | color: #ccc;
65 | text-decoration: none;
66 | }
67 |
--------------------------------------------------------------------------------
/demos/playground/css/playground.css:
--------------------------------------------------------------------------------
1 | *,
2 | *:before,
3 | *:after {
4 | -moz-box-sizing: border-box;
5 | -webkit-box-sizing: border-box;
6 | box-sizing: border-box;
7 | }
8 | html, body, .everything {
9 | height: 100%;
10 | font-family: sans-serif;
11 | }
12 |
13 | select {
14 | font-family: "Lucida Grande";
15 | font-size: 0.8em;
16 | }
17 |
18 | label {
19 | font-weight: bold;
20 | font-size: 0.8em;
21 | }
22 |
23 | .everything {
24 | width: 100%;
25 | height: 100%;
26 | background-color: #272822;
27 | }
28 |
29 | .toolbar {
30 | background-color: #ddd;
31 | padding: 0.5em;
32 | }
33 |
34 | /* Clearfix. Get this from somewhere else or factor into a utility. */
35 | .toolbar:after {
36 | content: " ";
37 | display: table;
38 | clear: both;
39 | }
40 |
41 | .toolbar .left {
42 | float: left;
43 | padding-top: 0.4em;
44 | }
45 |
46 | .toolbar .right {
47 | float: right;
48 | }
49 |
50 | .synthSelector {
51 | float: left;
52 | margin-top: 0.45em;
53 | }
54 |
55 | #gfx {
56 | float: right;
57 | padding-right: 1em;
58 | padding-top: 0.25em;
59 | background-color: #ddd;
60 | border-radius: 1em;
61 | }
62 |
63 | .mainPanel {
64 | height: 100%;
65 | width: 100%;
66 | padding-top: 3.1em;
67 | background-color: #272822;
68 | }
69 |
70 | #source-view {
71 | font-size: 12pt;
72 | float: left;
73 | border-right: 1px dotted #aaa;
74 | }
75 |
76 | .CodeMirror {
77 | height: 95%;
78 | border-bottom: 1px solid #aaa;
79 | }
80 |
81 | .CodeMirror-scroll {
82 | overflow: auto;
83 | }
84 |
85 | .masthead {
86 | background-color: #aaa;
87 | padding: 0.5em;
88 | position: fixed;
89 | top: 0;
90 | width: 100%;
91 | z-index: 100;
92 | }
93 |
94 | .console {
95 | color: #f77;
96 | background-color: #272822;
97 | padding: 0.5%;
98 | width: 100%;
99 | position: fixed;
100 | bottom: 0px;
101 | font-family: "Lucida Console", monospace;
102 | font-size: 0.75em;
103 | }
104 |
--------------------------------------------------------------------------------
/demos/playground/demos/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "white": false,
3 | "newcap": true,
4 | "regexp": true,
5 | "browser": true,
6 | "forin": false,
7 | "nomen": true,
8 | "bitwise": false,
9 | "maxerr": 100,
10 | "indent": 4,
11 | "plusplus": false,
12 | "curly": true,
13 | "eqeqeq": true,
14 | "freeze": true,
15 | "latedef": true,
16 | "noarg": true,
17 | "nonew": true,
18 | "quotmark": "double",
19 | "undef": true,
20 | "unused": true,
21 | "asi": false,
22 | "boss": false,
23 | "evil": false,
24 | "expr": false,
25 | "funcscope": false,
26 | "predef": ["flock", "fluid", "$"]
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/demos/playground/demos/am.js:
--------------------------------------------------------------------------------
1 | // Creates a new synth with a sine wave that is
2 | // slowly being amplitude moduled by another sine wave.
3 |
4 | flock.synth({
5 | synthDef: {
6 | id: "carrier",
7 | ugen: "flock.ugen.sinOsc",
8 | freq: 440,
9 | mul: {
10 | id: "mod",
11 | ugen: "flock.ugen.sinOsc",
12 | freq: 1.0,
13 | mul: 0.25
14 | }
15 | }
16 | });
17 |
--------------------------------------------------------------------------------
/demos/playground/demos/asr.js:
--------------------------------------------------------------------------------
1 | // Sine tone shaped by a simple attack/sustain/release envelope and periodically triggered.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.sinOsc",
6 | freq: 440,
7 | mul: {
8 | ugen: "flock.ugen.asr",
9 | start: 0.0,
10 | attack: 0.25,
11 | sustain: 0.25,
12 | release: 1.0,
13 | gate: {
14 | ugen: "flock.ugen.impulse",
15 | rate: "control",
16 | freq: 0.75,
17 | phase: 1.0
18 | }
19 | }
20 | }
21 | });
22 |
--------------------------------------------------------------------------------
/demos/playground/demos/audio-in-granulated.js:
--------------------------------------------------------------------------------
1 | // Granulates live audio from the microphone.
2 | // Wear headphones to prevent feedback.
3 |
4 | flock.synth({
5 | synthDef: {
6 | ugen: "flock.ugen.granulator",
7 | delayDur: 0.25,
8 | numGrains: {
9 | ugen: "flock.ugen.lfNoise",
10 | freq: 0.5,
11 | mul: 75,
12 | add: 75,
13 | options: {
14 | interpolation: "linear"
15 | }
16 | },
17 | source: {
18 | ugen: "flock.ugen.audioIn"
19 | }
20 | }
21 | });
22 |
--------------------------------------------------------------------------------
/demos/playground/demos/audio-in.js:
--------------------------------------------------------------------------------
1 | // Plays back live audio from the microphone.
2 | // Wear headphones to prevent feedback.
3 |
4 | flock.synth({
5 | synthDef: {
6 | ugen: "flock.ugen.audioIn"
7 | }
8 | });
9 |
--------------------------------------------------------------------------------
/demos/playground/demos/band.js:
--------------------------------------------------------------------------------
1 | fluid.defaults("flock.demo.sequencedSine", {
2 | gradeNames: ["flock.synth"],
3 | synthDef: {
4 | ugen: "flock.ugen.out",
5 | expand: 1,
6 | sources: {
7 | ugen: "flock.ugen.sinOsc",
8 | freq: {
9 | ugen: "flock.ugen.sequence",
10 | loop: 1
11 | },
12 | mul: 0.5
13 | }
14 | }
15 | });
16 |
17 | flock.band({
18 | components: {
19 | left: {
20 | type: "flock.demo.sequencedSine",
21 | options: {
22 | synthDef: {
23 | bus: 0,
24 | sources: {
25 | freq: {
26 | values: [1, 4/3, 5/4],
27 | freq: 3,
28 | mul: 440
29 | }
30 | }
31 | }
32 | }
33 | },
34 |
35 | right: {
36 | type: "flock.demo.sequencedSine",
37 | options: {
38 | synthDef: {
39 | bus: 1,
40 | sources: {
41 | freq: {
42 | values: [1, 3/2],
43 | freq: 2,
44 | mul: 220
45 | }
46 | }
47 | }
48 | }
49 | }
50 | }
51 | });
52 |
--------------------------------------------------------------------------------
/demos/playground/demos/bandlimited-impulse.js:
--------------------------------------------------------------------------------
1 | flock.synth({
2 | synthDef: [
3 | // The left channel aliases alias at high frequencies (you'll hear it wobble).
4 | {
5 | ugen: "flock.ugen.impulse",
6 | freq: {
7 | ugen: "flock.ugen.xLine",
8 | start: 10000,
9 | end: 20,
10 | duration: 10
11 | },
12 | mul: 0.5
13 | },
14 | // The right channel is bandlimited, so it does not alias.
15 | {
16 | ugen: "flock.ugen.blit",
17 | freq: {
18 | ugen: "flock.ugen.xLine",
19 | start: 10000,
20 | end: 20,
21 | duration: 10
22 | },
23 | mul: 0.5
24 | }
25 | ]
26 | });
27 |
--------------------------------------------------------------------------------
/demos/playground/demos/bandpass-filter.js:
--------------------------------------------------------------------------------
1 | flock.synth({
2 | synthDef: {
3 | ugen: "flock.ugen.filter.biquad.bp",
4 | freq: {
5 | ugen: "flock.ugen.mouse.cursor",
6 | options: {
7 | interpolation: "exponential"
8 | },
9 | mul: 10000,
10 | add: 100,
11 | lag: 1
12 | },
13 | q: 3.0,
14 | source: {
15 | ugen: "flock.ugen.lfSaw",
16 | freq: 200,
17 | mul: 0.1
18 | }
19 | }
20 | });
21 |
--------------------------------------------------------------------------------
/demos/playground/demos/bandreject-filter.js:
--------------------------------------------------------------------------------
1 | flock.synth({
2 | synthDef: {
3 | ugen: "flock.ugen.filter.biquad.br",
4 | freq: {
5 | ugen: "flock.ugen.mouse.cursor",
6 | options: {
7 | interpolation: "exponential"
8 | },
9 | mul: 10000,
10 | add: 100,
11 | lag: 1
12 | },
13 | q: 3.0,
14 | source: {
15 | ugen: "flock.ugen.lfSaw",
16 | freq: 200,
17 | mul: 0.1
18 | }
19 | }
20 | });
21 |
--------------------------------------------------------------------------------
/demos/playground/demos/chop-buffer.js:
--------------------------------------------------------------------------------
1 | // Move the mouse horizontally in the browser window to control
2 | // the amount that the buffer is chopped.
3 | flock.synth({
4 | synthDef: {
5 | id: "chopper",
6 | ugen: "flock.ugen.chopBuffer",
7 | start: 0.1,
8 | amount: {
9 | ugen: "flock.ugen.triOsc",
10 | rate: "control",
11 | freq: 1/30,
12 | mul: 0.5,
13 | add: 0.5
14 | },
15 | speed: {
16 | ugen: "flock.ugen.lfNoise",
17 | rate: "audio",
18 | options: {
19 | interpolation: "linear"
20 | },
21 | freq: 1/5,
22 | mul: 0.5,
23 | add: 0.5
24 | },
25 | minDuration: {
26 | ugen: "flock.ugen.lfNoise",
27 | freq: 1/5,
28 | mul: 0.5,
29 | add: 0.001
30 | },
31 | gap: -0.001,
32 | buffer: {
33 | url: "../shared/audio/where-the-honey-is.mp3"
34 | },
35 |
36 | mul: 0.1,
37 |
38 | options: {
39 | maxVoices: 10
40 | }
41 | }
42 | });
43 |
--------------------------------------------------------------------------------
/demos/playground/demos/custom-envelope.js:
--------------------------------------------------------------------------------
1 | var customEnvelope = {
2 | levels: [0, 1, 0.4, 1.0, 0.6, 0],
3 | times: [0.5, 0.3, 0.5, 0.3, 0.5],
4 | curve: ["sin", "exponential", "linear", "welsh", 3]
5 | };
6 |
7 | var gateDef = {
8 | ugen: "flock.ugen.lfPulse",
9 | rate: "control",
10 | freq: 0.39,
11 | width: 0.5
12 | };
13 |
14 | flock.synth({
15 | synthDef: {
16 | ugen: "flock.ugen.sinOsc",
17 | freq: 270,
18 | phase: {
19 | ugen: "flock.ugen.sinOsc",
20 | freq: {
21 | ugen: "flock.ugen.envGen",
22 | rate: "control",
23 | envelope: customEnvelope,
24 | mul: 473,
25 | gate: gateDef
26 | }
27 | },
28 | mul: {
29 | ugen: "flock.ugen.envGen",
30 | rate: "control",
31 | envelope: customEnvelope,
32 | mul: 0.5,
33 | gate: gateDef
34 | }
35 | }
36 | });
37 |
--------------------------------------------------------------------------------
/demos/playground/demos/decay.js:
--------------------------------------------------------------------------------
1 | // The decay unit generator enveloping white noise,
2 | // creating percussive sounds.
3 |
4 | flock.synth({
5 | synthDef: {
6 | ugen: "flock.ugen.decay",
7 | source: {
8 | ugen: "flock.ugen.impulse",
9 | rate: "audio",
10 | freq: {
11 | ugen: "flock.ugen.xLine",
12 | rate: "control",
13 | start: 1,
14 | end: 50,
15 | duration: 20
16 | },
17 | phase: 0.25,
18 | mul: 0.25
19 | },
20 | time: 0.2,
21 | mul: {
22 | ugen: "flock.ugen.whiteNoise"
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/demos/playground/demos/declarative-scheduling.js:
--------------------------------------------------------------------------------
1 | // Schedules an increase in frequency every second.
2 | flock.band({
3 | components: {
4 | sinSynth: {
5 | type: "flock.synth",
6 | options: {
7 | synthDef: {
8 | id: "carrier",
9 | ugen: "flock.ugen.sinOsc",
10 | freq: 220,
11 | mul: {
12 | ugen: "flock.ugen.line",
13 | start: 0,
14 | end: 0.25,
15 | duration: 1.0
16 | }
17 | }
18 | }
19 | },
20 |
21 | scheduler: {
22 | type: "flock.scheduler.async",
23 | options: {
24 | components: {
25 | synthContext: "{sinSynth}"
26 | },
27 |
28 | score: [
29 | {
30 | interval: "repeat",
31 | time: 1.0,
32 | change: {
33 | values: {
34 | "carrier.freq": {
35 | synthDef: {
36 | ugen: "flock.ugen.sequence",
37 | values: [330, 440, 550, 660, 880, 990, 1100, 1210]
38 | }
39 | }
40 | }
41 | }
42 | },
43 |
44 | {
45 | interval: "once",
46 | time: 8,
47 | change: {
48 | values: {
49 | "carrier.mul.start": 0.25,
50 | "carrier.mul.end": 0.0,
51 | "carrier.mul.duration": 1.0
52 | }
53 | }
54 | }
55 | ]
56 | }
57 | }
58 | }
59 | });
60 |
--------------------------------------------------------------------------------
/demos/playground/demos/dejong-distortion.js:
--------------------------------------------------------------------------------
1 | flock.synth({
2 | synthDef: {
3 | ugen: "flock.ugen.distortion.deJong",
4 | amount: {
5 | ugen: "flock.ugen.sin",
6 | mul: 99,
7 | add: 100,
8 | freq: 0.1
9 | },
10 | source: {
11 | ugen: "flock.ugen.sawOsc",
12 | freq: 45,
13 | mul: 0.01
14 | }
15 | }
16 | });
17 |
--------------------------------------------------------------------------------
/demos/playground/demos/delay.js:
--------------------------------------------------------------------------------
1 | // Use Dust to trigger the Delay unit generator
2 | // as an envelope for a Decaying WhiteNoise source
3 |
4 | flock.synth({
5 | synthDef: {
6 | ugen: "flock.ugen.delay",
7 | source: {
8 | ugen: "flock.ugen.decay",
9 | source: {
10 | ugen: "flock.ugen.dust",
11 | density: 1.0,
12 | mul: 0.5
13 | },
14 | time: 0.3,
15 | mul: {
16 | ugen: "flock.ugen.whiteNoise"
17 | }
18 | },
19 | maxTime: 1.0,
20 | time: 0.2,
21 | add: {
22 | ugen: "flock.ugen.decay",
23 | source: {
24 | ugen: "flock.ugen.dust",
25 | density: 1.0,
26 | mul: 0.5
27 | },
28 | time: 0.3,
29 | mul: {
30 | ugen: "flock.ugen.whiteNoise"
31 | }
32 | }
33 | }
34 | });
35 |
--------------------------------------------------------------------------------
/demos/playground/demos/dust.js:
--------------------------------------------------------------------------------
1 | // Using dust to generate random audio noise.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.dust",
6 | density: 200,
7 | mul: 0.25
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/demos/playground/demos/fm.js:
--------------------------------------------------------------------------------
1 | flock.synth({
2 | synthDef: {
3 | ugen: "flock.ugen.sin",
4 | freq: {
5 | ugen: "flock.ugen.value",
6 | rate: "audio",
7 | value: 400,
8 | add: {
9 | ugen: "flock.ugen.sin",
10 | freq: {
11 | ugen: "flock.ugen.mouse.cursor",
12 | mul: 124,
13 | add: 62,
14 | },
15 | mul: {
16 | ugen: "flock.ugen.mouse.cursor",
17 | mul: 100,
18 | add: 100,
19 | options: {
20 | axis: "y"
21 | }
22 | }
23 | }
24 | },
25 | mul: 0.3
26 | }
27 | });
28 |
--------------------------------------------------------------------------------
/demos/playground/demos/for-ann-rising.js:
--------------------------------------------------------------------------------
1 | // James Tenney's For Ann Rising.
2 |
3 | var sked = flock.environment.asyncScheduler,
4 | numSynths = 240,
5 | synths = [],
6 | nextSynthIdx = 0,
7 | synthToRemoveIdx = 0;
8 |
9 | var forAnnSynthDef = {
10 | ugen: "flock.ugen.sinOsc",
11 | freq: {
12 | ugen: "flock.ugen.envGen",
13 | envelope: {
14 | levels: [40, 10240],
15 | times: [33.6],
16 | curve: "exponential"
17 | },
18 | gate: 1.0
19 | },
20 | mul: {
21 | ugen: "flock.ugen.envGen",
22 | envelope: {
23 | type: "flock.envelope.linear",
24 | attack: 8.4,
25 | sustain: 16.8,
26 | release: 8.4
27 | },
28 | gate: 1.0,
29 | mul: 0.1
30 | }
31 | };
32 |
33 | // To save cycles during performance,
34 | // create all the voices ahead of time.
35 | for (var i = 0; i < numSynths; i++) {
36 | var synth = flock.synth({
37 | synthDef: forAnnSynthDef,
38 | addToEnvironment: false
39 | });
40 |
41 | synths[i] = synth;
42 | }
43 |
44 | // Use the scheduler to start a new synth playing
45 | // every 2.8 seconds.
46 | var adder = sked.repeat(2.8, function () {
47 | var synth = synths[nextSynthIdx];
48 | synth.addToEnvironment("tail");
49 |
50 | nextSynthIdx++;
51 | if (nextSynthIdx >= numSynths) {
52 | sked.clear(adder);
53 | }
54 | });
55 |
56 | // Remove each synth after its envelope has reached its target.
57 | // (Flocking doesn't yet have "done actions" like in SuperCollider).
58 | sked.repeat(34, function () {
59 | var synth = synths[synthToRemoveIdx];
60 |
61 | // Destroying a synth will remove it from the environment as well,
62 | // but means that it can't be reused later.
63 | synth.destroy();
64 |
65 | synthToRemoveIdx++;
66 | if (synthToRemoveIdx >= numSynths) {
67 | sked.clearAll();
68 | }
69 | });
70 |
--------------------------------------------------------------------------------
/demos/playground/demos/glissando.js:
--------------------------------------------------------------------------------
1 | // An descending glissando using a line ugen.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.sinOsc",
6 | freq: {
7 | ugen: "flock.ugen.xLine",
8 | rate: "control",
9 | duration: 1.0,
10 | start: 2000,
11 | end: 200
12 | },
13 | mul: 0.25
14 | }
15 | });
16 |
--------------------------------------------------------------------------------
/demos/playground/demos/granulator.js:
--------------------------------------------------------------------------------
1 | // Granulates a filtered sawtooth wave.
2 | // Demo by Mayank Sanganeria and Adam Tindale.
3 |
4 | flock.synth({
5 | synthDef: {
6 | ugen: "flock.ugen.granulator",
7 | numGrains: {
8 | ugen: "flock.ugen.line",
9 | start: 1,
10 | end: 40,
11 | duration: 20
12 | },
13 | grainDur: {
14 | ugen: "flock.ugen.line",
15 | start: 0.1,
16 | end: 0.005,
17 | duration: 100
18 | },
19 | delayDur: 8,
20 | mul: 0.5,
21 | source: {
22 | ugen: "flock.ugen.filter.biquad.lp",
23 | freq: {
24 | ugen: "flock.ugen.sin",
25 | rate: "control",
26 | freq: {
27 | ugen: "flock.ugen.xLine",
28 | rate: "control",
29 | start: 0.7,
30 | end: 3000,
31 | duration: 60
32 | },
33 | phase: 0,
34 | mul: 2000,
35 | add: 4000
36 | },
37 | source: {
38 | ugen: "flock.ugen.lfSaw",
39 | freq: {
40 | ugen: "flock.ugen.sin",
41 | freq: 0.1,
42 | mul: 1000,
43 | add: 3000,
44 | },
45 | mul: 0.25
46 | }
47 | }
48 | }
49 | });
50 |
--------------------------------------------------------------------------------
/demos/playground/demos/highpass-filter.js:
--------------------------------------------------------------------------------
1 | flock.synth({
2 | synthDef: {
3 | ugen: "flock.ugen.filter.biquad.hp",
4 | freq: {
5 | ugen: "flock.ugen.sin",
6 | rate: "control",
7 | freq: {
8 | ugen: "flock.ugen.xLine",
9 | rate: "control",
10 | start: 0.7,
11 | end: 300,
12 | duration: 20
13 | },
14 | phase: 0,
15 | mul: 3600,
16 | add: 4000
17 | },
18 | source: {
19 | ugen: "flock.ugen.lfSaw",
20 | freq: 200,
21 | mul: 0.1
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/demos/playground/demos/impulse-pm.js:
--------------------------------------------------------------------------------
1 | // A stereo pair of Impulses, one being phase modulated with the mouse cursor.
2 |
3 | flock.synth({
4 | synthDef: [
5 | {
6 | ugen: "flock.ugen.impulse",
7 | freq: 4,
8 | mul: 0.3,
9 | phase: 0
10 | },
11 | {
12 | ugen: "flock.ugen.impulse",
13 | freq: 4,
14 | mul: 0.3,
15 | phase: {
16 | ugen: "flock.ugen.mouse.cursor"
17 | }
18 | }
19 | ]
20 | });
21 |
--------------------------------------------------------------------------------
/demos/playground/demos/impulse.js:
--------------------------------------------------------------------------------
1 | // The impulse ugen's frequency controlled by a descending xLine.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.impulse",
6 | freq: {
7 | ugen: "flock.ugen.xLine",
8 | start: 880,
9 | end: 2,
10 | duration: 3.0
11 | },
12 | mul: 0.25
13 | }
14 | });
15 |
--------------------------------------------------------------------------------
/demos/playground/demos/latch.js:
--------------------------------------------------------------------------------
1 | /*
2 | David Michael Cottle's first Latch example from http://rhoadley.net/courses/tech_resources/supercollider/tutorials/cottle/CMSC7105.pdf
3 |
4 | "The patterns that emerge are more varied than a single sequence,
5 | but more cohesive than an LFNoise control.
6 | Try the example below and listen for the shape of the Saw wave in the frequencies.
7 | In this patch I change the frequency of the wave being sampled.
8 | I use a MouseX.kr to control the frequency of the sampled LFSaw.
9 | It begins at 0.1, or once every ten seconds and then moves to 20.
10 | When the mouse is at the left of the screen you should hear the shape
11 | of the wave in the resulting frequency control.
12 | As you move to the right, you are essentially shortening the sampled wave
13 | in relation to the sample rate, and the smooth ramp will begin to disappear,
14 | but there will always be a pattern" (Cottle 168).
15 | */
16 |
17 | flock.synth({
18 | synthDef: {
19 | ugen: "flock.ugen.sin",
20 | mul: 0.3,
21 | freq: {
22 | ugen: "flock.ugen.latch",
23 | rate: "control",
24 | source: {
25 | ugen: "flock.ugen.lfSaw",
26 | freq: {
27 | ugen: "flock.ugen.mouse.cursor",
28 | rate: "control",
29 | mul: 18.9,
30 | add: 1.1
31 | },
32 | mul: 500,
33 | add: 600
34 | },
35 | trigger: {
36 | ugen: "flock.ugen.impulse",
37 | rate: "control",
38 | freq: 10
39 | }
40 | }
41 | }
42 | });
43 |
--------------------------------------------------------------------------------
/demos/playground/demos/lfNoise.js:
--------------------------------------------------------------------------------
1 | // Random audio noise with lfNoise.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.lfNoise",
6 | freq: 1000,
7 | mul: 0.25
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/demos/playground/demos/line-fm.js:
--------------------------------------------------------------------------------
1 | // Frequency modulation controlled by an exponential line.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.sinOsc",
6 | freq: {
7 | ugen: "flock.ugen.sinOsc",
8 | freq: {
9 | ugen: "flock.ugen.xLine",
10 | rate: "control",
11 | start: 1,
12 | end: 1000,
13 | duration: 9
14 | },
15 | mul: 200,
16 | add: 800
17 | },
18 | mul: 0.25
19 | }
20 | });
21 |
--------------------------------------------------------------------------------
/demos/playground/demos/line-pm.js:
--------------------------------------------------------------------------------
1 | // Line modulating the phase of a sine oscillator.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.sinOsc",
6 | freq: 800,
7 | phase: {
8 | ugen: "flock.ugen.sinOsc",
9 | freq: {
10 | ugen: "flock.ugen.xLine",
11 | rate: "control",
12 | start: 1,
13 | end: 1000,
14 | duration: 9
15 | },
16 | mul: flock.TWOPI
17 | },
18 | mul: 0.25
19 | }
20 | });
21 |
--------------------------------------------------------------------------------
/demos/playground/demos/lowpass-filter.js:
--------------------------------------------------------------------------------
1 | flock.synth({
2 | synthDef: {
3 | ugen: "flock.ugen.filter.biquad.lp",
4 | freq: {
5 | ugen: "flock.ugen.sin",
6 | rate: "control",
7 | freq: {
8 | ugen: "flock.ugen.xLine",
9 | rate: "control",
10 | start: 0.7,
11 | end: 300,
12 | duration: 20
13 | },
14 | phase: 0,
15 | mul: 3600,
16 | add: 4000
17 | },
18 | source: {
19 | ugen: "flock.ugen.lfSaw",
20 | freq: 200,
21 | mul: 0.1
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/demos/playground/demos/moog.js:
--------------------------------------------------------------------------------
1 | // A 24db low pass moog-style filter.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.filter.moog",
6 | cutoff: {
7 | ugen: "flock.ugen.sinOsc",
8 | freq: 1/4,
9 | mul: 5000,
10 | add: 7000
11 | },
12 | resonance: {
13 | ugen: "flock.ugen.sinOsc",
14 | freq: 1/2,
15 | mul: 1.5,
16 | add: 1.5
17 | },
18 | source: {
19 | ugen: "flock.ugen.lfSaw",
20 | freq: {
21 | ugen: "flock.ugen.sequence",
22 | freq: 1/2,
23 | loop: 1,
24 | values: [220, 220 * 5/4, 220, 220 * 3/2, 220 * 4/3, 220],
25 | options: {
26 | interpolation: "linear"
27 | }
28 | }
29 | },
30 | mul: 0.5
31 | }
32 | });
33 |
--------------------------------------------------------------------------------
/demos/playground/demos/mouse-click.js:
--------------------------------------------------------------------------------
1 | // Triggers a note whenever the mouse is clicked.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.sinOsc",
6 | freq: 440,
7 | mul: {
8 | ugen: "flock.ugen.asr",
9 | attack: 0.25,
10 | sustain: 0.25,
11 | release: 0.5,
12 | gate: {
13 | ugen: "flock.ugen.mouse.click"
14 | }
15 | }
16 | }
17 | });
18 |
--------------------------------------------------------------------------------
/demos/playground/demos/mouse-x.js:
--------------------------------------------------------------------------------
1 | // Tracks the mouse's horizonal movement across the window.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.sinOsc",
6 | freq: {
7 | ugen: "flock.ugen.mouse.cursor",
8 | rate: "control",
9 | mul: 880,
10 | add: 110
11 | },
12 | mul: 0.25
13 | }
14 | });
15 |
--------------------------------------------------------------------------------
/demos/playground/demos/mouse-xy.js:
--------------------------------------------------------------------------------
1 | // Tracks the mouse's vertical and horizontal movement within the editor area only.
2 | // Maps y position to amplitude and its x position to pitch.
3 |
4 | flock.synth({
5 | synthDef: {
6 | ugen: "flock.ugen.sinOsc",
7 | freq: {
8 | ugen: "flock.ugen.mouse.cursor",
9 | rate: "control",
10 | mul: 880,
11 | add: 110,
12 | options: {
13 | axis: "width",
14 | interpolation: "exponential",
15 | target: ".CodeMirror"
16 | }
17 | },
18 | mul: {
19 | ugen: "flock.ugen.mouse.cursor",
20 | rate: "control",
21 | options: {
22 | axis: "height",
23 | target: ".CodeMirror"
24 | },
25 | mul: 0.5
26 | }
27 | }
28 | });
29 |
--------------------------------------------------------------------------------
/demos/playground/demos/mouse-y.js:
--------------------------------------------------------------------------------
1 | // Tracks the mouse's vertical movement across the window.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.sinOsc",
6 | freq: {
7 | ugen: "flock.ugen.mouse.cursor",
8 | rate: "control",
9 | mul: 880,
10 | add: 110,
11 | options: {
12 | axis: "y"
13 | }
14 | },
15 | mul: 0.25
16 | }
17 | });
18 |
--------------------------------------------------------------------------------
/demos/playground/demos/multiple-synths.js:
--------------------------------------------------------------------------------
1 | /*global flock, $*/
2 |
3 | /*
4 | * Multiple synths playing back simultaneously, playing shifting chords.
5 | */
6 |
7 | // Creates an array of synths, each playing a degree of the chord specified in "intervals."
8 | function makeIntervallicSynths (fundamental, intervals) {
9 | var ampScale = 0.4 / intervals.length;
10 | return $.map(intervals, function (interval) {
11 | return flock.synth({
12 | synthDef: {
13 | id: "carrier",
14 | ugen: "flock.ugen.sin",
15 | freq: fundamental * interval,
16 | mul: ampScale
17 | }
18 | });
19 | });
20 | }
21 |
22 | var fundamental = 440,
23 | baseIntervals = [1/1, 5/4, 3/2],
24 | weightedIntervals = baseIntervals.concat([4/3, 6/5, 7/6, 2/1]).concat(baseIntervals),
25 | synths = makeIntervallicSynths(fundamental, baseIntervals),
26 | clock = flock.scheduler.async.tempo({
27 | bpm: 60
28 | });
29 |
30 | // Every second, change one of the intervals by randomly choosing a synth
31 | // and assigning it a new frequency from the list of intervals.
32 | clock.repeat(1, function () {
33 | var intervalSynth = flock.choose(synths),
34 | newInterval = flock.choose(weightedIntervals);
35 | intervalSynth.set("carrier.freq", fundamental * newInterval);
36 | });
37 |
--------------------------------------------------------------------------------
/demos/playground/demos/noise-fm.js:
--------------------------------------------------------------------------------
1 | // LFNoise randomly changing the pitch of a sine
2 | // oscillator every quarter second.
3 |
4 | flock.synth({
5 | synthDef: {
6 | ugen: "flock.ugen.sinOsc",
7 | mul: 0.25,
8 | freq: {
9 | ugen: "flock.ugen.lfNoise",
10 | freq: 4,
11 | mul: 400,
12 | add: 450
13 | }
14 | }
15 | });
16 |
--------------------------------------------------------------------------------
/demos/playground/demos/pinknoise.js:
--------------------------------------------------------------------------------
1 | flock.synth({
2 | synthDef: {
3 | ugen: "flock.ugen.pinkNoise",
4 | mul: 0.5
5 | }
6 | });
7 |
--------------------------------------------------------------------------------
/demos/playground/demos/play-buffer.js:
--------------------------------------------------------------------------------
1 | // Plays back a sound file in a loop.
2 | // The playback rate is controlled by the mouse cursor's vertical position,
3 | // while the end point in the sound file is determined by the mouse's horizontal position.
4 |
5 | flock.synth({
6 | synthDef: {
7 | ugen: "flock.ugen.playBuffer",
8 | buffer: {
9 | id: "chord",
10 | url: "../shared/audio/hillier-first-chord.wav"
11 | },
12 |
13 | speed: {
14 | ugen: "flock.ugen.mouse.cursor",
15 | options: {
16 | axis: "y"
17 | },
18 | add: 0.5
19 | },
20 |
21 | loop: 1,
22 |
23 | start: 0,
24 |
25 | end: {
26 | ugen: "flock.ugen.mouse.cursor",
27 | options: {
28 | axis: "x"
29 | }
30 | }
31 | }
32 | });
33 |
--------------------------------------------------------------------------------
/demos/playground/demos/playBuffer-trigger.js:
--------------------------------------------------------------------------------
1 | // Triggers the playback of a sound file from the beginning
2 | // every time the user clicks the mouse.
3 |
4 | flock.synth({
5 | synthDef: {
6 | ugen: "flock.ugen.playBuffer",
7 | buffer: {
8 | id: "chord",
9 | url: "../shared/audio/hillier-first-chord.wav"
10 | },
11 |
12 | trigger: {
13 | ugen: "flock.ugen.mouse.click"
14 | }
15 | }
16 | });
17 |
--------------------------------------------------------------------------------
/demos/playground/demos/pm.js:
--------------------------------------------------------------------------------
1 | // Phase modulation with sine waves.
2 | // Demo courtesty of Adam Tindale (http://www.adamtindale.com/).
3 |
4 | flock.synth({
5 | synthDef: {
6 | id: "carrier",
7 | ugen: "flock.ugen.sinOsc",
8 | freq: 440,
9 | phase: {
10 | id: "mod",
11 | ugen: "flock.ugen.sinOsc",
12 | freq: 34.0,
13 | mul: {
14 | ugen: "flock.ugen.sinOsc",
15 | freq: 1/20,
16 | mul: flock.PI
17 | },
18 | add: flock.PI
19 | },
20 | mul: 0.25
21 | }
22 | });
23 |
--------------------------------------------------------------------------------
/demos/playground/demos/polyphonicSynth.js:
--------------------------------------------------------------------------------
1 | var fundamental = 440;
2 |
3 | var polySynth = flock.synth.polyphonic({
4 | synthDef: {
5 | id: "carrier",
6 | ugen: "flock.ugen.sin",
7 | freq: fundamental,
8 | mul: {
9 | id: "env",
10 | ugen: "flock.ugen.asr",
11 | attack: 0.25,
12 | sustain: 1.0,
13 | release: 0.5
14 | }
15 | }
16 | });
17 |
18 | var score = [
19 | {
20 | action: "noteOn",
21 | noteName: "root",
22 | change: {
23 | "carrier.freq": fundamental
24 | }
25 | },
26 |
27 | {
28 | action: "noteOn",
29 | noteName: "mediant",
30 | change: {
31 | "carrier.freq": fundamental * 5/4
32 | }
33 | },
34 |
35 | {
36 | action: "noteOn",
37 | noteName: "dominant",
38 | change: {
39 | "carrier.freq": fundamental * 3/2
40 | }
41 | },
42 |
43 | {
44 | action: "noteOff",
45 | noteName: "root"
46 | },
47 |
48 | {
49 | action: "noteOff",
50 | noteName: "mediant"
51 | },
52 |
53 | {
54 | action: "noteOff",
55 | noteName: "dominant"
56 | }
57 | ];
58 |
59 | var idx = 0;
60 | polySynth.enviro.asyncScheduler.repeat(0.5, function () {
61 | if (idx >= score.length) {
62 | idx = 0;
63 | }
64 | var event = score[idx];
65 | polySynth[event.action](event.noteName, event.change);
66 | idx++;
67 | });
68 |
--------------------------------------------------------------------------------
/demos/playground/demos/readBuffer-phasor.js:
--------------------------------------------------------------------------------
1 | // Plays back a sound file while the user holds down the mouse button.
2 | // If the user lets go of the mouse and clicks it again, playback will resume at its previous location.
3 | // Uses a phasor and the bufferPhaseStep unit generator to play back the sound at its normal rate.
4 |
5 | flock.synth({
6 | synthDef: {
7 | ugen: "flock.ugen.readBuffer",
8 | buffer: {
9 | id: "chord",
10 | url: "../shared/audio/hillier-first-chord.wav"
11 | },
12 | phase: {
13 | rate: "audio",
14 | ugen: "flock.ugen.phasor",
15 | step: {
16 | ugen: "flock.ugen.mouse.click",
17 | mul: {
18 | ugen: "flock.ugen.bufferPhaseStep",
19 | buffer: "chord"
20 | }
21 | }
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/demos/playground/demos/readBuffer.js:
--------------------------------------------------------------------------------
1 | // Modulates the playback rate of a sound file with a sine wave oscillator.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.readBuffer",
6 | buffer: {
7 | id: "chord",
8 | url: "../shared/audio/hillier-first-chord.wav"
9 | },
10 | phase: {
11 | ugen: "flock.ugen.sin",
12 | freq: 1/5,
13 | mul: 0.5,
14 | add: 0.5
15 | }
16 | }
17 | });
18 |
--------------------------------------------------------------------------------
/demos/playground/demos/sample-accurate-scheduling.js:
--------------------------------------------------------------------------------
1 | // Schedules a series of input changes.
2 | // Composition by Colin Clark.
3 |
4 | flock.synth({
5 | synthDef: {
6 | ugen: "flock.ugen.out",
7 | sources: {
8 | ugen: "flock.ugen.change",
9 | initial: {
10 | ugen: "flock.ugen.sin",
11 | freq: {
12 | ugen: "flock.ugen.xLine",
13 | start: 211,
14 | end: 200,
15 | duration: 1
16 | }
17 | },
18 | target: {
19 | ugen: "flock.ugen.change",
20 | initial: {
21 | ugen: "flock.ugen.lfSaw",
22 | freq: {
23 | ugen: "flock.ugen.xLine",
24 | start: 200,
25 | end: 90,
26 | duration: 30
27 | },
28 | mul: 1.0
29 | },
30 | target: {
31 | ugen: "flock.ugen.change",
32 | initial: {
33 | ugen: "flock.ugen.sin",
34 | freq: {
35 | ugen: "flock.ugen.xLine",
36 | start: 200,
37 | end: 211,
38 | duration: 30
39 | }
40 | },
41 | target: {
42 | ugen: "flock.ugen.sin",
43 | freq: {
44 | ugen: "flock.ugen.change",
45 | initial: {
46 | ugen: "flock.ugen.sin",
47 | freq: 200,
48 | mul: 111
49 | },
50 | target: {
51 | ugen: "flock.ugen.xLine",
52 | start: 200,
53 | end: 211,
54 | duration: 45
55 | },
56 | time: 35,
57 | crossfade: 10
58 | },
59 | mul: {
60 | ugen: "flock.ugen.line",
61 | start: 1.0,
62 | end: 0.0,
63 | duration: 47.5
64 | }
65 | },
66 | time: 25,
67 | crossfade: 20
68 | }
69 | },
70 | time: 2.0,
71 | crossfade: 15.0
72 | }
73 | }
74 | });
75 |
--------------------------------------------------------------------------------
/demos/playground/demos/saw.js:
--------------------------------------------------------------------------------
1 | // A band-limited saw oscillator.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.saw",
6 | freq: 440,
7 | mul: 0.25
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/demos/playground/demos/scope.js:
--------------------------------------------------------------------------------
1 | // Visually displays the synth's output with an oscilliscope.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.scope",
6 | source: {
7 | ugen: "flock.ugen.sinOsc",
8 | freq: 440,
9 | mul: 0.25
10 | },
11 | options: {
12 | canvas: "#gfx",
13 | styles: {
14 | strokeColor: "#777777",
15 | strokeWidth: 2
16 | }
17 | }
18 | }
19 | });
20 |
--------------------------------------------------------------------------------
/demos/playground/demos/sequencer.js:
--------------------------------------------------------------------------------
1 | flock.synth({
2 | synthDef: {
3 | ugen: "flock.ugen.sin",
4 | freq: {
5 | ugen: "flock.ugen.sequencer",
6 | durations: [0.25, 0.25, 0.16666667, 0.16666667, 0.33, 0.25, 0.25],
7 | values: [1, 9/8, 4/3, 3/2, 4/3, 5/4, 1],
8 | mul: 440,
9 | loop: 1.0,
10 | options: {
11 | holdLastValue: true
12 | }
13 | },
14 | mul: {
15 | ugen: "flock.ugen.envGen",
16 | envelope: {
17 | levels: [0, 1, 0],
18 | times: [0.03, 0.2]
19 | },
20 | gate: {
21 | ugen: "flock.ugen.sequencer",
22 | durations: [0.25, 0.25, 0.16666667, 0.16666667, 0.33, 0.25, 0.25],
23 | values: [1, 1, 1, 1, 1, 1, 1],
24 | loop: 1.0,
25 | options: {
26 | resetOnNext: true
27 | }
28 | }
29 | }
30 | }
31 | });
32 |
--------------------------------------------------------------------------------
/demos/playground/demos/sine.js:
--------------------------------------------------------------------------------
1 | // A table-lookup sine wave oscillator.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.sinOsc",
6 | freq: 440,
7 | mul: 0.25
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/demos/playground/demos/square.js:
--------------------------------------------------------------------------------
1 | // A band-limited square wave oscillator.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.square",
6 | freq: 440,
7 | mul: 0.25
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/demos/playground/demos/stereo.js:
--------------------------------------------------------------------------------
1 | // Two different channels: both are sine waves with slightly different frequencies.
2 |
3 | flock.synth({
4 | synthDef: [
5 | {
6 | id: "leftSine",
7 | ugen: "flock.ugen.sinOsc",
8 | freq: 440,
9 | mul: 0.25
10 | },
11 | {
12 | id: "rightSine",
13 | ugen: "flock.ugen.sinOsc",
14 | freq: 444,
15 | mul: 0.25
16 | }
17 | ]
18 | });
19 |
--------------------------------------------------------------------------------
/demos/playground/demos/sum.js:
--------------------------------------------------------------------------------
1 | /*global flock*/
2 |
3 | // Adds together a bank of sine oscillators to make
4 | // a rudimentary clarinet tone with additive synthesis.
5 |
6 | var fundamental = 440,
7 | harmonics = [1, 3, 5, 7, 9, 13, 15], // Clarinets only have odd partials.
8 | baseHarmonicDef = {
9 | ugen: "flock.ugen.saw",
10 | freq: 440,
11 | mul: {
12 | ugen: "flock.ugen.envGen",
13 | envelope: {
14 | type: "flock.envelope.adsr",
15 | attack: 0.1,
16 | decay: 0.05,
17 | sustain: 0.75,
18 | release: 0.2
19 | },
20 | gate: {
21 | id: "gate",
22 | ugen: "flock.ugen.inputChangeTrigger",
23 | source: 1.0,
24 | duration: 0.8
25 | },
26 | mul: 1.0
27 | }
28 | };
29 |
30 | function expandHarmonics(fundamental, harmonics) {
31 | return fluid.transform(harmonics, function (harmonic, i) {
32 | var partialNum = i + 1;
33 |
34 | // Merge together the base ugenDef for all harmonics
35 | // with the parameters for this specific harmonic.
36 | return $.extend(true, {}, baseHarmonicDef, {
37 | freq: fundamental * harmonic,
38 | mul: {
39 | // Amplitude for a clarient should be the
40 | // inverse of the partial number. Then we scale
41 | // the amplitude for the number of partials
42 | // so that we don't clip.
43 | mul: (1 / partialNum) / harmonics.length
44 | }
45 | });
46 | });
47 | }
48 |
49 | function updateHarmonics(fundamental, harmonics, ugens) {
50 | fluid.each(harmonics, function (harmonic, i) {
51 | var ugen = ugens[i],
52 | freq = fundamental * harmonic;
53 |
54 | ugen.set({
55 | "freq": freq,
56 | "mul.gate.source": 1.0
57 | });
58 | });
59 | }
60 |
61 | var synth = flock.synth({
62 | synthDef: {
63 | ugen: "flock.ugen.filter.biquad.bp",
64 | freq: 500,
65 | q: 3.0,
66 | source: {
67 | id: "sum",
68 | ugen: "flock.ugen.sum",
69 | sources: expandHarmonics(fundamental, harmonics)
70 | }
71 | }
72 | });
73 |
74 | synth.enviro.asyncScheduler.repeat(1.0, function () {
75 | var fundamental = Math.random() * 1000 + 100;
76 | updateHarmonics(fundamental, harmonics, synth.get("sum.sources"));
77 | });
78 |
--------------------------------------------------------------------------------
/demos/playground/demos/tanh-distortion.js:
--------------------------------------------------------------------------------
1 | flock.synth({
2 | synthDef: {
3 | ugen: "flock.ugen.sum",
4 | sources: [
5 | {
6 | ugen: "flock.ugen.distortion.tanh",
7 | source: {
8 | ugen: "flock.ugen.sinOsc",
9 | freq: 500,
10 | mul: {
11 | ugen: "flock.ugen.asr",
12 | attack: 0.1,
13 | sustain: 0.1,
14 | release: 0.1,
15 | mul: 2,
16 | gate: {
17 | ugen: "flock.ugen.impulse",
18 | rate: "control",
19 | freq: 0.7,
20 | phase: 0
21 | }
22 | }
23 | }
24 | },
25 | {
26 | ugen: "flock.ugen.sinOsc",
27 | freq: 600,
28 | mul: {
29 | ugen: "flock.ugen.asr",
30 | attack: 0.1,
31 | sustain: 0.1,
32 | release: 0.1,
33 | mul: 2,
34 | gate: {
35 | ugen: "flock.ugen.impulse",
36 | rate: "control",
37 | freq: 0.7,
38 | phase: 0.5
39 | }
40 | }
41 | }
42 | ]
43 | }
44 | });
45 |
--------------------------------------------------------------------------------
/demos/playground/demos/tarrabia-dejong-distortion.js:
--------------------------------------------------------------------------------
1 | // Frequency-modulated saw wave by ring-modulated square wave through modulated distortion
2 | flock.synth({
3 | synthDef: {
4 | ugen: "flock.ugen.distortion.tarrabiaDeJong",
5 | amount: {
6 | ugen: "flock.ugen.sin",
7 | rate: "control",
8 | freq: 0.25
9 | },
10 | source: {
11 | ugen: "flock.ugen.saw",
12 | freq: {
13 | ugen: "flock.ugen.square",
14 | mul: {
15 | ugen: "flock.ugen.sin",
16 | mul: 30,
17 | freq: 2
18 | },
19 | add: 100
20 | }
21 | }
22 | }
23 | });
24 |
--------------------------------------------------------------------------------
/demos/playground/demos/tri.js:
--------------------------------------------------------------------------------
1 | // A band-limited triangle oscillator.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.tri",
6 | freq: 440,
7 | mul: 0.25
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/demos/playground/demos/trigger-callback.js:
--------------------------------------------------------------------------------
1 | // Periodically trigger a function that causes the scope area to shake.
2 |
3 | flock.synth({
4 | synthDef: {
5 | ugen: "flock.ugen.triggerCallback",
6 | trigger: {
7 | ugen: "flock.ugen.impulse",
8 | freq: 0.75,
9 | phase: 0.5
10 | },
11 | options: {
12 | callback: {
13 | func: function () {
14 | $("#gfx").toggleClass("shake");
15 | }
16 | }
17 | }
18 | }
19 | });
20 |
--------------------------------------------------------------------------------
/demos/playground/demos/whitenoise.js:
--------------------------------------------------------------------------------
1 | // Filters white noise with a bandpass filter
2 | // controlled by the mouse's horizontal position.
3 |
4 | flock.synth({
5 | synthDef: {
6 | ugen: "flock.ugen.filter.biquad.bp",
7 | source: {
8 | ugen: "flock.ugen.whiteNoise",
9 | mul: 0.5
10 | },
11 | freq: {
12 | ugen: "flock.ugen.mouse.cursor",
13 | mul: 1660,
14 | add: 40,
15 | options: {
16 | interoplation: "exponential"
17 | }
18 | },
19 | q: 2.0
20 | }
21 | });
22 |
--------------------------------------------------------------------------------
/demos/playground/js/error-console.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Flocking Playground Error Console
3 | * Copyright 2018, Colin Clark
4 | *
5 | * Dual licensed under the MIT and GPL Version 2 licenses.
6 | */
7 |
8 | /*global require*/
9 |
10 | var fluid = fluid || require("infusion"),
11 | flock = fluid.registerNamespace("flock");
12 |
13 | (function () {
14 | "use strict";
15 |
16 | fluid.defaults("flock.playground.errorConsole", {
17 | gradeNames: "fluid.viewComponent",
18 |
19 | invokers: {
20 | clearErrors: {
21 | "this": "{that}.container",
22 | method: "empty"
23 | }
24 | },
25 |
26 | events: {
27 | onEvaluationError: "{sourceEvaluator}.events.onEvaluationError",
28 | afterEvaluated: "{sourceEvaluator}.events.afterEvaluated"
29 | },
30 |
31 | listeners: {
32 | "afterEvaluated.clearErrors": "{that}.clearErrors()",
33 |
34 | "onEvaluationError.clearErrors": "{that}.clearErrors()",
35 |
36 | "onEvaluationError.renderError": {
37 | priority: "after:clearErrors",
38 | funcName: "flock.playground.errorConsole.renderError",
39 | args: ["{arguments}.0", "{that}"]
40 | }
41 | },
42 |
43 | markup: {
44 | err: "%name: "
45 | }
46 | });
47 |
48 | flock.playground.errorConsole.renderError = function (e, that) {
49 | var renderedHTML = fluid.stringTemplate(that.options.markup.err, {
50 | name: e.name,
51 | message: e.message
52 | });
53 | that.container.append(renderedHTML);
54 | };
55 | }());
56 |
--------------------------------------------------------------------------------
/demos/playground/live/css/live-playground.css:
--------------------------------------------------------------------------------
1 | .mainPanel.split-large {
2 | width: 60%;
3 | }
4 |
5 | .mainPanel.split-small {
6 | width: 40%;
7 | }
8 |
9 | #source-view {
10 | border-right: 0px;
11 | height: 95%;
12 | border-bottom: 1px solid #aaa;
13 | }
14 |
15 | .CodeMirror {
16 | height: 100%;
17 | border-bottom: 0px;
18 | }
19 |
20 | #visual-view {
21 | color: #fff;
22 | overflow: auto;
23 | position: relative;
24 | float: right;
25 | height: 95%;
26 | border-bottom: 1px solid #aaa;
27 | }
28 |
29 | .node {
30 | width: 6em;
31 | height: 1em;
32 | background-color: #999;
33 | color: #fff;
34 | border-radius: 0.5em;
35 | border: 0.1em solid #999;
36 | padding-bottom: 2.2em;
37 | padding-top: 1.5em;
38 | text-align: center;
39 | letter-spacing: 0.1em;
40 | z-index: 1;
41 | font-size: 0.75em;
42 | }
43 |
44 | .node.flock\.ugen\.value {
45 | width: 5em;
46 | height: 1em;
47 | font-family: monospace;
48 | font-weight: normal;
49 | background-color: #272822;
50 | font-size: 0.75em;
51 | border: 0.2em solid #999;
52 | overflow: hidden;
53 | }
54 |
55 | .node.flock\.buffer {
56 | width: 6em;
57 | font-family: monospace;
58 | font-weight: normal;
59 | background-color: #272822;
60 | border: 0.2em solid #999;
61 | overflow: hidden;
62 | }
63 |
64 | .node.flock\.list {
65 | font-family: monospace;
66 | font-weight: normal;
67 | background-color: #272822;
68 | font-size: 0.75em;
69 | }
70 |
71 | .node.flock\.envelope {
72 | width: 6em;
73 | font-family: monospace;
74 | font-weight: normal;
75 | background-color: #272822;
76 | }
77 |
78 | ._jsPlumb_overlay {
79 | border-radius: 0.5em;
80 | background-color: rgba(68, 85, 102, 1);
81 | color: #fff;
82 | padding: 0.5em 0.5em;
83 | font-size: 0.75em;
84 | z-index: 2;
85 | letter-spacing: 0.1em;
86 | }
87 |
88 | ._jsPlumb_endpoint {
89 | z-index: 1;
90 | }
91 |
92 | ._jsPlumb_endpoint circle {
93 | fill: #272822;
94 | z-index: 1;
95 | stroke: #999;
96 | }
97 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/am.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Creates a new synth consisting of a sine wave whose amplitude is slowly moduled by another sine wave.",
3 | "synthDef": {
4 | "id": "carrier",
5 | "ugen": "flock.ugen.sinOsc",
6 | "freq": 440,
7 | "mul": {
8 | "id": "mod",
9 | "ugen": "flock.ugen.sinOsc",
10 | "freq": 1.0,
11 | "mul": 0.25
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/asr.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Sine tone shaped by a periodically triggered attack/sustain/release envelope.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sinOsc",
5 | "freq": 440,
6 | "mul": {
7 | "ugen": "flock.ugen.asr",
8 | "start": 0.0,
9 | "attack": 0.25,
10 | "sustain": 0.25,
11 | "release": 1.0,
12 | "gate": {
13 | "ugen": "flock.ugen.impulse",
14 | "rate": "control",
15 | "freq": 0.75,
16 | "phase": 1.0
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/audio-in-granulated.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Granulates live audio from the microphone. Wear headphones to prevent feedback.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.granulator",
5 | "delayDur": 0.25,
6 | "numGrains": {
7 | "ugen": "flock.ugen.lfNoise",
8 | "freq": 0.5,
9 | "mul": 75,
10 | "add": 75,
11 | "options": {
12 | "interpolation": "linear"
13 | }
14 | },
15 | "source": {
16 | "ugen": "flock.ugen.audioIn"
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/audio-in.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Plays back live audio from the microphone. Wear headphones to prevent feedback.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.audioIn"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/band.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "flock.band",
3 | "options": {
4 | "components": {
5 | "left": {
6 | "type": "flock.synth",
7 | "options": {
8 | "synthDef": {
9 | "ugen": "flock.ugen.out",
10 | "bus": 0,
11 | "expand": 1,
12 | "sources": [
13 | {
14 | "ugen": "flock.ugen.sinOsc",
15 | "freq": {
16 | "ugen": "flock.ugen.sequence",
17 | "values": [1, 1.333333, 1.25],
18 | "loop": 1,
19 | "freq": 3,
20 | "mul": 440
21 | },
22 | "mul": 0.5
23 | }
24 | ]
25 | }
26 | }
27 | },
28 | "right": {
29 | "type": "flock.synth",
30 | "options": {
31 | "synthDef": {
32 | "ugen": "flock.ugen.out",
33 | "bus": 1,
34 | "expand": 1,
35 | "sources": [
36 | {
37 | "ugen": "flock.ugen.sinOsc",
38 | "freq": {
39 | "ugen": "flock.ugen.sequence",
40 | "values": [1, 1.5],
41 | "loop": 1,
42 | "freq": 2,
43 | "mul": 220
44 | },
45 | "mul": 0.5
46 | }
47 | ]
48 | }
49 | }
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/bandlimited-impulse.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Comparison between regular and band-limited impulse generators. The left channel aliases at high frequencies (you'll hear it wobble). The right channel is band-limited, and thus smooth throughout the spectrum.",
3 | "synthDef": [
4 | {
5 | "ugen": "flock.ugen.impulse",
6 | "freq": {
7 | "ugen": "flock.ugen.xLine",
8 | "start": 10000,
9 | "end": 20,
10 | "duration": 10
11 | },
12 | "mul": 0.5
13 | },
14 |
15 | {
16 | "ugen": "flock.ugen.blit",
17 | "freq": {
18 | "ugen": "flock.ugen.xLine",
19 | "start": 10000,
20 | "end": 20,
21 | "duration": 10
22 | },
23 | "mul": 0.5
24 | }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/bandpass-filter.json:
--------------------------------------------------------------------------------
1 | {
2 | "synthDef": {
3 | "ugen": "flock.ugen.filter.biquad.bp",
4 | "freq": {
5 | "ugen": "flock.ugen.mouse.cursor",
6 | "options": {
7 | "interpolation": "exponential"
8 | },
9 | "mul": 10000,
10 | "add": 100,
11 | "lag": 1
12 | },
13 | "q": 3.0,
14 | "source": {
15 | "ugen": "flock.ugen.saw",
16 | "freq": 200,
17 | "mul": 0.1
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/bandreject-filter.json:
--------------------------------------------------------------------------------
1 | {
2 | "synthDef": {
3 | "ugen": "flock.ugen.filter.biquad.br",
4 | "freq": {
5 | "ugen": "flock.ugen.mouse.cursor",
6 | "options": {
7 | "interpolation": "exponential"
8 | },
9 | "mul": 10000,
10 | "add": 100,
11 | "lag": 1
12 | },
13 | "q": 3.0,
14 | "source": {
15 | "ugen": "flock.ugen.saw",
16 | "freq": 200,
17 | "mul": 0.1
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/chop-buffer.json:
--------------------------------------------------------------------------------
1 | {
2 | "synthDef": {
3 | "id": "chopper",
4 | "ugen": "flock.ugen.chopBuffer",
5 | "start": 0.1,
6 | "amount": {
7 | "ugen": "flock.ugen.triOsc",
8 | "rate": "control",
9 | "freq": 0.03333333,
10 | "mul": 0.5,
11 | "add": 0.5
12 | },
13 | "speed": {
14 | "ugen": "flock.ugen.lfNoise",
15 | "rate": "audio",
16 | "options": {
17 | "interpolation": "linear"
18 | },
19 | "freq": 0.2,
20 | "mul": 0.5,
21 | "add": 0.5
22 | },
23 | "minDuration": {
24 | "ugen": "flock.ugen.lfNoise",
25 | "freq": 0.2,
26 | "mul": 0.5,
27 | "add": 0.001
28 | },
29 | "gap": -0.001,
30 | "buffer": {
31 | "url": "../../shared/audio/where-the-honey-is.mp3"
32 | },
33 |
34 | "mul": 0.1,
35 |
36 | "options": {
37 | "maxVoices": 10
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/custom-envelope.json:
--------------------------------------------------------------------------------
1 | {
2 | "synthDef": {
3 | "ugen": "flock.ugen.sinOsc",
4 | "freq": 270,
5 | "phase": {
6 | "ugen": "flock.ugen.sinOsc",
7 | "freq": {
8 | "ugen": "flock.ugen.envGen",
9 | "rate": "control",
10 | "envelope": {
11 | "levels": [0, 1, 0.4, 1.0, 0.6, 0],
12 | "times": [0.5, 0.3, 0.5, 0.3, 0.5],
13 | "curve": ["sin", "exponential", "linear", "welsh", 3]
14 | },
15 | "mul": 473,
16 | "gate": {
17 | "ugen": "flock.ugen.lfPulse",
18 | "rate": "control",
19 | "freq": 0.39,
20 | "width": 0.5
21 | }
22 | }
23 | },
24 | "mul": {
25 | "ugen": "flock.ugen.envGen",
26 | "rate": "control",
27 | "envelope": {
28 | "levels": [0, 1, 0.4, 1.0, 0.6, 0],
29 | "times": [0.5, 0.3, 0.5, 0.3, 0.5],
30 | "curve": ["sin", "exponential", "linear", "welsh", 3]
31 | },
32 | "mul": 0.5,
33 | "gate": {
34 | "ugen": "flock.ugen.lfPulse",
35 | "rate": "control",
36 | "freq": 0.39,
37 | "width": 0.5
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/decay.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "The decay unit generator enveloping white noise, creating percussive sounds.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.decay",
5 | "source": {
6 | "ugen": "flock.ugen.impulse",
7 | "rate": "audio",
8 | "freq": {
9 | "ugen": "flock.ugen.xLine",
10 | "rate": "control",
11 | "start": 1,
12 | "end": 50,
13 | "duration": 20
14 | },
15 | "phase": 0.25,
16 | "mul": 0.25
17 | },
18 | "time": 0.2,
19 | "mul": {
20 | "ugen": "flock.ugen.whiteNoise"
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/declarative-scheduling.json:
--------------------------------------------------------------------------------
1 | {
2 | "components": {
3 | "sinSynth": {
4 | "type": "flock.synth",
5 | "options": {
6 | "synthDef": {
7 | "id": "carrier",
8 | "ugen": "flock.ugen.sinOsc",
9 | "freq": 220,
10 | "mul": {
11 | "ugen": "flock.ugen.line",
12 | "start": 0,
13 | "end": 0.25,
14 | "duration": 1.0
15 | }
16 | }
17 | }
18 | },
19 |
20 | "scheduler": {
21 | "type": "flock.scheduler.async",
22 | "options": {
23 | "components": {
24 | "synthContext": "{sinSynth}"
25 | },
26 |
27 | "score": [
28 | {
29 | "interval": "repeat",
30 | "time": 1.0,
31 | "change": {
32 | "values": {
33 | "carrier.freq": {
34 | "synthDef": {
35 | "ugen": "flock.ugen.sequence",
36 | "values": [330, 440, 550, 660, 880, 990, 1100, 1210]
37 | }
38 | }
39 | }
40 | }
41 | },
42 |
43 | {
44 | "interval": "once",
45 | "time": 8,
46 | "change": {
47 | "values": {
48 | "carrier.mul.start": 0.25,
49 | "carrier.mul.end": 0.0,
50 | "carrier.mul.duration": 1.0
51 | }
52 | }
53 | }
54 | ]
55 | }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/dejong-distortion.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Sine-modulated distortion of a sawtooth wave",
3 | "synthDef": {
4 | "ugen": "flock.ugen.distortion.deJong",
5 | "amount": {
6 | "ugen": "flock.ugen.sin",
7 | "mul": 99,
8 | "add": 100,
9 | "freq": 0.1
10 | },
11 | "source": {
12 | "ugen": "flock.ugen.sawOsc",
13 | "freq": 45,
14 | "mul": 0.01
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/delay.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Use dust to trigger the delay unit generator as an envelope for a decaying whiteNoise source",
3 | "synthDef": {
4 | "ugen": "flock.ugen.delay",
5 | "source": {
6 | "ugen": "flock.ugen.decay",
7 | "source": {
8 | "ugen": "flock.ugen.dust",
9 | "density": 1.0,
10 | "mul": 0.5
11 | },
12 | "time": 0.3,
13 | "mul": {
14 | "ugen": "flock.ugen.whiteNoise"
15 | }
16 | },
17 | "maxTime": 1.0,
18 | "time": 0.2,
19 | "add": {
20 | "ugen": "flock.ugen.decay",
21 | "source": {
22 | "ugen": "flock.ugen.dust",
23 | "density": 1.0,
24 | "mul": 0.5
25 | },
26 | "time": 0.3,
27 | "mul": {
28 | "ugen": "flock.ugen.whiteNoise"
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/dust.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Using dust to generate random audio noise.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.dust",
5 | "density": 200,
6 | "mul": 0.25
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/fm.json:
--------------------------------------------------------------------------------
1 | {
2 | "synthDef": {
3 | "ugen": "flock.ugen.sin",
4 | "freq": {
5 | "ugen": "flock.ugen.value",
6 | "value": 400,
7 | "add": {
8 | "ugen": "flock.ugen.sin",
9 | "freq": {
10 | "ugen": "flock.ugen.mouse.cursor",
11 | "mul": 124,
12 | "add": 62
13 | },
14 | "mul": {
15 | "ugen": "flock.ugen.mouse.cursor",
16 | "mul": 100,
17 | "add": 100,
18 | "options": {
19 | "axis": "y"
20 | }
21 | }
22 | }
23 | },
24 | "mul": 0.3
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/glissando.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "An descending sinOsc glissando using a line ugen.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sinOsc",
5 | "freq": {
6 | "ugen": "flock.ugen.xLine",
7 | "rate": "control",
8 | "duration": 1.0,
9 | "start": 2000,
10 | "end": 200
11 | },
12 | "mul": 0.25
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/granulator.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Granulates a filtered sawtooth wave. Demo by Mayank Sanganeria and Adam Tindale.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.granulator",
5 | "numGrains": {
6 | "ugen": "flock.ugen.line",
7 | "start": 1,
8 | "end": 40,
9 | "duration": 20
10 | },
11 | "grainDur": {
12 | "ugen": "flock.ugen.line",
13 | "start": 0.1,
14 | "end": 0.005,
15 | "duration": 100
16 | },
17 | "delayDur": 8,
18 | "mul": 0.5,
19 | "source": {
20 | "ugen": "flock.ugen.filter.biquad.lp",
21 | "freq": {
22 | "ugen": "flock.ugen.sin",
23 | "rate": "control",
24 | "freq": {
25 | "ugen": "flock.ugen.xLine",
26 | "rate": "control",
27 | "start": 0.7,
28 | "end": 3000,
29 | "duration": 60
30 | },
31 | "phase": 0,
32 | "mul": 2000,
33 | "add": 4000
34 | },
35 | "source": {
36 | "ugen": "flock.ugen.lfSaw",
37 | "freq": {
38 | "ugen": "flock.ugen.sin",
39 | "freq": 0.1,
40 | "mul": 1000,
41 | "add": 3000
42 | },
43 | "mul": 0.25
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/highpass-filter.json:
--------------------------------------------------------------------------------
1 | {
2 | "synthDef": {
3 | "ugen": "flock.ugen.filter.biquad.hp",
4 | "freq": {
5 | "ugen": "flock.ugen.sin",
6 | "rate": "control",
7 | "freq": {
8 | "ugen": "flock.ugen.xLine",
9 | "rate": "control",
10 | "start": 0.7,
11 | "end": 300,
12 | "duration": 20
13 | },
14 | "phase": 0,
15 | "mul": 3600,
16 | "add": 4000
17 | },
18 | "source": {
19 | "ugen": "flock.ugen.saw",
20 | "freq": 200,
21 | "mul": 0.1
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/impulse-pm.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "A stereo pair of impulses, one being phase modulated with the mouse cursor.",
3 | "synthDef": [
4 | {
5 | "ugen": "flock.ugen.impulse",
6 | "freq": 4,
7 | "mul": 0.3,
8 | "phase": 0
9 | },
10 | {
11 | "ugen": "flock.ugen.impulse",
12 | "freq": 4,
13 | "mul": 0.3,
14 | "phase": {
15 | "ugen": "flock.ugen.mouse.cursor"
16 | }
17 | }
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/impulse.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "The impulse ugen's frequency controlled by a descending xLine",
3 | "synthDef": {
4 | "ugen": "flock.ugen.impulse",
5 | "freq": {
6 | "ugen": "flock.ugen.xLine",
7 | "start": 880,
8 | "end": 2,
9 | "duration": 3.0
10 | },
11 | "mul": 0.25
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/latch.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "description": "David Michael Cottle's first Latch example from http://rhoadley.net/courses/tech_resources/supercollider/tutorials/cottle/CMSC7105.pdf",
4 | "synthDef": {
5 | "ugen": "flock.ugen.sin",
6 | "mul": 0.3,
7 | "freq": {
8 | "ugen": "flock.ugen.latch",
9 | "rate": "control",
10 | "source": {
11 | "ugen": "flock.ugen.lfSaw",
12 | "freq": {
13 | "ugen": "flock.ugen.mouse.cursor",
14 | "rate": "control",
15 | "mul": 18.9,
16 | "add": 1.1
17 | },
18 | "mul": 500,
19 | "add": 600
20 | },
21 | "trigger": {
22 | "ugen": "flock.ugen.impulse",
23 | "rate": "control",
24 | "freq": 10
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/lfNoise.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Generating random audio noise with lfNoise.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.lfNoise",
5 | "freq": 1000,
6 | "mul": 0.25
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/line-fm.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Frequency modulation controlled by an exponential line",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sinOsc",
5 | "freq": {
6 | "ugen": "flock.ugen.sinOsc",
7 | "freq": {
8 | "ugen": "flock.ugen.xLine",
9 | "rate": "control",
10 | "start": 1,
11 | "end": 1000,
12 | "duration": 9
13 | },
14 | "mul": 200,
15 | "add": 800
16 | },
17 | "mul": 0.25
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/line-pm.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Line modulating the phase of a sine oscillator.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sinOsc",
5 | "freq": 800,
6 | "phase": {
7 | "ugen": "flock.ugen.sinOsc",
8 | "freq": {
9 | "ugen": "flock.ugen.xLine",
10 | "rate": "control",
11 | "start": 1,
12 | "end": 1000,
13 | "duration": 9
14 | },
15 | "mul": 6.28318531
16 | },
17 | "mul": 0.25
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/lowpass-filter.json:
--------------------------------------------------------------------------------
1 | {
2 | "synthDef": {
3 | "ugen": "flock.ugen.filter.biquad.lp",
4 | "freq": {
5 | "ugen": "flock.ugen.sin",
6 | "rate": "control",
7 | "freq": {
8 | "ugen": "flock.ugen.xLine",
9 | "rate": "control",
10 | "start": 0.7,
11 | "end": 300,
12 | "duration": 20
13 | },
14 | "phase": 0,
15 | "mul": 3600,
16 | "add": 4000
17 | },
18 | "source": {
19 | "ugen": "flock.ugen.saw",
20 | "freq": 200,
21 | "mul": 0.1
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/moog.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "A 24db low pass Moog-style filter",
3 | "synthDef": {
4 | "ugen": "flock.ugen.filter.moog",
5 | "cutoff": {
6 | "ugen": "flock.ugen.sinOsc",
7 | "freq": 0.25,
8 | "mul": 5000,
9 | "add": 7000
10 | },
11 | "resonance": {
12 | "ugen": "flock.ugen.sinOsc",
13 | "freq": 0.5,
14 | "mul": 1.5,
15 | "add": 1.5
16 | },
17 | "source": {
18 | "ugen": "flock.ugen.saw",
19 | "freq": {
20 | "ugen": "flock.ugen.sequence",
21 | "freq": 0.5,
22 | "loop": 1,
23 | "values": [220, 275, 220, 330, 293.34, 220],
24 | "options": {
25 | "interpolation": "linear"
26 | }
27 | }
28 | },
29 | "mul": 0.5
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/mouse-click.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Triggers a note whenever the mouse is clicked.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sinOsc",
5 | "freq": 440,
6 | "mul": {
7 | "ugen": "flock.ugen.asr",
8 | "attack": 0.25,
9 | "sustain": 0.25,
10 | "release": 0.5,
11 | "gate": {
12 | "ugen": "flock.ugen.mouse.click"
13 | }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/mouse-x.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Tracks the mouse's horizonal movement across the window.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sinOsc",
5 | "freq": {
6 | "ugen": "flock.ugen.mouse.cursor",
7 | "rate": "control",
8 | "mul": 880,
9 | "add": 110
10 | },
11 | "mul": 0.25
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/mouse-xy.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Tracks the mouse's vertical and horizontal movement within the editor area only. Maps the y axis to amplitude and the x axis to pitch.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sinOsc",
5 | "freq": {
6 | "ugen": "flock.ugen.mouse.cursor",
7 | "rate": "control",
8 | "mul": 880,
9 | "add": 110,
10 | "options": {
11 | "axis": "width",
12 | "interpolation": "exponential",
13 | "target": ".CodeMirror"
14 | }
15 | },
16 | "mul": {
17 | "ugen": "flock.ugen.mouse.cursor",
18 | "rate": "control",
19 | "options": {
20 | "axis": "height",
21 | "target": ".CodeMirror"
22 | },
23 | "mul": 0.5
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/mouse-y.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Tracks the mouse's vertical movement across the window.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sinOsc",
5 | "freq": {
6 | "ugen": "flock.ugen.mouse.cursor",
7 | "rate": "control",
8 | "mul": 880,
9 | "add": 110,
10 | "options": {
11 | "axis": "y"
12 | }
13 | },
14 | "mul": 0.25
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/noise-fm.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "LFNoise randomly changing the pitch of a sine oscillator every quarter second.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sinOsc",
5 | "mul": 0.25,
6 | "freq": {
7 | "ugen": "flock.ugen.lfNoise",
8 | "freq": 4,
9 | "mul": 400,
10 | "add": 450
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/pinknoise.json:
--------------------------------------------------------------------------------
1 | {
2 | "synthDef": {
3 | "ugen": "flock.ugen.pinkNoise",
4 | "mul": 0.5
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/play-buffer.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Plays back a sound file in a loop. The playback rate is controlled by the mouse cursor's vertical position, while the end point in the sound file is determined by the mouse's horizontal position.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.playBuffer",
5 | "buffer": {
6 | "id": "chord",
7 | "url": "../../shared/audio/hillier-first-chord.wav"
8 | },
9 |
10 | "speed": {
11 | "ugen": "flock.ugen.mouse.cursor",
12 | "options": {
13 | "axis": "y"
14 | },
15 | "add": 0.5
16 | },
17 |
18 | "loop": 1,
19 |
20 | "start": 0,
21 |
22 | "end": {
23 | "ugen": "flock.ugen.mouse.cursor",
24 | "options": {
25 | "axis": "x"
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/playBuffer-trigger.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Triggers the playback of a sound file from the beginning every time the user clicks the mouse.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.playBuffer",
5 | "buffer": {
6 | "id": "chord",
7 | "url": "../../shared/audio/hillier-first-chord.wav"
8 | },
9 |
10 | "trigger": {
11 | "ugen": "flock.ugen.mouse.click"
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/pm.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Phase modulation with sine waves. Demo courtesty of Adam Tindale (http://www.adamtindale.com/).",
3 | "synthDef": {
4 | "id": "carrier",
5 | "ugen": "flock.ugen.sinOsc",
6 | "freq": 440,
7 | "phase": {
8 | "id": "mod",
9 | "ugen": "flock.ugen.sinOsc",
10 | "freq": 34.0,
11 | "mul": {
12 | "ugen": "flock.ugen.sinOsc",
13 | "freq": 0.05,
14 | "mul": 3.141592653589793
15 | },
16 | "add": 3.141592653589793
17 | },
18 | "mul": 0.25
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/readBuffer-phasor.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Plays back a sound file while the user holds down the mouse button. If the user lets go of the mouse and clicks it again, playback will resume at its previous location. Uses a phasor and the bufferPhaseStep unit generator to play back the sound at its normal rate.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.readBuffer",
5 | "buffer": {
6 | "id": "chord",
7 | "url": "../../shared/audio/hillier-first-chord.wav"
8 | },
9 | "phase": {
10 | "rate": "audio",
11 | "ugen": "flock.ugen.phasor",
12 | "step": {
13 | "ugen": "flock.ugen.mouse.click",
14 | "mul": {
15 | "ugen": "flock.ugen.bufferPhaseStep",
16 | "buffer": "chord"
17 | }
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/readBuffer.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Modulates the playback rate of a sound file with a sine wave oscillator.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.readBuffer",
5 | "buffer": {
6 | "id": "chord",
7 | "url": "../../shared/audio/hillier-first-chord.wav"
8 | },
9 | "phase": {
10 | "ugen": "flock.ugen.sin",
11 | "freq": 0.2,
12 | "mul": 0.5,
13 | "add": 0.5
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/sample-accurate-scheduling.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Schedules a series of input changes. Composition by Colin Clark.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.out",
5 | "sources": {
6 | "ugen": "flock.ugen.change",
7 | "initial": {
8 | "ugen": "flock.ugen.sin",
9 | "freq": {
10 | "ugen": "flock.ugen.xLine",
11 | "start": 211,
12 | "end": 200,
13 | "duration": 1
14 | }
15 | },
16 | "target": {
17 | "ugen": "flock.ugen.change",
18 | "initial": {
19 | "ugen": "flock.ugen.lfSaw",
20 | "freq": {
21 | "ugen": "flock.ugen.xLine",
22 | "start": 200,
23 | "end": 90,
24 | "duration": 30
25 | },
26 | "mul": 1.0
27 | },
28 | "target": {
29 | "ugen": "flock.ugen.change",
30 | "initial": {
31 | "ugen": "flock.ugen.sin",
32 | "freq": {
33 | "ugen": "flock.ugen.xLine",
34 | "start": 200,
35 | "end": 211,
36 | "duration": 30
37 | }
38 | },
39 | "target": {
40 | "ugen": "flock.ugen.sin",
41 | "freq": {
42 | "ugen": "flock.ugen.change",
43 | "initial": {
44 | "ugen": "flock.ugen.sin",
45 | "freq": 200,
46 | "mul": 111
47 | },
48 | "target": {
49 | "ugen": "flock.ugen.xLine",
50 | "start": 200,
51 | "end": 211,
52 | "duration": 45
53 | },
54 | "time": 35,
55 | "crossfade": 10
56 | },
57 | "mul": {
58 | "ugen": "flock.ugen.line",
59 | "start": 1.0,
60 | "end": 0.0,
61 | "duration": 47.5
62 | }
63 | },
64 | "time": 25,
65 | "crossfade": 20
66 | }
67 | },
68 | "time": 2.0,
69 | "crossfade": 15.0
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/saw.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Non-band limited saw oscillator.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.saw",
5 | "freq": 440,
6 | "mul": 0.25
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/scope.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Display a synth's output with an oscilliscope.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.scope",
5 | "source": {
6 | "ugen": "flock.ugen.sinOsc",
7 | "freq": 440,
8 | "mul": 0.25
9 | },
10 | "options": {
11 | "canvas": "#gfx",
12 | "styles": {
13 | "strokeColor": "#777777",
14 | "strokeWidth": 2
15 | }
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/sequencer.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Sequencing notes using the sequencer unit generator",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sin",
5 | "freq": {
6 | "ugen": "flock.ugen.sequencer",
7 | "durations": [0.25, 0.25, 0.16666667, 0.16666667, 0.33, 0.25, 0.25],
8 | "values": [440, 495, 586.666666, 660, 586.666666, 550, 440],
9 | "loop": 1.0,
10 | "options": {
11 | "holdLastValue": true
12 | }
13 | },
14 | "mul": {
15 | "ugen": "flock.ugen.envGen",
16 | "envelope": {
17 | "levels": [0, 1, 0],
18 | "times": [0.03, 0.2]
19 | },
20 | "gate": {
21 | "ugen": "flock.ugen.sequencer",
22 | "durations": [0.25, 0.25, 0.16666667, 0.16666667, 0.33, 0.25, 0.25],
23 | "values": [1, 1, 1, 1, 1, 1, 1],
24 | "loop": 1.0,
25 | "options": {
26 | "resetOnNext": true
27 | }
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/sine.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Simple sine wave oscillator",
3 | "synthDef": {
4 | "ugen": "flock.ugen.sinOsc",
5 | "freq": 440,
6 | "mul": 0.25
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/square.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Non-band limited square wave oscillator",
3 | "synthDef": {
4 | "ugen": "flock.ugen.square",
5 | "freq": 440,
6 | "mul": 0.25
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/stereo.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Two different channels: both are sine waves with slightly different frequencies.",
3 | "synthDef": [
4 | {
5 | "id": "leftSine",
6 | "ugen": "flock.ugen.sinOsc",
7 | "freq": 440,
8 | "mul": 0.25
9 | },
10 | {
11 | "id": "rightSine",
12 | "ugen": "flock.ugen.sinOsc",
13 | "freq": 444,
14 | "mul": 0.25
15 | }
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/tanh-distortion.json:
--------------------------------------------------------------------------------
1 | {
2 | "synthDef": {
3 | "ugen": "flock.ugen.sum",
4 | "sources": [
5 | {
6 | "ugen": "flock.ugen.distortion.tanh",
7 | "source": {
8 | "ugen": "flock.ugen.sinOsc",
9 | "freq": 500,
10 | "mul": {
11 | "ugen": "flock.ugen.asr",
12 | "attack": 0.1,
13 | "sustain": 0.1,
14 | "release": 0.1,
15 | "mul": 2,
16 | "gate": {
17 | "ugen": "flock.ugen.impulse",
18 | "rate": "control",
19 | "freq": 0.7,
20 | "phase": 0
21 | }
22 | }
23 | }
24 | },
25 | {
26 | "ugen": "flock.ugen.sinOsc",
27 | "freq": 600,
28 | "mul": {
29 | "ugen": "flock.ugen.asr",
30 | "attack": 0.1,
31 | "sustain": 0.1,
32 | "release": 0.1,
33 | "mul": 2,
34 | "gate": {
35 | "ugen": "flock.ugen.impulse",
36 | "rate": "control",
37 | "freq": 0.7,
38 | "phase": 0.5
39 | }
40 | }
41 | }
42 | ]
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/tarrabia-dejong-distortion.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Frequency-modulated saw wave by ring-modulated square wave through modulated distortion",
3 | "synthDef": {
4 | "ugen": "flock.ugen.distortion.tarrabiaDeJong",
5 | "amount": {
6 | "ugen": "flock.ugen.sin",
7 | "rate": "control",
8 | "freq": 0.25
9 | },
10 | "source": {
11 | "ugen": "flock.ugen.saw",
12 | "freq": {
13 | "ugen": "flock.ugen.square",
14 | "mul": {
15 | "ugen": "flock.ugen.sin",
16 | "mul": 30,
17 | "freq": 2
18 | },
19 | "add": 100
20 | }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/tri.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Non-band limited triangle oscillator",
3 | "synthDef": {
4 | "ugen": "flock.ugen.tri",
5 | "freq": 440,
6 | "mul": 0.25
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/demos/playground/live/demos/whitenoise.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Filtering white noise with the mouse.",
3 | "synthDef": {
4 | "ugen": "flock.ugen.filter.biquad.bp",
5 | "source": {
6 | "ugen": "flock.ugen.whiteNoise",
7 | "mul": 0.5
8 | },
9 | "freq": {
10 | "ugen": "flock.ugen.mouse.cursor",
11 | "mul": 1660,
12 | "add": 40,
13 | "options": {
14 | "interoplation": "exponential"
15 | }
16 | },
17 | "q": 2.0
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/demos/shared/audio/hillier-first-chord.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lichen-community-systems/Flocking/0b023ea4bfbf5ef3c089f2f1736ad9910d912f7b/demos/shared/audio/hillier-first-chord.wav
--------------------------------------------------------------------------------
/demos/shared/audio/where-the-honey-is.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lichen-community-systems/Flocking/0b023ea4bfbf5ef3c089f2f1736ad9910d912f7b/demos/shared/audio/where-the-honey-is.mp3
--------------------------------------------------------------------------------
/demos/shared/css/demos.css:
--------------------------------------------------------------------------------
1 | @import url(https://fonts.googleapis.com/css?family=Nunito);
2 | body {
3 | font-family: "Nunito", sans-serif;
4 | background: #eee;
5 | }
6 |
7 | th, td {
8 | background-color: #DDDDDD;
9 | padding: 10px;
10 | }
11 |
12 | th {
13 | text-align: left;
14 | width: 130px;
15 | }
16 |
17 | td {
18 | width: 50px;
19 | }
20 |
21 | .playButton {
22 | border: none;
23 | height: 77px;
24 | width: 77px;
25 | float: left;
26 | margin: 5% 0% 0% 2%;
27 | color: transparent;
28 | }
29 |
30 | .playButton.playing {
31 | background: transparent url("../../../images/pause.png") no-repeat center center;
32 | background-size: cover;
33 | }
34 |
35 | .playButton.paused {
36 | background: transparent url("../../../images/play.png") no-repeat center center;
37 | background-size: cover;
38 | }
39 |
40 | .fileSelector label {
41 | display: none;
42 | }
43 |
44 | .fileSelector .fileBrowser {
45 | display: none;
46 | padding: 10px;
47 | }
48 |
49 | .fileSelector .filePath {
50 | font-family: courier, monospace;
51 | font-size: 80%;
52 | padding-top: 2.5%;
53 | padding-right: 3%;
54 | padding-left: 3%;
55 | }
56 |
57 | .fileSelector .browse {
58 | border: 2px solid #888;
59 | border-radius: 10px;
60 | font-size: 100%;
61 | font-style: italic;
62 | background: #fff;
63 | padding: 1.5%;
64 | }
65 |
66 | .instructions {
67 | font-style: italic;
68 | font-size: 80%;
69 | }
70 |
71 | label {
72 | font-family: serif;
73 | }
74 |
75 | select {
76 | margin-left: 0.5em;
77 | margin-right: 0.5em;
78 | min-width: 20em;
79 | }
80 |
--------------------------------------------------------------------------------
/docs/building-flocking.md:
--------------------------------------------------------------------------------
1 | # Building Flocking #
2 |
3 | Flocking ships with pre-built development and production files in the dist
directory. For most users, it's suitable to simply load flocking-all.min.js
in your HTML file.
4 |
5 | For more advanced users, however, Flocking includes a build system that takes care of linting, concatenating, minifying, and organizing the Flocking source tree. The build system is powered by [Grunt](https://gruntjs.com).
6 |
7 | The build system will generate a single file that is easy to include in your web page. Before you start, you'll need to have [Node.js](https://nodejs.org) installed. Flocking supports the latest Node.js LTS release. Once you've installed it, you simply need to install Flocking's depedencies and then run _grunt_.
8 |
9 | Install grunt and related dependencies:
10 |
11 | npm install -g grunt-cli
12 | npm install
13 |
14 | To make a build, simply run:
15 |
16 | grunt
17 |
18 | And then link to the Flocking file in your HTML:
19 |
20 |
21 |
22 | Description of Each Build
23 | --------------------------
24 |
25 |
Filename | 28 |Description | 29 |
---|---|
flocking-all.js |
32 | All of Flocking and all its dependencies. Use this file if you're not using a module loader and want a simple way to link Flocking into your web page. 33 | |
flocking-no-jquery.js |
36 | All of Flocking's dependencies except jQuery. This build is CommonJS/AMD/CMD/whatever module system friendly. 37 | |
flocking-base.js |
40 | This build doesn't include include any view-related code whatsoever. 41 | You must provide your own builds of Infusion and jQuery. 42 | It also does not contain any unit generators beyond the basic set. Use this if you want to choose which unit generators to ship with your application, and if you don't intend to use 43 | Flocking's UI components, Infusion Views, or jQuery for access to the DOM. This build is also not compatible with browser-based module loaders. 44 | |
flock.ugen.playBuffer
. This only seems to be an issue when the speed
input is set to 1.0
; a value of, say, 0.999999
causes the playback to be normal. Converting the AIFF file to WAVE format, even at the same sample rate, also does not exhibit the issue.
2 |
--------------------------------------------------------------------------------
/tests/manual/aiff-playback-11Khz/hockey.aiff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lichen-community-systems/Flocking/0b023ea4bfbf5ef3c089f2f1736ad9910d912f7b/tests/manual/aiff-playback-11Khz/hockey.aiff
--------------------------------------------------------------------------------
/tests/manual/aiff-playback-11Khz/hockey.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lichen-community-systems/Flocking/0b023ea4bfbf5ef3c089f2f1736ad9910d912f7b/tests/manual/aiff-playback-11Khz/hockey.wav
--------------------------------------------------------------------------------
/tests/manual/aiff-playback-11Khz/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |