Created
August 9, 2023 14:39
-
-
Save sletz/da3d3fd6e41346ebaa772f07c4d28a0d to your computer and use it in GitHub Desktop.
Faust RNBO MIDI example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"patcher": { | |
"fileversion": 1, | |
"appversion": { | |
"major": 8, | |
"minor": 5, | |
"revision": 5, | |
"architecture": "x64", | |
"modernui": 1 | |
}, | |
"classnamespace": "box", | |
"rect": [ | |
85.0, | |
104.0, | |
640.0, | |
480.0 | |
], | |
"bglocked": 0, | |
"openinpresentation": 0, | |
"default_fontsize": 12.0, | |
"default_fontface": 0, | |
"default_fontname": "Arial", | |
"gridonopen": 1, | |
"gridsize": [ | |
15.0, | |
15.0 | |
], | |
"gridsnaponopen": 1, | |
"objectsnaponopen": 1, | |
"statusbarvisible": 2, | |
"toolbarvisible": 1, | |
"lefttoolbarpinned": 0, | |
"toptoolbarpinned": 0, | |
"righttoolbarpinned": 0, | |
"bottomtoolbarpinned": 0, | |
"toolbars_unpinned_last_save": 0, | |
"tallnewobj": 0, | |
"boxanimatetime": 200, | |
"enablehscroll": 1, | |
"enablevscroll": 1, | |
"devicewidth": 0.0, | |
"description": "", | |
"digest": "", | |
"tags": "", | |
"style": "", | |
"subpatcher_template": "", | |
"assistshowspatchername": 0, | |
"boxes": [ | |
{ | |
"box": { | |
"id": "obj-1", | |
"maxclass": "comment", | |
"numinlets": 0, | |
"numoutlets": 1, | |
"patching_rect": [ | |
50.0, | |
10.0, | |
350.0, | |
100.0 | |
], | |
"text": "Faust generated RNBO patch, Copyright (c) 2023 Grame", | |
"fontsize": 16 | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-2", | |
"maxclass": "newobj", | |
"numinlets": 2, | |
"numoutlets": 4, | |
"patching_rect": [ | |
48.0, | |
48.0, | |
66.0, | |
22.0 | |
], | |
"patcher": { | |
"fileversion": 1, | |
"appversion": { | |
"major": 8, | |
"minor": 5, | |
"revision": 5, | |
"architecture": "x64", | |
"modernui": 1 | |
}, | |
"classnamespace": "rnbo", | |
"rect": [ | |
85.0, | |
104.0, | |
640.0, | |
480.0 | |
], | |
"bglocked": 0, | |
"openinpresentation": 0, | |
"default_fontsize": 12.0, | |
"default_fontface": 0, | |
"default_fontname": "Arial", | |
"gridonopen": 1, | |
"gridsize": [ | |
15.0, | |
15.0 | |
], | |
"gridsnaponopen": 1, | |
"objectsnaponopen": 1, | |
"statusbarvisible": 2, | |
"toolbarvisible": 1, | |
"lefttoolbarpinned": 0, | |
"toptoolbarpinned": 0, | |
"righttoolbarpinned": 0, | |
"bottomtoolbarpinned": 0, | |
"toolbars_unpinned_last_save": 0, | |
"tallnewobj": 0, | |
"boxanimatetime": 200, | |
"enablehscroll": 1, | |
"enablevscroll": 1, | |
"devicewidth": 0.0, | |
"description": "", | |
"digest": "", | |
"tags": "", | |
"style": "", | |
"subpatcher_template": "", | |
"assistshowspatchername": 0, | |
"boxes": [ | |
{ | |
"box": { | |
"id": "obj-1", | |
"maxclass": "codebox~", | |
"numinlets": 0, | |
"numoutlets": 1, | |
"patching_rect": [ | |
500.0, | |
500.0, | |
400.0, | |
200.0 | |
], | |
"code": "// Code generated with Faust version 2.66.2\r\n// Compilation options: -lang codebox -ct 1 -es 1 -mcd 16 -double -ftz 0 \r\n// Additional functions\r\nfunction faust_rint(x) {\r\n\t let i : Int = trunc(x); \r\n\t let f : number = x - i; \r\n\t let odd : Int = abs(i % 2) >= 1; \r\n\t let even : Int = odd == 0; \r\n\t let a : number = (x > 0) * (((f > 0.5) * even) + ((f >= 0.5) * odd)); \r\n\t let b : number = (x < 0) * (((f < -0.5) * even) + ((f <= -0.5) * odd)); \r\n\t return i + (a - b); \r\n} \r\n// Params\r\n@param({min: 0.0, max: 1.0}) volume = 0.5;\r\n// Globals\r\n// Fields\r\n@state fVslider0_cb : number = 0;\r\n@state fSampleRate_cb : Int = 0;\r\n@state fUpdated : Int = 0;\r\n@state fControl_cb = new FixedDoubleArray(1);\r\n// Init\r\nfunction dspsetup() {\r\n\tfUpdated = true;\r\n\tfVslider0_cb = 0.5;\r\n\tfSampleRate_cb = samplerate();\r\n}\r\n// Control\r\nfunction control() {\r\n\tfControl_cb[0] = fVslider0_cb;\r\n}\r\n// Update parameters\r\nfunction update(volume) {\r\n\tfUpdated = int(fUpdated) | (volume != fVslider0_cb); fVslider0_cb = volume;\r\n\tif (fUpdated) { fUpdated = false; control(); }\r\n}\r\n// Compute one frame\r\nfunction compute(i0) {\r\n\tinput0_cb = i0;\r\n\toutput0_cb = (fControl_cb[0] * input0_cb);\r\n\treturn [output0_cb];\r\n}\r\n// Update parameters\r\nupdate(volume);\r\n// Compute one frame\r\noutputs = compute(in1);\r\n// Write the outputs\r\nout1 = outputs[0];\r\n", | |
"outlettype": [ | |
"" | |
], | |
"rnbo_classname": "codebox~", | |
"rnbo_extra_attributes": { | |
"code": "// Code generated with Faust version 2.66.2\r\n// Compilation options: -lang codebox -ct 1 -es 1 -mcd 16 -double -ftz 0 \r\n// Additional functions\r\nfunction faust_rint(x) {\r\n\t let i : Int = trunc(x); \r\n\t let f : number = x - i; \r\n\t let odd : Int = abs(i % 2) >= 1; \r\n\t let even : Int = odd == 0; \r\n\t let a : number = (x > 0) * (((f > 0.5) * even) + ((f >= 0.5) * odd)); \r\n\t let b : number = (x < 0) * (((f < -0.5) * even) + ((f <= -0.5) * odd)); \r\n\t return i + (a - b); \r\n} \r\n// Params\r\n@param({min: 0.0, max: 1.0}) volume = 0.5;\r\n// Globals\r\n// Fields\r\n@state fVslider0_cb : number = 0;\r\n@state fSampleRate_cb : Int = 0;\r\n@state fUpdated : Int = 0;\r\n@state fControl_cb = new FixedDoubleArray(1);\r\n// Init\r\nfunction dspsetup() {\r\n\tfUpdated = true;\r\n\tfVslider0_cb = 0.5;\r\n\tfSampleRate_cb = samplerate();\r\n}\r\n// Control\r\nfunction control() {\r\n\tfControl_cb[0] = fVslider0_cb;\r\n}\r\n// Update parameters\r\nfunction update(volume) {\r\n\tfUpdated = int(fUpdated) | (volume != fVslider0_cb); fVslider0_cb = volume;\r\n\tif (fUpdated) { fUpdated = false; control(); }\r\n}\r\n// Compute one frame\r\nfunction compute(i0) {\r\n\tinput0_cb = i0;\r\n\toutput0_cb = (fControl_cb[0] * input0_cb);\r\n\treturn [output0_cb];\r\n}\r\n// Update parameters\r\nupdate(volume);\r\n// Compute one frame\r\noutputs = compute(in1);\r\n// Write the outputs\r\nout1 = outputs[0];\r\n", | |
"hot": 0 | |
} | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-2", | |
"maxclass": "newobj", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
48.0, | |
48.0, | |
66.0, | |
22.0 | |
], | |
"text": "in~ 1", | |
"outlettype": [ | |
"" | |
], | |
"rnbo_classname": "in~" | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-3", | |
"maxclass": "newobj", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
192.0, | |
48.0, | |
66.0, | |
22.0 | |
], | |
"text": "out~ 1", | |
"outlettype": [ | |
"" | |
], | |
"rnbo_classname": "out~" | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-4", | |
"maxclass": "newobj", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
336.0, | |
48.0, | |
66.0, | |
22.0 | |
], | |
"text": "set volume", | |
"outlettype": [ | |
"" | |
], | |
"rnbo_classname": "set" | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-5", | |
"maxclass": "newobj", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
480.0, | |
48.0, | |
66.0, | |
22.0 | |
], | |
"text": "param volume 0.5 @min 0 @max 1", | |
"outlettype": [ | |
"" | |
], | |
"rnbo_classname": "param" | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-6", | |
"maxclass": "newobj", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
48.0, | |
120.0, | |
66.0, | |
22.0 | |
], | |
"text": "ctlin 7", | |
"outlettype": [ | |
"" | |
], | |
"rnbo_classname": "ctlin" | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-7", | |
"maxclass": "newobj", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
192.0, | |
120.0, | |
66.0, | |
22.0 | |
], | |
"text": "scale 0 127 0 1", | |
"outlettype": [ | |
"" | |
], | |
"rnbo_classname": "scale" | |
} | |
} | |
], | |
"lines": [ | |
{ | |
"patchline": { | |
"source": [ | |
"obj-2", | |
0 | |
], | |
"destination": [ | |
"obj-1", | |
0 | |
], | |
"order": 0 | |
} | |
}, | |
{ | |
"patchline": { | |
"source": [ | |
"obj-1", | |
0 | |
], | |
"destination": [ | |
"obj-3", | |
0 | |
], | |
"order": 0 | |
} | |
}, | |
{ | |
"patchline": { | |
"source": [ | |
"obj-5", | |
0 | |
], | |
"destination": [ | |
"obj-4", | |
0 | |
], | |
"order": 0 | |
} | |
}, | |
{ | |
"patchline": { | |
"source": [ | |
"obj-4", | |
0 | |
], | |
"destination": [ | |
"obj-1", | |
0 | |
], | |
"order": 0 | |
} | |
}, | |
{ | |
"patchline": { | |
"source": [ | |
"obj-6", | |
0 | |
], | |
"destination": [ | |
"obj-7", | |
0 | |
], | |
"order": 0 | |
} | |
}, | |
{ | |
"patchline": { | |
"source": [ | |
"obj-7", | |
0 | |
], | |
"destination": [ | |
"obj-4", | |
0 | |
], | |
"order": 0 | |
} | |
}, | |
{ | |
"patchline": { | |
"source": [ | |
"obj-4", | |
0 | |
], | |
"destination": [ | |
"obj-2", | |
1 | |
], | |
"order": 0 | |
} | |
} | |
], | |
"parameters": {}, | |
"dependency_cache": [], | |
"autosave": 0 | |
}, | |
"text": "rnbo~", | |
"outlettype": [ | |
"" | |
], | |
"title": "midi", | |
"saved_object_attributes": { | |
"optimization": "O3", | |
"title": "midi", | |
"dumpoutlet": 1 | |
}, | |
"inletInfo": { | |
"IOInfo": [ | |
{ | |
"comment": "", | |
"index": 1, | |
"tag": "in1", | |
"type": "signal" | |
}, | |
{ | |
"comment": "", | |
"index": 2, | |
"tag": "in2", | |
"type": "signal" | |
} | |
] | |
}, | |
"outletInfo": { | |
"IOInfo": [ | |
{ | |
"comment": "", | |
"index": 1, | |
"tag": "out1", | |
"type": "signal" | |
}, | |
{ | |
"comment": "", | |
"index": 2, | |
"tag": "out2", | |
"type": "signal" | |
}, | |
{ | |
"comment": "", | |
"index": 3, | |
"tag": "out3", | |
"type": "signal" | |
}, | |
{ | |
"comment": "", | |
"index": 4, | |
"tag": "out4", | |
"type": "signal" | |
} | |
] | |
} | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-3", | |
"maxclass": "attrui", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
192.0, | |
48.0, | |
66.0, | |
22.0 | |
], | |
"text": "attrui", | |
"outlettype": [ | |
"" | |
], | |
"attr": "volume", | |
"minimum": 0, | |
"maximum": 1, | |
"parameter_enable": 1, | |
"saved_attribute_attributes": { | |
"valueof": { | |
"parameter_initial": [ | |
"volume", | |
0.5 | |
], | |
"parameter_initial_enable": 1 | |
} | |
} | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-4", | |
"maxclass": "newobj", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
336.0, | |
48.0, | |
66.0, | |
22.0 | |
], | |
"text": "midiin", | |
"outlettype": [ | |
"" | |
] | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-5", | |
"maxclass": "toggle", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
480.0, | |
48.0, | |
24.0, | |
24.0 | |
], | |
"text": "toggle", | |
"outlettype": [ | |
"" | |
] | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-6", | |
"maxclass": "newobj", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
48.0, | |
120.0, | |
66.0, | |
22.0 | |
], | |
"text": "dac~ 1", | |
"outlettype": [ | |
"" | |
] | |
} | |
}, | |
{ | |
"box": { | |
"id": "obj-7", | |
"maxclass": "newobj", | |
"numinlets": 1, | |
"numoutlets": 1, | |
"patching_rect": [ | |
192.0, | |
120.0, | |
66.0, | |
22.0 | |
], | |
"text": "adc~ 1", | |
"outlettype": [ | |
"" | |
] | |
} | |
} | |
], | |
"lines": [ | |
{ | |
"patchline": { | |
"source": [ | |
"obj-3", | |
0 | |
], | |
"destination": [ | |
"obj-2", | |
0 | |
], | |
"order": 0 | |
} | |
}, | |
{ | |
"patchline": { | |
"source": [ | |
"obj-5", | |
0 | |
], | |
"destination": [ | |
"obj-6", | |
0 | |
], | |
"order": 0 | |
} | |
}, | |
{ | |
"patchline": { | |
"source": [ | |
"obj-2", | |
0 | |
], | |
"destination": [ | |
"obj-6", | |
0 | |
], | |
"order": 0 | |
} | |
}, | |
{ | |
"patchline": { | |
"source": [ | |
"obj-7", | |
0 | |
], | |
"destination": [ | |
"obj-2", | |
0 | |
], | |
"order": 0 | |
} | |
} | |
], | |
"parameters": {}, | |
"dependency_cache": [], | |
"autosave": 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment