Copy from Alexandre repository

This commit is contained in:
fls 2026-09-17 18:13:02 -03:00
commit 355594d3c8
102 changed files with 5948 additions and 0 deletions

View File

@ -0,0 +1,33 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "brackground",
"language": "javascript",
"extension": "webaudio",
"help": "Change Background color",
"label": "Background",
"color": "50:150:0:150",
"group": "GUI",
"codes": {
"declaration": "\nvar $port[rgb]$ = function(value){\n document.body.style.backgroundColor = value;\n return true;\n };\n",
"onload": "\n$port[rgb]$('$prop[color]$');\n\n"
},
"properties": [
{
"name": "color",
"label": "Color",
"value": "#F00",
"format": "FF00FF",
"type": "Color"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.color",
"name": "rgb",
"conn_type": "Input",
"label": "RGB COlor"
}
]
}

42
blocks/GUI/button.json Normal file
View File

@ -0,0 +1,42 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "button",
"language": "javascript",
"extension": "webaudio",
"help": "Button",
"label": "Button",
"color": "50:150:250:150",
"group": "GUI",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar block_$id$_value = $prop[value]$;\nvar $port[click]$ = [];\n",
"execution": "\nfunction click$id$(){\n value = document.getElementById(\"block_$id$\").value;\n for (var i = 0; i < $port[click]$.length ; i++){\n $port[click]$[i](value);\n }\n};\n",
"html": "\n<button type=\"button\" value=\"$prop[value]$\" onClick=\"click$id$();\"\nid=\"block_$id$\">$prop[label]$</button><br>\n"
},
"properties": [
{
"name": "value",
"label": "Value",
"type": "Float",
"lower": 0,
"upper": 20000,
"step": 1,
"value": 1
},
{
"name": "label",
"label": "Label",
"type": "String",
"value": "Label"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Click",
"conn_type": "Output",
"name": "click"
}
]
}

45
blocks/GUI/check.json Normal file
View File

@ -0,0 +1,45 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "check",
"language": "javascript",
"extension": "webaudio",
"help": "Check",
"label": "Check",
"color": "50:150:250:150",
"group": "GUI",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[value]$ = [];\n\nvar $port[invalue]$ = function(value){\n if (value)\n document.getElementById(\"block_$id$\").checked = true;\n else\n document.getElementById(\"block_$id$\").checked = false;\n return true;\n };\n\n",
"execution": "\nfunction change_value$id$(e){\n value = document.getElementById(\"block_$id$\").checked;\n for (var i = 0; i < $port[value]$.length ; i++){\n if (value)\n $port[value]$[i](1);\n else\n $port[value]$[i](0);\n }\n};\n",
"html": "\n<input type=\"checkbox\" onchange=\"change_value$id$(event);\" id=\"block_$id$\"> $prop[label]$ <br>\n"
},
"properties": [
{
"name": "value",
"label": "Value",
"type": "Float",
"value": "0"
},
{
"name": "label",
"label": "Label",
"type": "String",
"value": "Label"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Value",
"conn_type": "Output",
"name": "value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Value",
"conn_type": "Input",
"name": "invalue"
}
]
}

45
blocks/GUI/color.json Normal file
View File

@ -0,0 +1,45 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "color",
"language": "javascript",
"extension": "webaudio",
"help": "Color",
"label": "Color",
"color": "50:150:0:150",
"group": "GUI",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[value]$ = [];\n\nvar $port[invalue]$ = function(value){\n document.getElementById(\"block_$id$\").value = value;\n return true;\n };\n\n",
"execution": "\nfunction enter_value$id$(e){\n value = document.getElementById(\"block_$id$\").value;\n for (var i = 0; i < $port[value]$.length ; i++){\n $port[value]$[i](value);\n }\n};\n",
"html": "\n$prop[label]$ <input type=\"color\" value=\"$prop[value]$\" oninput=\"enter_value$id$(event);\" id=\"block_$id$\"><br>\n"
},
"properties": [
{
"name": "value",
"label": "Value",
"type": "Color",
"value": "#FFFFFF"
},
{
"name": "label",
"label": "Label",
"type": "String",
"value": "Label"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.color",
"label": "Value",
"conn_type": "Output",
"name": "value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.color",
"label": "Value",
"conn_type": "Input",
"name": "invalue"
}
]
}

44
blocks/GUI/freqbar.json Normal file
View File

@ -0,0 +1,44 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "freqbar",
"language": "javascript",
"extension": "webaudio",
"help": "Freq Bar",
"label": "Freq Bar",
"color": "150:050:050:150",
"group": "GUI",
"codes": {
"onload": "draw_freqbar$id$();",
"declaration": "\n// block_$id$ = $label$\nvar block_$id$ = context.createAnalyser();\nblock_$id$.fftSize = 256;\nvar $port[input]$ = block_$id$;\n",
"execution": "\nfunction draw_freqbar$id$(){\n var canvas = document.getElementById(\"canvas$id$\");\n var canvasCtx = canvas.getContext(\"2d\");\n var bufferLength = 64;\n var dataArray = new Uint8Array(bufferLength);\n var bufferLengthAlt = block_$id$.frequencyBinCount;\n\n canvasCtx.clearRect(0, 0, canvas.width, canvas.height);\n canvasCtx.lineWidth = 2;\n canvasCtx.strokeStyle = 'rgb(0, 0, 0)';\n\n block_$id$.getByteFrequencyData(dataArray);\n\n canvasCtx.clearRect(0, 0, canvas.width, canvas.height);\n canvasCtx.beginPath();\n\n\n var barWidth = (canvas.width / bufferLengthAlt) * 2.5;\n var barHeight;\n var x = 0;\n\n for(var i = 0; i < bufferLengthAlt; i++) {\n barHeight = dataArray[i];\n canvasCtx.fillStyle = 'rgb(' + (barHeight+100) + ',50,50)';\n canvasCtx.fillRect(x, canvas.height - barHeight/2, barWidth, barHeight/2);\n x += barWidth + 1;\n }\n canvasCtx.stroke();\n drawVisual = requestAnimationFrame(draw_freqbar$id$);\n}\n",
"html": "\n<canvas id=\"canvas$id$\" class=\"visualizer\" width=\"$prop[width]$\" height=\"$prop[height]$\"></canvas>\n"
},
"properties": [
{
"name": "width",
"label": "Width",
"type": "Float",
"lower": 0,
"upper": 32000,
"value": 640
},
{
"name": "height",
"label": "Height",
"type": "Float",
"lower": 0,
"upper": 32000,
"value": 240
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Input",
"name": "input"
}
]
}

63
blocks/GUI/number.json Normal file
View File

@ -0,0 +1,63 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "number",
"language": "javascript",
"extension": "webaudio",
"help": "Number",
"label": "Number",
"color": "50:150:250:150",
"group": "GUI",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[value]$ = [];\n\nvar $port[invalue]$ = function(value){\n document.getElementById(\"block_$id$\").value = value;\n return true;\n };\n\n",
"execution": "\nfunction change_value$id$(e){\n value = document.getElementById(\"block_$id$\").value;\n for (var i = 0; i < $port[value]$.length ; i++){\n $port[value]$[i](value);\n }\n};\n",
"html": "\n$prop[label]$ <input type=\"number\" min=\"$prop[min]$\" max=\"$prop[max]$\" onchange=\"change_value$id$(event);\" id=\"block_$id$\"><br>\n"
},
"properties": [
{
"name": "value",
"label": "Value",
"type": "Float",
"value": "0"
},
{
"name": "label",
"label": "Label",
"type": "String",
"value": "Label"
},
{
"name": "min",
"label": "Min",
"type": "Float",
"lower": 0,
"upper": 20000,
"step": 1,
"value": 0
},
{
"name": "max",
"label": "Max",
"type": "Float",
"lower": 0,
"upper": 20000,
"step": 1,
"value": 100
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Value",
"conn_type": "Output",
"name": "value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Value",
"conn_type": "Input",
"name": "invalue"
}
]
}

62
blocks/GUI/print.json Normal file
View File

@ -0,0 +1,62 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "print",
"language": "javascript",
"extension": "webaudio",
"help": "Print value",
"label": "Print",
"color": "50:150:250:150",
"group": "GUI",
"codes": {
"declaration": "\n// $label$\nvar $port[float_value]$ = function(value){\n document.getElementById(\"block_$id$\").innerHTML = value;\n return true;\n };\n\nvar $port[char_value]$ = function(value){\n document.getElementById(\"block_$id$\").innerHTML = value;\n return true;\n };\n\nvar $port[color_value]$ = function(value){\n document.getElementById(\"block_$id$\").innerHTML = value;\n return true;\n };\n\nvar $port[string_value]$ = function(value){\n document.getElementById(\"block_$id$\").innerHTML = value;\n return true;\n };\n\nvar $port[point_value]$ = function(value){\n document.getElementById(\"block_$id$\").innerHTML = \"(\"+value+\")\";\n return true;\n };\n \nvar $port[bool_value]$ = function(value){\n document.getElementById(\"block_$id$\").innerHTML = \"(\"+value+\")\";\n return true;\n }; \n",
"html": "\n$prop[label]$ <span id=\"block_$id$\"></span><br>\n"
},
"properties": [
{
"name": "label",
"label": "Label",
"value": "Label",
"type": "String"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "float_value",
"conn_type": "Input",
"label": "Float Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.char",
"conn_type": "Input",
"name": "char_value",
"label": "Char Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.color",
"conn_type": "Input",
"name": "color_value",
"label": "Color Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.string",
"conn_type": "Input",
"name": "string_value",
"label": "String Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.point",
"conn_type": "Input",
"name": "point_value",
"label": "Point Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"conn_type": "Input",
"name": "bool_value",
"label": "Bool Value"
}
]
}

63
blocks/GUI/range.json Normal file
View File

@ -0,0 +1,63 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "range",
"language": "javascript",
"extension": "webaudio",
"help": "Range",
"label": "Range",
"color": "50:150:250:150",
"group": "GUI",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[value]$ = [];\n\nvar $port[invalue]$ = function(value){\n document.getElementById(\"block_$id$\").value = value;\n change_value$id$(value);\n return true;\n };\n\n",
"execution": "\nfunction change_value$id$(e){\n value = document.getElementById(\"block_$id$\").value;\n for (var i = 0; i < $port[value]$.length ; i++){\n $port[value]$[i](value);\n }\n};\n",
"html": "\n$prop[label]$ <input type=\"range\" min=\"$prop[min]$\" max=\"$prop[max]$\" onchange=\"change_value$id$(event);\" id=\"block_$id$\"><br>\n"
},
"properties": [
{
"name": "value",
"label": "Value",
"type": "Float",
"value": "0"
},
{
"name": "label",
"label": "Label",
"type": "String",
"value": "Label"
},
{
"name": "min",
"label": "Min",
"type": "Float",
"lower": 0,
"upper": 20000,
"step": 1,
"value": 0
},
{
"name": "max",
"label": "Max",
"type": "Float",
"lower": 0,
"upper": 20000,
"step": 1,
"value": 100
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Value",
"conn_type": "Output",
"name": "value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Value",
"conn_type": "Input",
"name": "invalue"
}
]
}

47
blocks/GUI/select.json Normal file
View File

@ -0,0 +1,47 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "select",
"language": "javascript",
"extension": "webaudio",
"help": "Select",
"label": "Select",
"color": "50:150:250:150",
"group": "GUI",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[str_value]$ = [];\nvar $port[float_value]$ = [];\n",
"function": "\nfunction populateCombo(combo, text_values){\n var values = text_values.split(',');\n for (var i = 0 ; i < values.length ; i++){\n var c = document.createElement(\"option\");\n c.text = values[i];\n combo.options.add(c, combo.options.length);\n }\n }\n",
"onload": "populateCombo(document.getElementById('block_$id$'), '$prop[values]$');",
"execution": "\nfunction change$id$(){\n el = document.getElementById(\"block_$id$\");\n value = el.options[el.selectedIndex].value;\n for (var i = 0; i < $port[str_value]$.length ; i++){\n $port[str_value]$[i](value);\n }\n for (var i = 0; i < $port[float_value]$.length ; i++){\n $port[float_value]$[i](el.selectedIndex);\n }\n};\n",
"html": "\n$prop[label]$ <select onchange=\"change$id$();\" id=\"block_$id$\"></select><br>\n"
},
"properties": [
{
"name": "label",
"label": "Label",
"type": "String",
"value": "Label"
},
{
"name": "values",
"label": "Values",
"type": "String",
"value": "values"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.string",
"label": "String Value",
"conn_type": "Output",
"name": "str_value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Float Value",
"conn_type": "Output",
"name": "float_value"
}
]
}

44
blocks/GUI/sinewave.json Normal file
View File

@ -0,0 +1,44 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "sinewave",
"language": "javascript",
"extension": "webaudio",
"help": "Sine Wave",
"label": "Sine Wave",
"color": "150:050:050:150",
"group": "GUI",
"codes": {
"onload": "draw_sinewave$id$();",
"declaration": "\n// block_$id$ = $label$\nvar block_$id$ = context.createAnalyser();\nvar $port[input]$ = block_$id$;\n",
"execution": "\nfunction draw_sinewave$id$(){\n var canvas = document.getElementById(\"canvas$id$\");\n var canvasCtx = canvas.getContext(\"2d\");\n var bufferLength = 64;\n var dataArray = new Uint8Array(bufferLength);\n\n canvasCtx.clearRect(0, 0, canvas.width, canvas.height);\n canvasCtx.lineWidth = 2;\n canvasCtx.strokeStyle = 'rgb(0, 0, 0)';\n\n block_$id$.getByteTimeDomainData(dataArray);\n\n canvasCtx.clearRect(0, 0, canvas.width, canvas.height);\n canvasCtx.beginPath();\n\n var sliceWidth = canvas.width * 1.0 / bufferLength;\n var x = 0;\n\n for(var i = 0; i < bufferLength; i++) {\n\n var v = dataArray[i] / 128.0;\n var y = v * canvas.height/2;\n\n if(i === 0) {\n canvasCtx.moveTo(x, y);\n } else {\n canvasCtx.lineTo(x, y);\n }\n\n x += sliceWidth;\n }\n\n canvasCtx.stroke();\n drawVisual = requestAnimationFrame(draw_sinewave$id$);\n}\n",
"html": "\n<canvas id=\"canvas$id$\" class=\"visualizer\" width=\"$prop[width]$\" height=\"$prop[height]$\"></canvas>\n"
},
"properties": [
{
"name": "width",
"label": "Width",
"type": "Float",
"lower": 0,
"upper": 32000,
"value": 640
},
{
"name": "height",
"label": "Height",
"type": "Float",
"lower": 0,
"upper": 32000,
"value": 240
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Input",
"name": "input"
}
]
}

View File

@ -0,0 +1,26 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "spectrogram",
"language": "javascript",
"extension": "webaudio",
"help": "Spectrogram",
"label": "Spectrogram",
"color": "150:150:250:150",
"group": "GUI",
"codes": {
"onload": "\n(function () {\n function SpectrogramVisualizer(audioContext, canvasElement) {\n this.analyserNode = audioContext.createAnalyser();\n this.analyserNode.fftSize = 8192;\n this.fftData = new Float32Array(this.analyserNode.frequencyBinCount);\n\n this.graphicWidth = parseInt(getComputedStyle(canvasElement).width, 10);\n this.graphicHeight = parseInt(getComputedStyle(canvasElement).height, 10);\n\n var gc = this.graphicContext = canvasElement.getContext(\"2d\");\n gc.fillStyle = '#000000';\n\n this.pixel = gc.createImageData(1,1);\n this.pixel.data[3] = 255;\n\n this.gain = 0;\n this.stopping = false;\n\n this.draw();\n }\n\n SpectrogramVisualizer.prototype.acceptConnection = function (connectedNode) {\n connectedNode.connect(this.analyserNode);\n this.connectedNode = connectedNode;\n };\n\n SpectrogramVisualizer.prototype.draw = function () {\n if (this.stopping) {\n this.stopping = false;\n return;\n }\n\n var gc = this.graphicContext;\n var gw = this.graphicWidth;\n var gh = this.graphicHeight;\n\n if (!this.connectedNode) {\n gc.fillRect(0, 0, gw, gh);\n }\n else {\n var slideImage = gc.getImageData(0, 0, gw - 1, gh);\n gc.putImageData(slideImage, 1, 0);\n\n var i, y, n;\n\n this.analyserNode.getFloatFrequencyData(this.fftData);\n\n for (i = 0; i < gh; ++i) {\n n = Math.min(Math.max((this.fftData[i] + this.gain + 80) * 4, 0), 255);\n this.pixel.data[0] = n;\n this.pixel.data[1] = n;\n this.pixel.data[2] = n;\n gc.putImageData(this.pixel, 0, gh - i);\n }\n }\n\n this.animationHandle = requestAnimationFrame(function () { this.draw(); }.bind(this));\n };\n\n SpectrogramVisualizer.prototype.releaseConnection = function () {\n this.connectedNode.disconnect(this.analyserNode);\n delete this.connectedNode;\n };\n\n SpectrogramVisualizer.prototype.stop = function () {\n this.stopping = true;\n };\n\n window.App = window.App || {};\n window.App.SpectrogramVisualizer = SpectrogramVisualizer;\n})();\n\n(function () {\n var visCanvas_$id$ = document.getElementById('spectrogram_$id$')\n var visualizer_$id$ = new App.SpectrogramVisualizer(context, visCanvas_$id$);\n visualizer_$id$.gain = 1;\n visualizer_$id$.acceptConnection(block_$id$);\n})();\n",
"declaration": "\nvar block_$id$ = context.createGain();\nblock_$id$.gain = 1;\nvar $port[input]$ = block_$id$;\n",
"html": "\n<h2>SpectrogramVisualizer_Block$id$</h2>\n<div>\n <canvas id=\"spectrogram_$id$\" width=\"1024\" height=\"300\"></canvas>\n</div>\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Input",
"conn_type": "Input",
"name": "input"
}
]
}

45
blocks/GUI/text.json Normal file
View File

@ -0,0 +1,45 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "text",
"language": "javascript",
"extension": "webaudio",
"help": "Text",
"label": "Text",
"color": "50:150:250:150",
"group": "GUI",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[value]$ = [];\n\nvar $port[invalue]$ = function(value){\n document.getElementById(\"block_$id$\").value = value;\n return true;\n };\n\n",
"execution": "\nfunction enter_value$id$(e){\n e = e || window.event;\n if (e.keyCode != 13) //Ignore if it is not enter\n return;\n value = document.getElementById(\"block_$id$\").value;\n for (var i = 0; i < $port[value]$.length ; i++){\n $port[value]$[i](value);\n }\n};\n",
"html": "\n$prop[label]$ <input type=\"text\" value=\"$prop[value]$\" onkeypress=\"enter_value$id$(event);\"\nid=\"block_$id$\"><br>\n"
},
"properties": [
{
"name": "value",
"label": "Value",
"type": "String",
"value": ""
},
{
"name": "label",
"label": "Label",
"type": "String",
"value": "Label"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.string",
"label": "Value",
"conn_type": "Output",
"name": "value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.string",
"label": "Value",
"conn_type": "Input",
"name": "invalue"
}
]
}

32
blocks/GUI/title.json Normal file
View File

@ -0,0 +1,32 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "title",
"language": "javascript",
"extension": "webaudio",
"help": "Window Title",
"label": "Title",
"color": "50:150:250:150",
"group": "GUI",
"codes": {
"declaration": "\nvar $port[title]$ = function(value){\n window.document.title = value;\n return 1;\n}\n",
"onload": "\n$port[title]$('$prop[title]$');\n \n"
},
"properties": [
{
"name": "title",
"label": "Value",
"type": "String",
"value": "Mosaicode - Document Title"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.string",
"label": "Value",
"conn_type": "Input",
"name": "title"
}
]
}

31
blocks/MIDI/MIDI.json Normal file
View File

@ -0,0 +1,31 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "midi",
"language": "javascript",
"extension": "webaudio",
"help": "MIDI",
"label": "MIDI",
"color": "250:250:0:150",
"group": "MIDI",
"codes": {
"function": "\n// request MIDI access\n\nif (navigator.requestMIDIAccess) {\n navigator.requestMIDIAccess({sysex: false}).then(MidiSuccess, MidiFailure);\n} else {\n alert(\"No MIDI support in your browser.\");\n}\n\n// midi functions\nfunction MidiSuccess(midi) {\n // when we get a succesful response, run this code\n console.log('MIDI Access Object', midi);\n var inputs = midi.inputs.values();\n\n for (var input = inputs.next(); input && !input.done; input = inputs.next()) {\n // each time there is a midi message call the onMIDIMessage function\n input.value.onmidimessage = MidiMessage;\n }\n}\n\nfunction MidiFailure(e) {\n // when we get a failed response, run this code\n message = \"No access to MIDI devices or your browser doesn't support WebMIDI API. Please use WebMIDIAPIShim \" + e;\n console.log(message);\n alert(message);\n}\n\n// Variable to keep output ports\nvar note_output = [];\nvar control_output = [];\n\nfunction MidiMessage (message) {\n //Note On\n if((message.data[0] == 144 && message.data[2] > 0) ||\n // Note Off\n (message.data[0] === 128 || (message.data[0] == 144 && message.data[2] === 0))\n ){\n for (var i = 0; i < note_output.length ; i++)\n for (var j = 0; j < note_output[i].length ; j++)\n note_output[i][j]([message.data[1],message.data[2]]);\n }\n\n\n //Ctrl\n if (message.data[0] === 176 ){\n for (var i = 0; i < control_output.length ; i++)\n for (var j = 0; j < control_output[i].length ; j++)\n control_output[i][j]([message.data[1],message.data[2]]);\n }\n // Not used\n // (message.data[0] === 176 )//Drum pad\n // (message.data[0] === 208 )//Aftertouch\n}\n\n\n",
"declaration": "\n// block_$id$ = Mouse\nvar $port[note]$ = [];\nvar $port[control]$ = [];\nnote_output.push($port[note]$);\ncontrol_output.push($port[control]$);\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.midi",
"label": "Note",
"conn_type": "Output",
"name": "note"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.midi",
"label": "Control",
"conn_type": "Output",
"name": "control"
}
]
}

View File

@ -0,0 +1,30 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "midi2freq",
"language": "javascript",
"extension": "webaudio",
"help": "midi to freq",
"label": "Midi 2 Freq",
"color": "250:250:0:150",
"group": "MIDI",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[frequency]$ = [];\n\nvar $port[midi_value]$ = function(value){\n value = (value < 0) ? 0 : value;\n value = (value >127) ? 127 : value;\n var arg = ((parseFloat(value) - 69.0) / 12.0);\n result = Math.pow(2.0, arg) * 440.0;\n for (var i = 0; i < $port[frequency]$.length ; i++){\n $port[frequency]$[i](result);\n }\n return true;\n };\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "midi_value",
"conn_type": "Input",
"label": "Midi Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Frequency",
"conn_type": "Output",
"name": "frequency"
}
]
}

View File

@ -0,0 +1,36 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "stripmidi",
"language": "javascript",
"extension": "webaudio",
"help": "Strip Midi",
"label": "Strip Midi",
"color": "250:250:0:150",
"group": "MIDI",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[note]$ = [];\nvar $port[velocity]$ = [];\n\nvar $port[midi_value]$ = function(value){\n for (var i = 0; i < $port[note]$.length ; i++){\n $port[note]$[i](value[0]);\n }\n for (var i = 0; i < $port[note]$.length ; i++){\n $port[velocity]$[i](value[1]);\n }\n return true;\n };\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.midi",
"name": "midi_value",
"conn_type": "Input",
"label": "Midi Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Note",
"conn_type": "Output",
"name": "note"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Velocity",
"conn_type": "Output",
"name": "velocity"
}
]
}

32
blocks/Types/float.json Normal file
View File

@ -0,0 +1,32 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "float",
"language": "javascript",
"extension": "webaudio",
"help": "",
"label": "Float",
"color": "150:50:150:150",
"group": "Types",
"codes": {
"onload": "\nload_float$id$();\n ",
"declaration": "\nvar $port[float_value]$ = [];\n\nfunction load_float$id$(){\n for (var i = 0 ; i < $port[float_value]$.length ; i++)\n $port[float_value]$[i]($prop[float_value]$);\n};\n\n"
},
"properties": [
{
"name": "float_value",
"label": "Value",
"value": "0",
"type": "Float"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Output",
"name": "float_value",
"label": "Value"
}
]
}

62
blocks/Types/point.json Normal file
View File

@ -0,0 +1,62 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "point",
"language": "javascript",
"extension": "webaudio",
"help": "",
"label": "Point",
"color": "150:50:150:150",
"group": "Types",
"codes": {
"onload": "\nload_point$id$();\n ",
"declaration": "\nvar $port[point_value]$ = [];\n\nblock_$id$_x = $prop[x]$;\nblock_$id$_y = $prop[y]$;\nblock_$id$_z = $prop[z]$;\n\nvar $port[x]$ = function(value){\n block_$id$_x = parseFloat(value);\n load_point$id$();\n return true;\n };\n\nvar $port[y]$ = function(value){\n block_$id$_y = parseFloat(value);\n load_point$id$();\n return true;\n }\n\nvar $port[z]$ = function(value){\n block_$id$_z = parseFloat(value);\n load_point$id$();\n return true;\n }\n\nfunction load_point$id$(){\n for (var i = 0 ; i < $port[point_value]$.length ; i++)\n $port[point_value]$[i]([block_$id$_x, block_$id$_y, block_$id$_z]);\n};\n\n"
},
"properties": [
{
"name": "x",
"label": "X",
"value": "0",
"type": "Float"
},
{
"name": "y",
"label": "Y",
"value": "0",
"type": "Float"
},
{
"name": "z",
"label": "Z",
"value": "0",
"type": "Float"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "x",
"conn_type": "Input",
"label": "X"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "y",
"conn_type": "Input",
"label": "Y"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "z",
"conn_type": "Input",
"label": "Z"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.point",
"conn_type": "Output",
"name": "point_value",
"label": "Point Value"
}
]
}

32
blocks/Types/string.json Normal file
View File

@ -0,0 +1,32 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "string",
"language": "javascript",
"extension": "webaudio",
"help": "",
"label": "String",
"color": "150:50:150:150",
"group": "Types",
"codes": {
"onload": "\nload_string$id$();\n ",
"declaration": "\nvar $port[string_value]$ = [];\n\nfunction load_string$id$(){\n for (var i = 0 ; i < $port[string_value]$.length ; i++)\n $port[string_value]$[i]('$prop[string_value]$');\n};\n\n"
},
"properties": [
{
"name": "string_value",
"label": "Value",
"value": "",
"type": "String"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.string",
"conn_type": "Output",
"name": "string_value",
"label": "Value"
}
]
}

View File

@ -0,0 +1,36 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "addfloat",
"language": "javascript",
"extension": "webaudio",
"help": "Add Float",
"label": "Add Float",
"color": "200:200:25:150",
"group": "Arithmetics",
"codes": {
"declaration": "\n// block_$id$ = Add Float\nvar block_$id$_arg1 = 0;\nvar block_$id$_arg2 = 0;\nvar $port[result]$ = [];\n\nvar $port[first_number]$ = function(value){\n block_$id$_arg1 = parseFloat(value);\n result = parseFloat(block_$id$_arg1) + parseFloat(block_$id$_arg2);\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n return true;\n };\n\nvar $port[second_number]$ = function(value){\n block_$id$_arg2 = parseFloat(value);\n result = parseFloat(block_$id$_arg1) + parseFloat(block_$id$_arg2);\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n return true;\n };\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "first_number",
"conn_type": "Input",
"label": "First Number"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "second_number",
"conn_type": "Input",
"label": "Second Number"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Result",
"conn_type": "Output",
"name": "result"
}
]
}

View File

@ -0,0 +1,38 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "and",
"language": "javascript",
"extension": "webaudio",
"help": "Logical Operation AND",
"label": "AND",
"color": "249:229:4:150",
"group": "Arithmetics",
"codes": {
"onload": "\n\n",
"declaration": "\nvar condition_1$id$ = null;\nvar condition_2$id$ = null;\n\nvar $port[output]$ = [];\n\nfunction and$id$() {\n var ret = condition_1$id$ && condition_2$id$; \n for (var i = 0; i < $port[output]$.length ; i++){\n $port[output]$[i](ret);\n }\n return true;\n}\n\nvar $port[condition_1]$ = function(value){\n condition_1$id$ = value;\n and$id$();\n return true;\n};\n\nvar $port[condition_2]$ = function(value){\n condition_2$id$ = value;\n and$id$();\n return true;\n};\n",
"execution": "\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "condition_1",
"label": "Condition 1",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "condition_2",
"label": "Condition 2",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "output",
"label": "Output",
"conn_type": "Output"
}
]
}

View File

@ -0,0 +1,36 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "dividefloat",
"language": "javascript",
"extension": "webaudio",
"help": "Divide Float",
"label": "Divide Float",
"color": "200:200:25:150",
"group": "Arithmetics",
"codes": {
"declaration": "\n// block_$id$ = Divide Float\nvar block_$id$_arg1 = 0;\nvar block_$id$_arg2 = 0;\nvar $port[result]$ = [];\n\nvar $port[first_number]$ = function(value){\n block_$id$_arg1 = parseFloat(value);\n block_$id$_arg2 = (parseFloat(block_$id$_arg2) == 0) ?\n 1 : parseFloat(block_$id$_arg2);\n result = parseFloat(block_$id$_arg1) / parseFloat(block_$id$_arg2);\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n return true;\n };\n\nvar $port[second_number]$ = function(value){\n block_$id$_arg2 = parseFloat(value);\n block_$id$_arg2 = (parseFloat(block_$id$_arg2) == 0) ?\n 1 : parseFloat(block_$id$_arg2);\n result = parseFloat(block_$id$_arg1) / parseFloat(block_$id$_arg2);\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n return true;\n };\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "first_number",
"conn_type": "Input",
"label": "First Number"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Input",
"name": "second_number",
"label": "Second Number"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Result",
"conn_type": "Output",
"name": "result"
}
]
}

View File

@ -0,0 +1,38 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "equals",
"language": "javascript",
"extension": "webaudio",
"help": "Equals (==)",
"label": "Equals To",
"color": "163:01:01:150",
"group": "Arithmetics",
"codes": {
"onload": "\n\n",
"declaration": "\nvar statement_1$id$ = null;\nvar statement_2$id$ = null;\n\nvar $port[output]$ = [];\n\nfunction equalsTo$id$() {\n var ret = statement_1$id$ === statement_2$id$;\n for (var i = 0; i < $port[output]$.length ; i++){\n $port[output]$[i](ret);\n }\n return true;\n}\n\nvar $port[statement_1]$ = function(value){\n statement_1$id$ = Math.round(value);\n equalsTo$id$();\n return true;\n};\n\nvar $port[statement_2]$ = function(value){\n statement_2$id$ = Math.round(value);\n equalsTo$id$();\n return true;\n};\n",
"execution": "\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_1",
"label": "Statement 1",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_2",
"label": "Statement 2",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "output",
"label": "Output",
"conn_type": "Output"
}
]
}

View File

@ -0,0 +1,38 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "greaterthan",
"language": "javascript",
"extension": "webaudio",
"help": "Greater Than (>)",
"label": "Greater Than",
"color": "163:01:01:150",
"group": "Arithmetics",
"codes": {
"onload": "\n\n",
"declaration": "\nvar statement_1$id$ = null;\nvar statement_2$id$ = null;\n\nvar $port[output]$ = [];\n\nfunction greaterThan$id$() {\n var ret = statement_1$id$ > statement_2$id$;\n for (var i = 0; i < $port[output]$.length ; i++){\n $port[output]$[i](ret);\n }\n return true;\n}\n\nvar $port[statement_1]$ = function(value){\n statement_1$id$ = Math.round(value);\n greaterThan$id$();\n return true;\n};\n\nvar $port[statement_2]$ = function(value){\n statement_2$id$ = Math.round(value);\n greaterThan$id$();\n return true;\n};\n",
"execution": "\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_1",
"label": "Statement 1",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_2",
"label": "Statement 2",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "output",
"label": "Output",
"conn_type": "Output"
}
]
}

View File

@ -0,0 +1,38 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "greaterthanorequals",
"language": "javascript",
"extension": "webaudio",
"help": "Greater Than Or Equals (>=)",
"label": "Greater Than Or Equals",
"color": "163:01:01:150",
"group": "Arithmetics",
"codes": {
"onload": "\n\n",
"declaration": "\nvar statement_1$id$ = null;\nvar statement_2$id$ = null;\n\nvar $port[output]$ = [];\n\nfunction greaterThanOrEquals$id$() {\n var ret = statement_1$id$ >= statement_2$id$;\n for (var i = 0; i < $port[output]$.length ; i++){\n $port[output]$[i](ret);\n }\n return true;\n}\n\nvar $port[statement_1]$ = function(value){\n statement_1$id$ = Math.round(value);\n greaterThanOrEquals$id$();\n return true;\n};\n\nvar $port[statement_2]$ = function(value){\n statement_2$id$ = Math.round(value);\n greaterThanOrEquals$id$();\n return true;\n};\n",
"execution": "\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_1",
"label": "Statement 1",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_2",
"label": "Statement 2",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "output",
"label": "Output",
"conn_type": "Output"
}
]
}

View File

@ -0,0 +1,55 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "inc",
"language": "javascript",
"extension": "webaudio",
"help": "Increment",
"label": "Increment",
"color": "150:150:250:150",
"group": "Arithmetics",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar block_$id$_value = $prop[value]$;\nvar block_$id$_step = $prop[step]$;\nvar $port[float]$ = [];\n\nvar $port[count]$ = function(value){\n block_$id$_value += block_$id$_step;\n for (var i = 0; i < $port[float]$.length ; i++){\n $port[float]$[i](block_$id$_value);\n }\n return true;\n };\n\nvar $port[value]$ = function(value){\n block_$id$_value = value;\n return true;\n };\n\n"
},
"properties": [
{
"name": "value",
"label": "Value",
"type": "Float",
"lower": 0,
"upper": 20000,
"step": 1,
"value": 1
},
{
"name": "step",
"label": "Step",
"type": "Float",
"lower": -20000,
"upper": 20000,
"step": 1,
"value": 1
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Float",
"conn_type": "Output",
"name": "float"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Count",
"conn_type": "Input",
"name": "count"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Input",
"label": "Value",
"name": "value"
}
]
}

View File

@ -0,0 +1,38 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "lessthan",
"language": "javascript",
"extension": "webaudio",
"help": "Less Than (<)",
"label": "Less Than",
"color": "163:01:01:150",
"group": "Arithmetics",
"codes": {
"onload": "\n\n",
"declaration": "\nvar statement_1$id$ = null;\nvar statement_2$id$ = null;\n\nvar $port[output]$ = [];\n\nfunction lessThan$id$() {\n var ret = statement_1$id$ < statement_2$id$;\n for (var i = 0; i < $port[output]$.length ; i++){\n $port[output]$[i](ret);\n }\n return true;\n}\n\nvar $port[statement_1]$ = function(value){\n statement_1$id$ = Math.round(value);\n lessThan$id$();\n return true;\n};\n\nvar $port[statement_2]$ = function(value){\n statement_2$id$ = Math.round(value);\n lessThan$id$();\n return true;\n};\n",
"execution": "\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_1",
"label": "Statement 1",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_2",
"label": "Statement 2",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "output",
"label": "Output",
"conn_type": "Output"
}
]
}

View File

@ -0,0 +1,38 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "lessthanorequals",
"language": "javascript",
"extension": "webaudio",
"help": "Less Than Or Equals (<=)",
"label": "Less Than Or Equals",
"color": "163:01:01:150",
"group": "Arithmetics",
"codes": {
"onload": "\n\n",
"declaration": "\nvar statement_1$id$ = null;\nvar statement_2$id$ = null;\n\nvar $port[output]$ = [];\n\nfunction lessThanOrEquals$id$() {\n var ret = statement_1$id$ <= statement_2$id$;\n for (var i = 0; i < $port[output]$.length ; i++){\n $port[output]$[i](ret);\n }\n return true;\n}\n\nvar $port[statement_1]$ = function(value){\n statement_1$id$ = Math.round(value);\n lessThanOrEquals$id$();\n return true;\n};\n\nvar $port[statement_2]$ = function(value){\n statement_2$id$ = Math.round(value);\n lessThanOrEquals$id$();\n return true;\n};\n",
"execution": "\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_1",
"label": "Statement 1",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_2",
"label": "Statement 2",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "output",
"label": "Output",
"conn_type": "Output"
}
]
}

View File

@ -0,0 +1,36 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "maxfloat",
"language": "javascript",
"extension": "webaudio",
"help": "Max Float",
"label": "Max Float",
"color": "200:200:25:150",
"group": "Arithmetics",
"codes": {
"declaration": "\n// block_$id$ = Add Float\nvar block_$id$_arg1 = 0;\nvar block_$id$_arg2 = 0;\nvar $port[result]$ = [];\n\nvar $port[first_number]$ = function(value){\n block_$id$_arg1 = parseFloat(value);\n result = (block_$id$_arg1 > block_$id$_arg2)?block_$id$_arg1:block_$id$_arg2;\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n return true;\n };\n\nvar $port[second_number]$ = function(value){\n block_$id$_arg2 = parseFloat(value);\n result = (block_$id$_arg1 > block_$id$_arg2)?block_$id$_arg1:block_$id$_arg2;\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n return true;\n };\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "first_number",
"conn_type": "Input",
"label": "First Number"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "second_number",
"conn_type": "Input",
"label": "Second Number"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Result",
"conn_type": "Output",
"name": "result"
}
]
}

View File

@ -0,0 +1,38 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "modulus",
"language": "javascript",
"extension": "webaudio",
"help": "Modulus Operation (%)",
"label": "Modulus",
"color": "200:200:25:150",
"group": "Arithmetics",
"codes": {
"onload": "\n\n",
"declaration": "\nvar dividend$id$ = 0.0;\nvar divisor$id$ = 1.0;\n \nvar $port[rest]$ = [];\n\nfunction modulus$id$() {\n if (divisor$id$ === 0.0) {\n divisor$id$ = 1.0;\n }\n \n var rest = dividend$id$ % divisor$id$;\n for (var i = 0; i < $port[rest]$.length ; i++){\n $port[rest]$[i](rest);\n }\n \n return true;\n}\n\nvar $port[dividend]$ = function(value){\n dividend$id$ = Math.round(value);\n modulus$id$();\n return true;\n};\n\nvar $port[divisor]$ = function(value){\n divisor$id$ = Math.round(value);\n modulus$id$();\n return true;\n};\n",
"execution": "\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "dividend",
"label": "Dividend",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "divisor",
"label": "Divisor",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "rest",
"label": "Rest",
"conn_type": "Output"
}
]
}

View File

@ -0,0 +1,36 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "multiplyfloat",
"language": "javascript",
"extension": "webaudio",
"help": "Multiply float values",
"label": "Multiply Float",
"color": "200:200:25:150",
"group": "Arithmetics",
"codes": {
"declaration": "\n// block_$id$ = Multiply Float\nvar block_$id$_arg1 = 0;\nvar block_$id$_arg2 = 0;\nvar $port[result]$ = [];\n\nvar $port[first_number]$ = function(value){\n block_$id$_arg1 = parseFloat(value);\n result = parseFloat(block_$id$_arg1) * parseFloat(block_$id$_arg2);\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n return true;\n };\n\nvar $port[second_number]$ = function(value){\n block_$id$_arg2 = parseFloat(value);\n result = parseFloat(block_$id$_arg1) * parseFloat(block_$id$_arg2);\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n return true;\n };\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "first_number",
"conn_type": "Input",
"label": "First Number"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Input",
"name": "second_number",
"label": "Second Number"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Result",
"conn_type": "Output",
"name": "result"
}
]
}

View File

@ -0,0 +1,32 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "not",
"language": "javascript",
"extension": "webaudio",
"help": "Logical Operation NOT",
"label": "NOT",
"color": "249:229:4:150",
"group": "Arithmetics",
"codes": {
"onload": "\n\n",
"declaration": "\nvar condition$id$ = null;\n\nvar $port[output]$ = [];\n\nfunction not$id$() {\n var ret = !condition$id$; \n for (var i = 0; i < $port[output]$.length ; i++){\n $port[output]$[i](ret);\n }\n return true;\n}\n\nvar $port[condition]$ = function(value){\n condition$id$ = value;\n not$id$();\n return true;\n};\n",
"execution": "\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "condition",
"label": "Condition",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "output",
"label": "Output",
"conn_type": "Output"
}
]
}

View File

@ -0,0 +1,38 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "notequals",
"language": "javascript",
"extension": "webaudio",
"help": "Not Equals (!=)",
"label": "Not Equals To",
"color": "163:01:01:150",
"group": "Arithmetics",
"codes": {
"onload": "\n\n",
"declaration": "\nvar statement_1$id$ = null;\nvar statement_2$id$ = null;\n\nvar $port[output]$ = [];\n\nfunction notEqualsTo$id$() {\n var ret = statement_1$id$ !== statement_2$id$;\n for (var i = 0; i < $port[output]$.length ; i++){\n $port[output]$[i](ret);\n }\n return true;\n}\n\nvar $port[statement_1]$ = function(value){\n statement_1$id$ = Math.round(value);\n notEqualsTo$id$();\n return true;\n};\n\nvar $port[statement_2]$ = function(value){\n statement_2$id$ = Math.round(value);\n notEqualsTo$id$();\n return true;\n};\n",
"execution": "\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_1",
"label": "Statement 1",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "statement_2",
"label": "Statement 2",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "output",
"label": "Output",
"conn_type": "Output"
}
]
}

View File

@ -0,0 +1,38 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "or",
"language": "javascript",
"extension": "webaudio",
"help": "Logical Operation OR",
"label": "OR",
"color": "249:229:4:150",
"group": "Arithmetics",
"codes": {
"onload": "\n\n",
"declaration": "\nvar condition_1$id$ = null;\nvar condition_2$id$ = null;\n\nvar $port[output]$ = [];\n\nfunction or$id$() {\n var ret = condition_1$id$ || condition_2$id$; \n for (var i = 0; i < $port[output]$.length ; i++){\n $port[output]$[i](ret);\n }\n return true;\n}\n\nvar $port[condition_1]$ = function(value){\n condition_1$id$ = value;\n or$id$();\n return true;\n};\n\nvar $port[condition_2]$ = function(value){\n condition_2$id$ = value;\n or$id$();\n return true;\n};\n",
"execution": "\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "condition_1",
"label": "Condition 1",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "condition_2",
"label": "Condition 2",
"conn_type": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"name": "output",
"label": "Output",
"conn_type": "Output"
}
]
}

View File

@ -0,0 +1,36 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "subtractfloat",
"language": "javascript",
"extension": "webaudio",
"help": "Subtract Float",
"label": "Subtract Float",
"color": "200:200:25:150",
"group": "Arithmetics",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar block_$id$_arg1 = 0;\nvar block_$id$_arg2 = 0;\nvar $port[result]$ = [];\n\nvar $port[first_number]$ = function(value){\n block_$id$_arg1 = parseFloat(value);\n result = parseFloat(block_$id$_arg1) - parseFloat(block_$id$_arg2);\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n return true;\n };\n\nvar $port[second_number]$ = function(value){\n block_$id$_arg2 = parseFloat(value);\n result = parseFloat(block_$id$_arg1) - parseFloat(block_$id$_arg2);\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n return true;\n };\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "first_number",
"conn_type": "Input",
"label": "First Number"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "second_number",
"conn_type": "Input",
"label": "Second Number"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Result",
"conn_type": "Output",
"name": "result"
}
]
}

View File

@ -0,0 +1,30 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "bool2float",
"language": "javascript",
"extension": "webaudio",
"help": "Bool to Float",
"label": "Bool 2 Float",
"color": "200:200:25:150",
"group": "Conversion",
"codes": {
"declaration": "\nvar $port[float_output]$ = [];\nvar $port[bool_input]$ = function(value) {\n var ret = value ? 1.0 : 0.0;\n for (var i = 0; i < $port[float_output]$.length ; i++){\n $port[float_output]$[i](ret);\n }\n return true;\n};\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"label": "Bool Input",
"conn_type": "Input",
"name": "bool_input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Float Output",
"conn_type": "Output",
"name": "float_output"
}
]
}

View File

@ -0,0 +1,46 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "char2float",
"language": "javascript",
"extension": "webaudio",
"help": "Char to Float",
"label": "Char 2 Float",
"color": "200:200:25:150",
"group": "Conversion",
"codes": {
"declaration": "\n// block_$id$ = Char 2 Float\nvar $port[float_output]$ = [];\nvar $port[char_input]$ = function(value){\n if (value != '$prop[char]$')\n return true;\n for (var i = 0; i < $port[float_output]$.length ; i++){\n $port[float_output]$[i]($prop[float]$);\n }\n return true;\n };\n"
},
"properties": [
{
"name": "float",
"label": "Output float",
"type": "Float",
"lower": 0,
"upper": 20000,
"step": 1,
"value": 60
},
{
"name": "char",
"label": "Input Char",
"type": "String",
"value": "a"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.char",
"label": "Char Input",
"conn_type": "Input",
"name": "char_input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Float Output",
"conn_type": "Output",
"name": "float_output"
}
]
}

View File

@ -0,0 +1,42 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "rgb",
"language": "javascript",
"extension": "webaudio",
"help": "Creates RGB Color",
"label": "RGB",
"color": "50:150:0:150",
"group": "Conversion",
"codes": {
"declaration": "\n// $label$\nvar r$id$ = '00';\nvar g$id$ = '00';\nvar b$id$ = '00';\nvar $port[result]$ = [];\n\nfunction update_backgroud_color$id$(){\n result = '#' + r$id$ + g$id$ + b$id$;\n for (var i = 0; i < $port[result]$.length ; i++){\n $port[result]$[i](result);\n }\n}\n\nvar $port[r]$ = function(value){\n value = Math.round(value);\n r$id$ = value.toString(16);\n if (value < 16)\n r$id$ = '0'+ r$id$;\n update_backgroud_color$id$();\n return true;\n };\n\nvar $port[g]$ = function(value){\n value = Math.round(value);\n g$id$ = value.toString(16);\n if (value < 16)\n g$id$ = '0'+ g$id$;\n update_backgroud_color$id$();\n return true;\n };\n\nvar $port[b]$ = function(value){\n value = Math.round(value);\n b$id$ = value.toString(16);\n if (value < 16)\n b$id$ = '0'+ b$id$;\n update_backgroud_color$id$();\n return true;\n };\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "r",
"conn_type": "Input",
"label": "Red"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "g",
"conn_type": "Input",
"label": "Green"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "b",
"conn_type": "Input",
"label": "Blue"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.color",
"name": "result",
"conn_type": "Output",
"label": "Color"
}
]
}

View File

@ -0,0 +1,42 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "date",
"language": "javascript",
"extension": "webaudio",
"help": "Date",
"label": "Date",
"color": "150:10:20:150",
"group": "Input Device",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[day]$ = [];\nvar $port[month]$ = [];\nvar $port[year]$ = [];\n\nvar $port[generate]$ = function(value){\n var d = new Date();\n for (var i = 0; i < $port[day]$.length ; i++){\n $port[day]$[i](d.getDate());\n }\n for (var i = 0; i < $port[month]$.length ; i++){\n $port[month]$[i](d.getMonth());\n }\n for (var i = 0; i < $port[year]$.length ; i++){\n $port[year]$[i](d.getFullYear());\n }\n return true;\n };\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Day",
"conn_type": "Output",
"name": "day"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Month",
"conn_type": "Output",
"name": "month"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Year",
"conn_type": "Output",
"name": "year"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Generate",
"conn_type": "Input",
"name": "generate"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "deviceorientation",
"language": "javascript",
"extension": "webaudio",
"help": "Device Orientation",
"label": "Device Orientation",
"color": "50:50:50:150",
"group": "Input Device",
"codes": {
"onload": "\nwindow.addEventListener('deviceorientation', handleDeviceOrientation$id$);\n ",
"declaration": "\nvar $port[alpha]$ = [];\nvar $port[beta]$ = [];\nvar $port[gamma]$ = [];\n\nfunction handleDeviceOrientation$id$(event){\n for (var i = 0 ; i < $port[alpha]$.length ; i++)\n $port[alpha]$[i](event.alpha);\n \n for (var i = 0 ; i < $port[beta]$.length ; i++)\n $port[beta]$[i](event.beta);\n \n for (var i = 0 ; i < $port[gamma]$.length ; i++)\n $port[gamma]$[i](event.gamma); \n} \n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Output",
"name": "alpha",
"label": "Alpha"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Output",
"name": "beta",
"label": "Beta"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Output",
"name": "gamma",
"label": "Gamma"
}
]
}

View File

@ -0,0 +1,54 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "hour",
"language": "javascript",
"extension": "webaudio",
"help": "Hour",
"label": "Hour",
"color": "150:10:20:150",
"group": "Input Device",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[hour]$ = [];\nvar $port[minute]$ = [];\nvar $port[second]$ = [];\nvar $port[millisecond]$ = [];\nvar $port[time]$ = [];\n\nvar $port[generate]$ = function(value){\n var d = new Date();\n for (var i = 0; i < $port[hour]$.length ; i++){\n $port[hour]$[i](d.getHours());\n }\n for (var i = 0; i < $port[minute]$.length ; i++){\n $port[minute]$[i](d.getMinutes());\n }\n for (var i = 0; i < $port[second]$.length ; i++){\n $port[second]$[i](d.getSeconds());\n }\n for (var i = 0; i < $port[millisecond]$.length ; i++){\n $port[millisecond]$[i](d.getMilliseconds());\n }\n for (var i = 0; i < $port[time]$.length ; i++){\n $port[time]$[i](d.getTime());\n }\n return true;\n };\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Hour",
"conn_type": "Output",
"name": "hour"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Minute",
"conn_type": "Output",
"name": "minute"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Second",
"conn_type": "Output",
"name": "second"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Millisecond",
"conn_type": "Output",
"name": "millisecond"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Time",
"conn_type": "Output",
"name": "time"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Generate",
"conn_type": "Input",
"name": "generate"
}
]
}

View File

@ -0,0 +1,31 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "keyboard",
"language": "javascript",
"extension": "webaudio",
"help": "Keyboard",
"label": "Keyboard",
"color": "50:150:250:150",
"group": "Input Device",
"codes": {
"function": "\nvar keyboard_char_output = [];\nvar keyboard_float_output = [];\ndocument.onkeypress = function(evt){\n evt = evt || window.event;\n\n var value = evt.keyCode || evt.which;\n for (var i = 0; i < keyboard_float_output.length ; i++)\n for (var j = 0; j < keyboard_float_output[i].length ; j++)\n keyboard_float_output[i][j](value);\n\n value = String.fromCharCode(value);\n for (var i = 0; i < keyboard_char_output.length ; i++)\n for (var j = 0; j < keyboard_char_output[i].length ; j++)\n keyboard_char_output[i][j](value);\n};\n",
"declaration": "\n// block_$id$ = KeyBoard Input\nvar $port[char_output]$ = [];\nvar $port[float_output]$ = [];\nkeyboard_char_output.push($port[char_output]$);\nkeyboard_float_output.push($port[float_output]$);\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Float Output",
"conn_type": "Output",
"name": "float_output"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.char",
"label": "Char Output",
"conn_type": "Output",
"name": "char_output"
}
]
}

View File

@ -0,0 +1,57 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "metronome",
"language": "javascript",
"extension": "webaudio",
"help": "Metronome",
"label": "Metronome",
"color": "150:150:250:150",
"group": "Input Device",
"codes": {
"declaration": "\n// block_$id$ = Float Value\nvar block_$id$_timeout;\nvar block_$id$_value = $prop[value]$;\nvar block_$id$_time = $prop[time]$;\nvar $port[float]$ = [];\n\nvar $port[start]$ = function(value){\n timeout_$id$_value();\n return true;\n };\n\nvar $port[stop]$ = function(value){\n if (value > 0) {\n clearTimeout(block_$id$_timeout);\n }\n return true;\n };\n\n",
"execution": "\nfunction timeout_$id$_value(){\n for (var i = 0; i < $port[float]$.length ; i++){\n $port[float]$[i](block_$id$_value);\n }\n block_$id$_timeout = setTimeout(timeout_$id$_value, block_$id$_time);\n};\n",
"onload": ""
},
"properties": [
{
"name": "value",
"label": "Value",
"type": "Float",
"lower": 0,
"upper": 20000,
"step": 1,
"value": 1
},
{
"name": "time",
"label": "Time (ms)",
"type": "Float",
"lower": 0,
"upper": 20000,
"step": 1,
"value": 1000
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Float",
"conn_type": "Output",
"name": "float"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Start",
"conn_type": "Input",
"name": "start"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Input",
"label": "Stop",
"name": "stop"
}
]
}

View File

@ -0,0 +1,25 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "microphone",
"language": "javascript",
"extension": "webaudio",
"help": "Microphone",
"label": "Microphone",
"color": "150:150:250:150",
"group": "Input Device",
"codes": {
"declaration": "\n</script>\n<div>\n <span class=\"title\">Microphone</span>\n</div>\n<div>\n <div>\n <span class=\"label\">Gain</span>\n <input type=\"range\" id=\"gain-slider_$id$\" class=\"slider\" min=\"-20\" max=\"20\" step=\"1\" value=\"0\" />\n <span id=\"gain-display_$id$\" class=\"label\">0 db</span>\n </div>\n</div>\n\n<script>\n var gain = 0;\n var audioSource;\n var block_$id$;\n\n block_$id$ = context.createBiquadFilter();\n block_$id$.type = \"lowshelf\";\n block_$id$.frequency.value = 1000;\n\n var $port[output]$ = block_$id$;\n\n navigator.getUserMedia =\n navigator.getUserMedia ||\n navigator.webkitGetUserMedia ||\n navigator.mozGetUserMedia ||\n navigator.msGetUserMedia;\n\nif (navigator.getUserMedia) {\n navigator.getUserMedia (\n {\n audio: true,\n video: false\n },\n function (stream) {\n audioSource = context.createMediaStreamSource(stream);\n\n var gainDisplay = document.getElementById('gain-display_$id$');\n var gainSlider = document.getElementById('gain-slider_$id$');\n\n gainSlider.addEventListener('input', function () {\n gain = parseFloat(gainSlider.value)\n gainDisplay.textContent = gain + ' db';\n block_$id$.gain.value = gainSlider.value;\n });\n\n audioSource.connect(block_$id$);\n },\n function (err) {\n console.log('Error initializing user media stream: ' + err);\n }\n );\n}\n",
"onload": "\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Output",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "mouseclick",
"language": "javascript",
"extension": "webaudio",
"help": "Mouse Click",
"label": "Mouse Click",
"color": "50:50:50:150",
"group": "Input Device",
"codes": {
"function": "\n// ----------------- Mouse click ----------------------------\n// Variable to keep output ports\nvar x_click_ports = [];\nvar y_click_ports = [];\nvar button_click_ports = [];\n\ndocument.onmousedown = getMouseClick;\nfunction getMouseClick(event) {\n // X value\n for (var i = 0; i < x_click_ports.length ; i++)\n for (var j = 0; j < x_click_ports[i].length ; j++)\n x_click_ports[i][j](event.x);\n\n // Y value\n for (var i = 0; i < y_click_ports.length ; i++)\n for (var j = 0; j < y_click_ports[i].length ; j++)\n y_click_ports[i][j](event.y);\n\n // Button value\n for (var i = 0; i < button_click_ports.length ; i++)\n for (var j = 0; j < button_click_ports[i].length ; j++)\n button_click_ports[i][j](event.button);\n\n return true\n}\n// ----------------- Mouse position ----------------------------\n",
"declaration": "\n// block_$id$ = Mouse\nvar $port[x]$ = [];\nvar $port[y]$ = [];\nvar $port[button]$ = [];\nx_click_ports.push($port[x]$);\ny_click_ports.push($port[y]$);\nbutton_click_ports.push($port[button]$);\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Output",
"name": "x",
"label": "X"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Output",
"name": "y",
"label": "Y"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Output",
"name": "button",
"label": "Button"
}
]
}

View File

@ -0,0 +1,31 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "mouseposition",
"language": "javascript",
"extension": "webaudio",
"help": "Mouse Position",
"label": "Mouse Position",
"color": "50:50:50:150",
"group": "Input Device",
"codes": {
"function": "\n// ----------------- Mouse position ----------------------------\n// Detect if the browser is IE or not.\n// If it is not IE, we assume that the browser is NS.\nvar IE = document.all?true:false\n\n// If NS -- that is, !IE -- then set up for mouse capture\nif (!IE) document.captureEvents(Event.MOUSEMOVE)\n\n// Set-up to use getMouseXY function onMouseMove\ndocument.onmousemove = getMouseXY;\n\n// Temporary variables to hold mouse x-y pos.s\nvar tempX = 0\nvar tempY = 0\n\n// Variable to keep output ports\nvar x_ports = [];\nvar y_ports = [];\n\n// Main function to retrieve mouse x-y pos.s\n\nfunction getMouseXY(e) {\n if (IE) { // grab the x-y pos.s if browser is IE\n tempX = event.clientX + document.body.scrollLeft\n tempY = event.clientY + document.body.scrollTop\n } else { // grab the x-y pos.s if browser is NS\n tempX = e.pageX\n tempY = e.pageY\n }\n // catch possible negative values in NS4\n if (tempX < 0){tempX = 0}\n if (tempY < 0){tempY = 0}\n\n // X value\n for (var i = 0; i < x_ports.length ; i++)\n for (var j = 0; j < x_ports[i].length ; j++)\n x_ports[i][j](tempX);\n\n // Y value\n for (var i = 0; i < y_ports.length ; i++)\n for (var j = 0; j < y_ports[i].length ; j++)\n y_ports[i][j](tempY);\n return true\n}\n// ----------------- Mouse position ----------------------------\n",
"declaration": "\n// block_$id$ = Mouse\nvar $port[x]$ = [];\nvar $port[y]$ = [];\nx_ports.push($port[x]$);\ny_ports.push($port[y]$);\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Output",
"name": "x",
"label": "X"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Output",
"name": "y",
"label": "Y"
}
]
}

View File

@ -0,0 +1,32 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "orientationchange",
"language": "javascript",
"extension": "webaudio",
"help": "Orientation Change",
"label": "Orientation Change",
"color": "50:50:50:150",
"group": "Input Device",
"codes": {
"onload": "\nwindow.addEventListener('orientationchange', onOrientationChange$id$, false);\n ",
"declaration": "\nvar $port[portrait]$ = [];\nvar $port[landscape]$ = [];\n\nfunction onOrientationChange$id$(event){\n var isPortrait = window.orientation % 180 === 0;\n if (window.orientation % 180 === 0) {\n for (var i = 0 ; i < $port[portrait]$.length ; i++)\n $port[portrait]$[i](isPortrait);\n \n } else { \n for (var i = 0 ; i < $port[landscape]$.length ; i++)\n $port[landscape]$[i](isPortrait);\n } \n}\n",
"execution": "\nonOrientationChange$id$();\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"conn_type": "Output",
"name": "portrait",
"label": "Portrait"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"conn_type": "Output",
"name": "landscape",
"label": "Landscape"
}
]
}

View File

@ -0,0 +1,49 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "random",
"language": "javascript",
"extension": "webaudio",
"help": "Random",
"label": "Random",
"color": "150:150:250:150",
"group": "Input Device",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar block_$id$_min = $prop[min]$;\nvar block_$id$_max = $prop[max]$;\nvar $port[float]$ = [];\n\nvar $port[generate]$ = function(value){\n value = Math.floor((Math.random() * (block_$id$_max - block_$id$_min)) + block_$id$_min);\n for (var i = 0; i < $port[float]$.length ; i++){\n $port[float]$[i](value);\n }\n return true;\n };\n\n"
},
"properties": [
{
"name": "min",
"label": "Min",
"type": "Float",
"lower": -20000,
"upper": 20000,
"step": 1,
"value": 1
},
{
"name": "max",
"label": "Max",
"type": "Float",
"lower": -20000,
"upper": 20000,
"step": 1,
"value": 100
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Float",
"conn_type": "Output",
"name": "float"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Generate",
"conn_type": "Input",
"name": "generate"
}
]
}

View File

@ -0,0 +1,31 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "upkeyboard",
"language": "javascript",
"extension": "webaudio",
"help": "UpKeyboard",
"label": "UpKeyboard",
"color": "50:150:250:150",
"group": "Input Device",
"codes": {
"function": "\nvar keyboard_char_output = [];\nvar keyboard_float_output = [];\ndocument.onkeyup = function(evt){\n evt = evt || window.event;\n\n var value = evt.keyCode || evt.which;\n for (var i = 0; i < keyboard_float_output.length ; i++)\n for (var j = 0; j < keyboard_float_output[i].length ; j++)\n keyboard_float_output[i][j](value);\n\n value = String.fromCharCode(value);\n for (var i = 0; i < keyboard_char_output.length ; i++)\n for (var j = 0; j < keyboard_char_output[i].length ; j++)\n keyboard_char_output[i][j](value);\n};\n",
"declaration": "\n// block_$id$ = KeyBoard Input\nvar $port[char_output]$ = [];\nvar $port[float_output]$ = [];\nkeyboard_char_output.push($port[char_output]$);\nkeyboard_float_output.push($port[float_output]$);\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Float Output",
"conn_type": "Output",
"name": "float_output"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.char",
"label": "Char Output",
"conn_type": "Output",
"name": "char_output"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "addsound",
"language": "javascript",
"extension": "webaudio",
"help": "Add Sound",
"label": "Add Sound",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nMerger = function(context) {\n var that = this;\n this.x = 0; // Initial sample number\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) { that.process(e) };\n}\n\nMerger.prototype.process = function(e) {\n var in0 = e.inputBuffer.getChannelData(0);\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in0.length; ++i) {\n out[i] = in0[i];\n }\n}\n",
"declaration": "\n// block_$id$ = $label$\nvar block_$id$_obj = new Merger(context);\nvar $port[sound_input0]$ = block_$id$_obj.node;\nvar $port[sound_input1]$ = block_$id$_obj.node;\nvar $port[output]$ = block_$id$_obj.node;\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input0",
"conn_type": "Input",
"label": "Sound"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input1",
"conn_type": "Input",
"label": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "addsoundfloat",
"language": "javascript",
"extension": "webaudio",
"help": " Add Sound Float",
"label": "Add Sound Float",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nAddSoundFloat = function(context, float_value) {\n var that = this;\n this.float = float_value;\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) { that.process(e) };\n}\n\nAddSoundFloat.prototype.process = function(e) {\n var in0 = e.inputBuffer.getChannelData(0);\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in0.length; ++i) {\n out[i] = in0[i] + this.float;\n }\n}\n",
"declaration": "\n// block_$id$ = $label$\n\nvar block_$id$_float = 0;\nvar block_$id$_obj = new AddSoundFloat(context, block_$id$_float);\n\nvar $port[float_input]$ = function(value){\n block_$id$_float = parseFloat(value);\n block_$id$_obj.float = block_$id$_float;\n return true;\n };\n\n\nvar $port[sound_input]$ = block_$id$_obj.node;\nvar $port[output]$ = block_$id$_obj.node;\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input",
"conn_type": "Input",
"label": "Sound"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "float_input",
"conn_type": "Input",
"label": "Float Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "output"
}
]
}

113
blocks/sound/adsr.json Normal file
View File

@ -0,0 +1,113 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "adsr",
"language": "javascript",
"extension": "webaudio",
"help": "ADSR",
"label": "ADSR",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nEnvelope = function(context, a, d, s, r, g) {\nthis.node = context.createGain()\nthis.context = context;\nthis.node.gain.value = 0;\nthis.a = a / 1000.0;\nthis.d = d / 1000.0;\nthis.s = s / 1000.0;\nthis.r = r / 1000.0;\nthis.g = g;\n}\n\nEnvelope.prototype.play = function(e) {\nvar time = this.context.currentTime;\n// Zero\nthis.node.gain.linearRampToValueAtTime(0, time);\n// Attack time\ntime += this.a;\nthis.node.gain.linearRampToValueAtTime(1, time);\n// Decay time\ntime += this.d;\nthis.node.gain.linearRampToValueAtTime(0.5, time);\n// Sustain time (do nothing)\ntime += this.s;\n// Release time\ntime += this.r;\nthis.node.gain.linearRampToValueAtTime(0, time);\n}\n\nEnvelope.prototype.seta = function(a) {\n this.a = parseFloat(a)/1000.0;\n}\n\nEnvelope.prototype.setd = function(d) {\n this.d = parseFloat(d)/1000.0;\n}\n\nEnvelope.prototype.sets = function(s) {\n this.s = parseFloat(s)/1000.0;\n}\n\nEnvelope.prototype.setr = function(r) {\n this.r = parseFloat(r)/1000.0;\n}\n\nEnvelope.prototype.setg = function(g) {\n this.g = parseFloat(g);\n}\n",
"declaration": "\n// block_$id$ = $label$\n\nvar block_$id$_obj = new Envelope(context, $prop[a]$, $prop[d]$, $prop[s]$, $prop[r]$, $prop[g]$);\nvar $port[input]$ = block_$id$_obj.node;\nvar $port[output]$ = block_$id$_obj.node;\n\nvar $port[a]$ = function(value){\n block_$id$_obj.seta(value);\n};\n\nvar $port[d]$ = function(value){\n block_$id$_obj.setd(value);\n};\n\nvar $port[s]$ = function(value){\n block_$id$_obj.sets(value);\n};\n\nvar $port[r]$ = function(value){\n block_$id$_obj.setr(value);\n};\n\nvar $port[g]$ = function(value){\n block_$id$_obj.setg(value);\n};\n\nvar $port[play]$ = function(value){\n if (value != 0) {\n block_$id$_obj.play();\n }\n};\n"
},
"properties": [
{
"name": "a",
"label": "Attack",
"type": "Float",
"lower": 0,
"upper": 10000,
"step": 1,
"value": 200
},
{
"name": "d",
"label": "Decay",
"type": "Float",
"lower": 0,
"upper": 10000,
"step": 1,
"value": 20
},
{
"name": "s",
"label": "Sustain",
"type": "Float",
"lower": 0,
"upper": 10000,
"step": 1,
"value": 100
},
{
"name": "r",
"label": "Release",
"type": "Float",
"lower": 0,
"upper": 10000,
"step": 1,
"value": 50
},
{
"name": "g",
"label": "Gain",
"type": "Float",
"lower": 0,
"upper": 10000,
"step": 1,
"value": 0.8
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Input",
"conn_type": "Input",
"name": "input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Attack",
"conn_type": "Input",
"name": "a"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Decay",
"conn_type": "Input",
"name": "d"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Sustain",
"conn_type": "Input",
"name": "s"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Release",
"conn_type": "Input",
"name": "r"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"label": "Gain",
"conn_type": "Input",
"name": "g"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Input",
"label": "Event Play",
"name": "play"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Output",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "channelmerger",
"language": "javascript",
"extension": "webaudio",
"help": "Channel Merger",
"label": "Channel Merger",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nMerger = function(context) {\n var that = this;\n this.x = 0; // Initial sample number\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) { that.process(e) };\n}\n\nMerger.prototype.process = function(e) {\n var in1 = e.inputBuffer.getChannelData(0);\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in1.length; ++i) {\n out[i] = in1[i];\n }\n}\n",
"declaration": "\n// block_$id$ = Channel Merger\nvar block_$id$_obj = new Merger(context);\nvar $port[sound_output]$ = block_$id$_obj.node;\nvar $port[sound_input_1]$ = block_$id$_obj.node;\nvar $port[sound_input_2]$ = block_$id$_obj.node;\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound Input 1",
"conn_type": "Input",
"name": "sound_input_1"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"conn_type": "Input",
"label": "Sound Input 2",
"name": "sound_input_2"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound Output",
"conn_type": "Output",
"name": "sound_output"
}
]
}

40
blocks/sound/delay.json Normal file
View File

@ -0,0 +1,40 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "delay",
"language": "javascript",
"extension": "webaudio",
"help": "Delay",
"label": "Delay",
"color": "150:150:250:150",
"group": "Sound",
"codes": {
"declaration": "\n// block_$id$ = Delay\nvar block_$id$ = context.createDelay();\nblock_$id$.delayTime.value = $prop[time]$;\nvar $port[input]$ = block_$id$;\nvar $port[output]$ = block_$id$;\n"
},
"properties": [
{
"name": "time",
"label": "Time",
"type": "Float",
"lower": 0,
"upper": 10000,
"step": 1,
"value": 1
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Input",
"conn_type": "Input",
"name": "input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Output",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,38 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "distortion",
"language": "javascript",
"extension": "webaudio",
"help": "Distortion",
"label": "Distortion",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"declaration": "\nvar block_$id$ = context.createWaveShaper();\nblock_$id$.curve = makeDistortionCurve($prop[curve]$);\nblock_$id$.oversample = '4x';\nvar $port[input]$ = block_$id$;\nvar $port[output]$ = block_$id$;\n",
"function": "\nfunction makeDistortionCurve(amount) {\n var k = typeof amount === 'number' ? amount : 50,\n n_samples = 44100,\n curve = new Float32Array(n_samples),\n deg = Math.PI / 180,\n i = 0,\n x;\n for ( ; i < n_samples; ++i ) {\n x = i * 2 / n_samples - 1;\n curve[i] = ( 3 + k ) * x * 20 * deg / ( Math.PI + k * Math.abs(x) );\n }\n return curve;\n};\n"
},
"properties": [
{
"name": "curve",
"label": "Curve",
"type": "Float",
"value": 800
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Input",
"conn_type": "Input",
"name": "input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Output",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "divsound",
"language": "javascript",
"extension": "webaudio",
"help": "Div Sound",
"label": "Div Sound",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nDivSound = function(context, analyzer0, analyzer1) {\n var that = this;\n this.analyzer0 = analyzer0;\n this.analyzer1 = analyzer1;\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) {that.process(e)};\n}\n\nDivSound.prototype.process = function(e) {\n var in0 = new Float32Array(this.analyzer0.fftSize);\n var in1 = new Float32Array(this.analyzer1.fftSize);\n\n this.analyzer0.getFloatTimeDomainData(in0);\n this.analyzer1.getFloatTimeDomainData(in1);\n\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in0.length; ++i) {\n out[i] = in0[i] / in1[i];\n }\n}\n",
"declaration": "\n// block_$id$ = $label$\nvar block_$id$_in0 = context.createAnalyser();\nvar block_$id$_in1 = context.createAnalyser();\n\nvar $port[sound_input0]$ = block_$id$_in0;\nvar $port[sound_input1]$ = block_$id$_in1;\nvar block_$id$_obj = new DivSound(context, block_$id$_in0, block_$id$_in1);\nvar $port[output]$ = block_$id$_obj.node;\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input0",
"conn_type": "Input",
"label": "Sound"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input1",
"conn_type": "Input",
"label": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "divsoundfloat",
"language": "javascript",
"extension": "webaudio",
"help": " Div Sound Float",
"label": "Div Sound Float",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nDivSoundFloat = function(context, float_value) {\n var that = this;\n this.float = float_value;\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) { that.process(e) };\n}\n\nDivSoundFloat.prototype.process = function(e) {\n var in0 = e.inputBuffer.getChannelData(0);\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in0.length; ++i) {\n out[i] = in0[i] / this.float;\n }\n}\n",
"declaration": "\n// block_$id$ = $label$\n\nvar block_$id$_float = 1;\nvar block_$id$_obj = new DivSoundFloat(context, block_$id$_float);\n\nvar $port[float_input]$ = function(value){\n block_$id$_float = parseFloat(value);\n block_$id$_obj.float = block_$id$_float;\n return true;\n };\n\nvar $port[sound_input]$ = block_$id$_obj.node;\nvar $port[output]$ = block_$id$_obj.node;\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input",
"conn_type": "Input",
"label": "Sound"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "float_input",
"conn_type": "Input",
"label": "Float Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "output"
}
]
}

98
blocks/sound/filter.json Normal file
View File

@ -0,0 +1,98 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "filter",
"language": "javascript",
"extension": "webaudio",
"help": "Filter",
"label": "Filter",
"color": "50:150:50:150",
"group": "Sound",
"codes": {
"declaration": "\n\n// block_$id$ = $label$\nvar block_$id$ = context.createBiquadFilter();\nvar $port[osc_freq]$ = block_$id$.frequency;\nblock_$id$.type = '$prop[type]$';\nblock_$id$.frequency.value = '$prop[freq]$';\nblock_$id$.gain.value = $prop[gain]$;\nblock_$id$.Q.value = $prop[Q]$;\n\nvar $port[freq]$ = function(value){\n block_$id$.frequency.value = parseFloat(value);\n return true;\n };\n\nvar $port[q]$ = function(value){\n block_$id$.Q.value = parseFloat(value);\n return true;\n };\n\nvar $port[gain]$ = function(value){\n block_$id$.gain.value = parseFloat(value);\n return true;\n };\n\nvar $port[sound_input]$ = block_$id$;\nvar $port[output]$ = block_$id$;\n"
},
"properties": [
{
"name": "type",
"label": "Type",
"type": "Combo",
"values": [
"allpass",
"bandpass",
"highshelf",
"highpass",
"lowpass",
"lowshelf",
"notch",
"peaking"
],
"value": "highpass"
},
{
"name": "freq",
"label": "Frequency",
"type": "Float",
"lower": 0,
"upper": 48000,
"step": 1,
"value": 200
},
{
"name": "gain",
"label": "Gain",
"type": "Float",
"lower": 0,
"upper": 100,
"step": 0.1,
"value": 1
},
{
"name": "Q",
"label": "Q",
"type": "Float",
"lower": 0,
"upper": 48000,
"step": 1,
"value": 200
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input",
"conn_type": "Input",
"label": "Sound"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Frequency",
"conn_type": "Input",
"name": "osc_freq"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "freq",
"conn_type": "Input",
"label": "Frequency"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "gain",
"conn_type": "Input",
"label": "Gain"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "q",
"conn_type": "Input",
"label": "Q"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "output"
}
]
}

52
blocks/sound/gain.json Normal file
View File

@ -0,0 +1,52 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "gain",
"language": "javascript",
"extension": "webaudio",
"help": "Sound output",
"label": "Gain",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar block_$id$ = context.createGain();\nvar $port[input]$ = block_$id$;\nvar $port[output]$ = block_$id$;\nvar $port[gain]$ = block_$id$.gain;\nvar $port[gain_value]$ = function(value){\n block_$id$.gain.value = value;\n };\n",
"execution": "block_$id$.gain.value = $prop[gain]$;\n"
},
"properties": [
{
"name": "gain",
"label": "Gain",
"type": "Float",
"lower": 0,
"upper": 32000,
"value": 1
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Input",
"conn_type": "Input",
"name": "input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Gain",
"conn_type": "Input",
"name": "gain"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Input",
"label": "Gain Value",
"name": "gain_value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "output",
"conn_type": "Output",
"label": "Output"
}
]
}

120
blocks/sound/hrtf.json Normal file
View File

@ -0,0 +1,120 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "hrtf",
"language": "javascript",
"extension": "webaudio",
"help": "HRTF",
"label": "HRTF",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar block_$id$_width = window.innerWidth;\nvar block_$id$_height = window.innerHeight;\nvar block_$id$_xPos = Math.floor(block_$id$_width/2);\nvar block_$id$_yPos = Math.floor(block_$id$_height/2);\nvar block_$id$_zPos = 295;\nvar block_$id$ = context.createPanner();\n\nblock_$id$.panningModel = 'HRTF';\nblock_$id$.distanceModel = \"$prop[distance_model]$\";\nblock_$id$.refDistance = $prop[ref_distance]$;\nblock_$id$.maxDistance = $prop[max_distance]$;\nblock_$id$.rolloffFactor = $prop[rolloff_factor]$;\nblock_$id$.coneInnerAngle = $prop[cone_inner_angle]$;\nblock_$id$.coneOuterAngle = $prop[cone_outer_angle]$;\nblock_$id$.coneOuterGain = $prop[cone_outer_gain]$;\n\nvar block_$id$_panner_pos = [0, 0, 0];\nvar block_$id$_listener_pos = [0, 0, 0];\nvar block_$id$_panner_orientation = [0, 0, 0];\nvar block_$id$_listener_forward = [0, 0, 0];\nvar block_$id$_listener_up = [0, 0, 0];\n\n\nvar $port[panner_pos]$ = function(value){\n block_$id$_panner_pos = value;\n block_$id$.setPosition(value[0],\n value[1],\n value[2]);\n return true;\n};\nvar $port[listener_pos]$ = function(value){\n block_$id$_listener_pos = value;\n context.listener.setPosition(value[0],\n value[1],\n value[2]);\n return true;\n};\nvar $port[panner_orientation]$ = function(value){\n block_$id$_panner_orientation = value;\n block_$id$.setOrientation(value[0],\n value[1],\n value[2]);\n return true;\n};\nvar $port[listener_forward]$ = function(value){\n block_$id$_listener_forward = value;\n context.listener.setOrientation(value[0],\n value[1],\n value[2],\n block_$id$_listener_up[0],\n block_$id$_listener_up[1],\n block_$id$_listener_up[2]);\n return true;\n};\n\nvar $port[listener_up]$ = function(value){\n block_$id$_listener_up = value;\n context.listener.setOrientation(block_$id$_listener_forward[0],\n block_$id$_listener_forward[1],\n block_$id$_listener_forward[2],\n value[0],\n value[1],\n value[2]);\n return true;\n};\n\nvar $port[sound_input]$ = block_$id$;\nvar $port[output]$ = block_$id$;\n"
},
"properties": [
{
"name": "distance_model",
"label": "Distance Model",
"type": "Combo",
"values": [
"linear",
"inverse",
"exponential"
],
"value": "inverse"
},
{
"name": "cone_inner_angle",
"label": "coneInnerAngle",
"type": "Float",
"lower": 0,
"upper": 360,
"value": 360
},
{
"name": "cone_outer_angle",
"label": "Cone Outer Angle",
"type": "Float",
"lower": 0,
"upper": 360,
"value": 0
},
{
"name": "cone_outer_gain",
"label": "Cone Outer Gain",
"type": "Float",
"lower": 0,
"upper": 32000,
"value": 0
},
{
"name": "ref_distance",
"label": "Ref Distance",
"type": "Float",
"lower": 0,
"upper": 32000,
"value": 1
},
{
"name": "max_distance",
"label": "Max Distance",
"type": "Float",
"lower": 0,
"upper": 32000,
"value": 10000
},
{
"name": "rolloff_factor",
"label": "Rolloff Factor",
"type": "Float",
"lower": 0,
"upper": 32000,
"value": 1
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input",
"conn_type": "Input",
"label": "Sound"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.point",
"name": "panner_pos",
"conn_type": "Input",
"label": "Panner Position"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.point",
"name": "listener_pos",
"conn_type": "Input",
"label": "Listener Position"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.point",
"name": "panner_orientation",
"conn_type": "Input",
"label": "Panner Orientation"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.point",
"name": "listener_forward",
"conn_type": "Input",
"label": "Listener Forward"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.point",
"name": "listener_up",
"conn_type": "Input",
"label": "Listener Up"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "mulsound",
"language": "javascript",
"extension": "webaudio",
"help": "Mul Sound",
"label": "Mul Sound",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nMulSound = function(context, analyzer0, analyzer1) {\n var that = this;\n this.analyzer0 = analyzer0;\n this.analyzer1 = analyzer1;\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) {that.process(e)};\n}\n\nMulSound.prototype.process = function(e) {\n var in0 = new Float32Array(this.analyzer0.fftSize);\n var in1 = new Float32Array(this.analyzer1.fftSize);\n\n this.analyzer0.getFloatTimeDomainData(in0);\n this.analyzer1.getFloatTimeDomainData(in1);\n\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in0.length; ++i) {\n out[i] = in0[i] * in1[i];\n }\n}\n",
"declaration": "\n// block_$id$ = $label$\nvar block_$id$_in0 = context.createAnalyser();\nvar block_$id$_in1 = context.createAnalyser();\n\nvar $port[sound_input0]$ = block_$id$_in0;\nvar $port[sound_input1]$ = block_$id$_in1;\nvar block_$id$_obj = new MulSound(context, block_$id$_in0, block_$id$_in1);\nvar $port[output]$ = block_$id$_obj.node;\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input0",
"conn_type": "Input",
"label": "Sound"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input1",
"conn_type": "Input",
"label": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "mulsoundfloat",
"language": "javascript",
"extension": "webaudio",
"help": " Mul Sound Float",
"label": "Mul Sound Float",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nMulSoundFloat = function(context, float_value) {\n var that = this;\n this.float = float_value;\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) { that.process(e) };\n}\n\nMulSoundFloat.prototype.process = function(e) {\n var in0 = e.inputBuffer.getChannelData(0);\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in0.length; ++i) {\n out[i] = in0[i] * this.float;\n }\n}\n",
"declaration": "\n// block_$id$ = $label$\n\nvar block_$id$_float = 1;\nvar block_$id$_obj = new MulSoundFloat(context, block_$id$_float);\n\nvar $port[float_input]$ = function(value){\n block_$id$_float = parseFloat(value);\n block_$id$_obj.float = block_$id$_float;\n return true;\n };\n\nvar $port[sound_input]$ = block_$id$_obj.node;\nvar $port[output]$ = block_$id$_obj.node;\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input",
"conn_type": "Input",
"label": "Sound"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "float_input",
"conn_type": "Input",
"label": "Float Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,65 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "oscillator",
"language": "javascript",
"extension": "webaudio",
"help": "Sound output",
"label": "Oscillator",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"declaration": "\n// block_$id$ = Oscillator\nvar block_$id$ = context.createOscillator();\nvar $port[osc_freq]$ = block_$id$.frequency;\nvar $port[sound]$ = block_$id$;\nvar $port[freq]$ = function(value){\n block_$id$.frequency.value = value;\n};\n\nvar $port[type]$ = function(value){\n oscillator = ''\n if (value < 1) oscillator = 'square';\n if (value == 1) oscillator = 'sine';\n if (value == 2) oscillator = 'sawtooth';\n if (value > 2) oscillator = 'triangle';\n block_$id$.type = oscillator;\n};\n",
"execution": "\nblock_$id$.type = '$prop[type]$';\nblock_$id$.frequency.value = $prop[freq]$; // value in hertz\nblock_$id$.detune.value = 100; // value in cents\nblock_$id$.start(0);\n"
},
"properties": [
{
"name": "freq",
"label": "Frequency",
"type": "Float",
"lower": 0,
"upper": 20000,
"step": 1,
"value": 440
},
{
"name": "type",
"label": "Type",
"type": "Combo",
"values": [
"square",
"sine",
"sawtooth",
"triangle"
],
"value": "sine"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Osc Frequency",
"conn_type": "Input",
"name": "osc_freq"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Input",
"label": "Frequency",
"name": "freq"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"conn_type": "Input",
"name": "type",
"label": "Type"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound",
"conn_type": "Output",
"label": "Sound"
}
]
}

View File

@ -0,0 +1,40 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "playback",
"language": "javascript",
"extension": "webaudio",
"help": "Playback",
"label": "Playback",
"color": "150:150:250:150",
"group": "Sound",
"codes": {
"declaration": "\nvar block_$id$ = context.createBufferSource();\nvar $port[output]$ = block_$id$;\n",
"html": "\n$prop[label]$ <input type=\"file\" id=\"pb_$id$\" onchange=\"handleFile_$id$(this.files)\">\n",
"execution": "\nfunction handleFile_$id$() {\n var input_pb_$id$ = document.getElementById(\"pb_$id$\");\n input_pb_$id$.addEventListener(\"change\", handleFile_$id$, false);\n\n var reader = new FileReader();\n reader.onload = function(ev) {\n context.decodeAudioData(ev.target.result, function(buffer) {\n block_$id$.buffer = buffer;\n block_$id$.loop = (\"$prop[loop]$\" == \"True\");\n });\n };\n reader.readAsArrayBuffer(input_pb_$id$.files[0]);\n $port[output]$.start();\n}\n",
"onload": ""
},
"properties": [
{
"name": "loop",
"label": "Loop",
"type": "Check",
"value": "True"
},
{
"name": "label",
"label": "Label",
"type": "String",
"value": "Playback"
}
],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Output",
"conn_type": "Output",
"name": "output"
}
]
}

24
blocks/sound/speaker.json Normal file
View File

@ -0,0 +1,24 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "speaker",
"language": "javascript",
"extension": "webaudio",
"help": "Sound output",
"label": "Speaker",
"color": "150:150:250:150",
"group": "Sound",
"codes": {
"declaration": "\n// block_$id$ = $label$\nvar $port[sound]$ = context.destination;\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Input",
"name": "sound"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "subsound",
"language": "javascript",
"extension": "webaudio",
"help": "Sub Sound",
"label": "Sub Sound",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nSubSound = function(context, analyzer0, analyzer1) {\n var that = this;\n this.analyzer0 = analyzer0;\n this.analyzer1 = analyzer1;\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) {that.process(e)};\n}\n\nSubSound.prototype.process = function(e) {\n var in0 = new Float32Array(this.analyzer0.fftSize);\n var in1 = new Float32Array(this.analyzer1.fftSize);\n\n this.analyzer0.getFloatTimeDomainData(in0);\n this.analyzer1.getFloatTimeDomainData(in1);\n\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in0.length; ++i) {\n out[i] = in0[i] - in1[i];\n }\n}\n",
"declaration": "\n// block_$id$ = $label$\nvar block_$id$_in0 = context.createAnalyser();\nvar block_$id$_in1 = context.createAnalyser();\n\nvar $port[sound_input0]$ = block_$id$_in0;\nvar $port[sound_input1]$ = block_$id$_in1;\nvar block_$id$_obj = new SubSound(context, block_$id$_in0, block_$id$_in1);\nvar $port[output]$ = block_$id$_obj.node;\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input0",
"conn_type": "Input",
"label": "Sound"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input1",
"conn_type": "Input",
"label": "Input"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,37 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "subsoundfloat",
"language": "javascript",
"extension": "webaudio",
"help": " Sub Sound Float",
"label": "Sub Sound Float",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nSubSoundFloat = function(context, float_value) {\n var that = this;\n this.float = float_value;\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) { that.process(e) };\n}\n\nSubSoundFloat.prototype.process = function(e) {\n var in0 = e.inputBuffer.getChannelData(0);\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in0.length; ++i) {\n out[i] = in0[i] - this.float;\n }\n}\n",
"declaration": "\n// block_$id$ = $label$\n\nvar block_$id$_float = 0;\nvar block_$id$_obj = new SubSoundFloat(context, block_$id$_float);\n\nvar $port[float_input]$ = function(value){\n block_$id$_float = parseFloat(value);\n block_$id$_obj.float = block_$id$_float;\n return true;\n };\n\nvar $port[sound_input]$ = block_$id$_obj.node;\nvar $port[output]$ = block_$id$_obj.node;\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"name": "sound_input",
"conn_type": "Input",
"label": "Sound"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"name": "float_input",
"conn_type": "Input",
"label": "Float Value"
},
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "output"
}
]
}

View File

@ -0,0 +1,25 @@
{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "whitenoise",
"language": "javascript",
"extension": "webaudio",
"help": "White Noise",
"label": "White Noise",
"color": "50:150:250:150",
"group": "Sound",
"codes": {
"function": "\nWhiteNoise = function(context) {\n var that = this;\n this.x = 0; // Initial sample number\n this.context = context;\n this.node = context.createScriptProcessor(1024, 0, 2);\n this.node.onaudioprocess = function(e) { that.process(e) };\n}\n\nWhiteNoise.prototype.process = function(e) {\n var data_l = e.outputBuffer.getChannelData(0);\n var data_r = e.outputBuffer.getChannelData(1);\n for (var i = 0; i < data_l.length; ++i) {\n// data[i] = Math.sin(this.x++);\n data_l[i] = (Math.random() * 2) - 1;\n data_r[i] = (Math.random() * 2) - 1;\n }\n}\n",
"declaration": "\n// block_$id$ = $label$\nvar block_$id$ = new WhiteNoise(context);\n$port[sound]$ = block_$id$.node;\n\n"
},
"properties": [],
"ports": [
{
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound",
"label": "Sound",
"conn_type": "Output",
"name": "sound"
}
]
}

View File

@ -0,0 +1,30 @@
{
"source": "JSON",
"data": "CODE_TEMPLATE",
"version": 1,
"name": "webaudio",
"type": "mosaicode_lib_javascript_webaudio.extensions.html",
"description": "Javascript / webaudio code template",
"language": "javascript",
"command": "python3 -m webbrowser -t $dir_name$index.html\n",
"code_parts": [
"onload",
"function",
"declaration",
"execution",
"html"
],
"properties": [
{
"name": "title",
"label": "Title",
"value": "Title",
"type": "string"
}
],
"codes": {
"index.html": "<html>\n <head>\n <meta http-equiv=\"Cache-Control\" content=\"no-store\" />\n <!-- $author$ $license$ -->\n <title>$prop[title]$</title>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"theme.css\">\n <script src=\"functions.js\"></script>\n <script>\nvar context;\n\n $single_code[function]$\n\nfunction doit(){\ncontext = new (window.AudioContext || window.webkitAudioContext)();\n //declaration block\n $code[declaration]$\n\n //execution\n $code[execution]$\n\n //connections\n $connections$\n $single_code[onload]$\n}\n </script>\n </head>\n\n <body>\n <button type=\"button\" value=\"1\" onClick=\"doit();loadme();\" id=\"start\">Start Sound!</button><br>\n\n $code[html]$\n </body>\n</html>\n",
"theme.css": "/*\nDeveloped by: $author$\n*/\nhtml, body {\n background: #ffeead;\n color: #ff6f69;\n}\nh1, p {\n color: #ff6f69;\n}\n#navbar a {\n color: #ff6f69;\n}\n.item {\n background: #ffcc5c;\n}\nbutton {\n background: #ff6f69;\n color: #ffcc5c;\n}\n",
"functions.js": "/*\nDeveloped by: $author$\n*/\n$single_code[function]$\n"
}
}

180
examples/additive.mscd Normal file
View File

@ -0,0 +1,180 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "speaker",
"id": 1,
"collapsed": false,
"x": 740.0,
"y": 110.0,
"properties": []
},
{
"type": "oscillator",
"id": 2,
"collapsed": false,
"x": 310.0,
"y": 140.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "oscillator",
"id": 3,
"collapsed": false,
"x": 420.0,
"y": 230.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "mouseposition",
"id": 4,
"collapsed": false,
"x": 40.0,
"y": 110.0,
"properties": []
},
{
"type": "addsound",
"id": 6,
"collapsed": false,
"x": 580.0,
"y": 180.0,
"properties": []
},
{
"type": "multiplyfloat",
"id": 7,
"collapsed": false,
"x": 230.0,
"y": 250.0,
"properties": []
},
{
"type": "form.range",
"id": 8,
"collapsed": false,
"x": 50.0,
"y": 270.0,
"properties": [
{
"key": "value",
"value": "2.0"
},
{
"key": "label",
"value": "Multiply"
},
{
"key": "min",
"value": "0.0"
},
{
"key": "max",
"value": "100.0"
}
]
},
{
"type": "print",
"id": 9,
"collapsed": false,
"x": 280.0,
"y": 360.0,
"properties": [
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "spectrogram",
"id": 10,
"collapsed": false,
"x": 740.0,
"y": 260.0,
"properties": []
}
],
"connections": [
{
"from_block": 4,
"from_out": 0,
"to_block": 2,
"to_in": 1
},
{
"from_block": 2,
"from_out": 3,
"to_block": 6,
"to_in": 0
},
{
"from_block": 6,
"from_out": 2,
"to_block": 1,
"to_in": 0
},
{
"from_block": 3,
"from_out": 3,
"to_block": 6,
"to_in": 1
},
{
"from_block": 4,
"from_out": 0,
"to_block": 7,
"to_in": 0
},
{
"from_block": 7,
"from_out": 2,
"to_block": 3,
"to_in": 1
},
{
"from_block": 8,
"from_out": 0,
"to_block": 7,
"to_in": 1
},
{
"from_block": 8,
"from_out": 0,
"to_block": 9,
"to_in": 0
},
{
"from_block": 6,
"from_out": 2,
"to_block": 10,
"to_in": 0
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,118 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "sinewave",
"id": 1,
"collapsed": false,
"x": 540.0,
"y": 130.0,
"properties": [
{
"key": "width",
"value": "640"
},
{
"key": "height",
"value": "240"
}
]
},
{
"type": "oscillator",
"id": 2,
"collapsed": false,
"x": 260.0,
"y": 30.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "speaker",
"id": 3,
"collapsed": false,
"x": 550.0,
"y": 30.0,
"properties": []
},
{
"type": "range",
"id": 4,
"collapsed": false,
"x": 20.0,
"y": 30.0,
"properties": [
{
"key": "value",
"value": "200.0"
},
{
"key": "label",
"value": "Freq"
},
{
"key": "min",
"value": "200.0"
},
{
"key": "max",
"value": "2000.0"
}
]
},
{
"type": "print",
"id": 5,
"collapsed": false,
"x": 250.0,
"y": 200.0,
"properties": [
{
"key": "label",
"value": "Freq"
}
]
}
],
"connections": [
{
"from_block": 2,
"from_out": 3,
"to_block": 1,
"to_in": 0
},
{
"from_block": 2,
"from_out": 3,
"to_block": 3,
"to_in": 0
},
{
"from_block": 4,
"from_out": 0,
"to_block": 2,
"to_in": 1
},
{
"from_block": 4,
"from_out": 0,
"to_block": 5,
"to_in": 0
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,170 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "equals",
"id": 1,
"collapsed": false,
"x": 230.0,
"y": 90.0,
"properties": []
},
{
"type": "number",
"id": 2,
"collapsed": false,
"x": 30.0,
"y": 30.0,
"properties": [
{
"key": "value",
"value": "0.0"
},
{
"key": "label",
"value": "Number 1: "
},
{
"key": "min",
"value": "0.0"
},
{
"key": "max",
"value": "100.0"
}
]
},
{
"type": "number",
"id": 3,
"collapsed": false,
"x": 30.0,
"y": 140.0,
"properties": [
{
"key": "value",
"value": "0.0"
},
{
"key": "label",
"value": "Number 2: "
},
{
"key": "min",
"value": "0.0"
},
{
"key": "max",
"value": "100.0"
}
]
},
{
"type": "greaterthan",
"id": 5,
"collapsed": false,
"x": 230.0,
"y": 220.0,
"properties": []
},
{
"type": "float",
"id": 6,
"collapsed": false,
"x": 30.0,
"y": 280.0,
"properties": [
{
"key": "float_value",
"value": "10.0"
}
]
},
{
"type": "print",
"id": 8,
"collapsed": false,
"x": 850.0,
"y": 130.0,
"properties": [
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "or",
"id": 10,
"collapsed": false,
"x": 450.0,
"y": 130.0,
"properties": []
},
{
"type": "not",
"id": 11,
"collapsed": false,
"x": 660.0,
"y": 130.0,
"properties": []
}
],
"connections": [
{
"from_block": 2,
"from_out": 0,
"to_block": 1,
"to_in": 0
},
{
"from_block": 3,
"from_out": 0,
"to_block": 1,
"to_in": 1
},
{
"from_block": 3,
"from_out": 0,
"to_block": 5,
"to_in": 0
},
{
"from_block": 6,
"from_out": 0,
"to_block": 5,
"to_in": 1
},
{
"from_block": 1,
"from_out": 2,
"to_block": 10,
"to_in": 0
},
{
"from_block": 5,
"from_out": 2,
"to_block": 10,
"to_in": 1
},
{
"from_block": 10,
"from_out": 2,
"to_block": 11,
"to_in": 0
},
{
"from_block": 11,
"from_out": 1,
"to_block": 8,
"to_in": 5
}
],
"comments": [],
"authors": []
}

123
examples/beat-example.mscd Normal file
View File

@ -0,0 +1,123 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "print",
"id": 1,
"collapsed": false,
"x": 670.0,
"y": 40.0,
"properties": [
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "beat",
"id": 3,
"collapsed": false,
"x": 170.0,
"y": 40.0,
"properties": [
{
"key": "value",
"value": "1"
},
{
"key": "time",
"value": "1000"
}
]
},
{
"type": "inc",
"id": 4,
"collapsed": false,
"x": 470.0,
"y": 40.0,
"properties": [
{
"key": "value",
"value": "1"
},
{
"key": "step",
"value": "1"
}
]
},
{
"type": "button",
"id": 5,
"collapsed": false,
"x": 0.0,
"y": 40.0,
"properties": [
{
"key": "value",
"value": "1"
},
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "keyboardinput",
"id": 6,
"collapsed": false,
"x": 30.0,
"y": 220.0,
"properties": []
},
{
"type": "print",
"id": 7,
"collapsed": false,
"x": 300.0,
"y": 210.0,
"properties": [
{
"key": "label",
"value": "Label"
}
]
}
],
"connections": [
{
"from_block": 3,
"from_out": 0,
"to_block": 4,
"to_in": 1
},
{
"from_block": 4,
"from_out": 0,
"to_block": 1,
"to_in": 0
},
{
"from_block": 5,
"from_out": 0,
"to_block": 3,
"to_in": 1
},
{
"from_block": 6,
"from_out": 0,
"to_block": 7,
"to_in": 0
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,67 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "mouseposition",
"id": 1,
"collapsed": false,
"x": 170.0,
"y": 150.0,
"properties": []
},
{
"type": "background",
"id": 2,
"collapsed": false,
"x": 560.0,
"y": 140.0,
"properties": [
{
"key": "color",
"value": "#F00"
}
]
},
{
"type": "rgb",
"id": 3,
"collapsed": false,
"x": 380.0,
"y": 130.0,
"properties": []
}
],
"connections": [
{
"from_block": 1,
"from_out": 0,
"to_block": 3,
"to_in": 0
},
{
"from_block": 1,
"from_out": 1,
"to_block": 3,
"to_in": 1
},
{
"from_block": 1,
"from_out": 1,
"to_block": 3,
"to_in": 2
},
{
"from_block": 3,
"from_out": 3,
"to_block": 2,
"to_in": 0
}
],
"comments": [],
"authors": []
}

102
examples/date.mscd Normal file
View File

@ -0,0 +1,102 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "date",
"id": 1,
"collapsed": false,
"x": 240.0,
"y": 70.0,
"properties": []
},
{
"type": "print",
"id": 2,
"collapsed": false,
"x": 480.0,
"y": 190.0,
"properties": [
{
"key": "label",
"value": "Month"
}
]
},
{
"type": "button",
"id": 3,
"collapsed": false,
"x": 20.0,
"y": 30.0,
"properties": [
{
"key": "value",
"value": "1"
},
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "print",
"id": 4,
"collapsed": false,
"x": 490.0,
"y": 70.0,
"properties": [
{
"key": "label",
"value": "Day"
}
]
},
{
"type": "print",
"id": 5,
"collapsed": false,
"x": 490.0,
"y": 310.0,
"properties": [
{
"key": "label",
"value": "Year"
}
]
}
],
"connections": [
{
"from_block": 3,
"from_out": 0,
"to_block": 1,
"to_in": 3
},
{
"from_block": 1,
"from_out": 2,
"to_block": 2,
"to_in": 0
},
{
"from_block": 1,
"from_out": 1,
"to_block": 5,
"to_in": 0
},
{
"from_block": 1,
"from_out": 0,
"to_block": 4,
"to_in": 0
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,170 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "equals",
"id": 1,
"collapsed": false,
"x": 230.0,
"y": 90.0,
"properties": []
},
{
"type": "number",
"id": 2,
"collapsed": false,
"x": 30.0,
"y": 30.0,
"properties": [
{
"key": "value",
"value": "0.0"
},
{
"key": "label",
"value": "Number 1: "
},
{
"key": "min",
"value": "0.0"
},
{
"key": "max",
"value": "100.0"
}
]
},
{
"type": "number",
"id": 3,
"collapsed": false,
"x": 30.0,
"y": 140.0,
"properties": [
{
"key": "value",
"value": "0.0"
},
{
"key": "label",
"value": "Number 2: "
},
{
"key": "min",
"value": "0.0"
},
{
"key": "max",
"value": "100.0"
}
]
},
{
"type": "greaterthan",
"id": 5,
"collapsed": false,
"x": 230.0,
"y": 220.0,
"properties": []
},
{
"type": "Types.float",
"id": 6,
"collapsed": false,
"x": 30.0,
"y": 280.0,
"properties": [
{
"key": "float_value",
"value": "10.0"
}
]
},
{
"type": "print",
"id": 8,
"collapsed": false,
"x": 850.0,
"y": 130.0,
"properties": [
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "or",
"id": 10,
"collapsed": false,
"x": 450.0,
"y": 130.0,
"properties": []
},
{
"type": "not",
"id": 11,
"collapsed": false,
"x": 660.0,
"y": 130.0,
"properties": []
}
],
"connections": [
{
"from_block": 2,
"from_out": 0,
"to_block": 1,
"to_in": 0
},
{
"from_block": 3,
"from_out": 0,
"to_block": 1,
"to_in": 1
},
{
"from_block": 3,
"from_out": 0,
"to_block": 5,
"to_in": 0
},
{
"from_block": 6,
"from_out": 0,
"to_block": 5,
"to_in": 1
},
{
"from_block": 1,
"from_out": 2,
"to_block": 10,
"to_in": 0
},
{
"from_block": 5,
"from_out": 2,
"to_block": 10,
"to_in": 1
},
{
"from_block": 10,
"from_out": 2,
"to_block": 11,
"to_in": 0
},
{
"from_block": 11,
"from_out": 1,
"to_block": 8,
"to_in": 5
}
],
"comments": [],
"authors": []
}

103
examples/envelope.mscd Normal file
View File

@ -0,0 +1,103 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "speaker",
"id": 1,
"collapsed": false,
"x": 620.0,
"y": 130.0,
"properties": []
},
{
"type": "oscillator",
"id": 2,
"collapsed": false,
"x": 230.0,
"y": 210.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "adsr",
"id": 4,
"collapsed": false,
"x": 410.0,
"y": 230.0,
"properties": [
{
"key": "a",
"value": "200"
},
{
"key": "d",
"value": "20"
},
{
"key": "s",
"value": "100"
},
{
"key": "r",
"value": "50"
},
{
"key": "g",
"value": "0.8"
}
]
},
{
"type": "button",
"id": 5,
"collapsed": false,
"x": 110.0,
"y": 330.0,
"properties": [
{
"key": "value",
"value": "1"
},
{
"key": "label",
"value": "Label"
}
]
}
],
"connections": [
{
"from_block": 2,
"from_out": 3,
"to_block": 4,
"to_in": 0
},
{
"from_block": 4,
"from_out": 7,
"to_block": 1,
"to_in": 0
},
{
"from_block": 5,
"from_out": 0,
"to_block": 4,
"to_in": 6
}
],
"comments": [],
"authors": []
}

110
examples/filter.mscd Normal file
View File

@ -0,0 +1,110 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "whitenoise",
"id": 2,
"collapsed": false,
"x": 250.0,
"y": 260.0,
"properties": []
},
{
"type": "oscillator",
"id": 3,
"collapsed": false,
"x": 270.0,
"y": 70.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "mulsound",
"id": 4,
"collapsed": false,
"x": 440.0,
"y": 160.0,
"properties": []
},
{
"type": "speaker",
"id": 6,
"collapsed": false,
"x": 690.0,
"y": 120.0,
"properties": []
},
{
"type": "sinewave",
"id": 7,
"collapsed": false,
"x": 680.0,
"y": 230.0,
"properties": [
{
"key": "width",
"value": "640"
},
{
"key": "height",
"value": "240"
}
]
},
{
"type": "peaking",
"id": 8,
"collapsed": false,
"x": 520.0,
"y": 310.0,
"properties": []
}
],
"connections": [
{
"from_block": 2,
"from_out": 0,
"to_block": 4,
"to_in": 1
},
{
"from_block": 3,
"from_out": 3,
"to_block": 4,
"to_in": 0
},
{
"from_block": 4,
"from_out": 2,
"to_block": 8,
"to_in": 0
},
{
"from_block": 8,
"from_out": 4,
"to_block": 7,
"to_in": 0
},
{
"from_block": 8,
"from_out": 4,
"to_block": 6,
"to_in": 0
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,118 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "oscillator",
"id": 2,
"collapsed": false,
"x": 260.0,
"y": 30.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "speaker",
"id": 3,
"collapsed": false,
"x": 550.0,
"y": 30.0,
"properties": []
},
{
"type": "range",
"id": 4,
"collapsed": false,
"x": 20.0,
"y": 30.0,
"properties": [
{
"key": "value",
"value": "200.0"
},
{
"key": "label",
"value": "Freq"
},
{
"key": "min",
"value": "200.0"
},
{
"key": "max",
"value": "2000.0"
}
]
},
{
"type": "print",
"id": 5,
"collapsed": false,
"x": 250.0,
"y": 280.0,
"properties": [
{
"key": "label",
"value": "Freq"
}
]
},
{
"type": "freqbar",
"id": 6,
"collapsed": false,
"x": 570.0,
"y": 160.0,
"properties": [
{
"key": "width",
"value": "640"
},
{
"key": "height",
"value": "240"
}
]
}
],
"connections": [
{
"from_block": 2,
"from_out": 4,
"to_block": 3,
"to_in": 1
},
{
"from_block": 4,
"from_out": 1,
"to_block": 2,
"to_in": 2
},
{
"from_block": 4,
"from_out": 1,
"to_block": 5,
"to_in": 1
},
{
"from_block": 2,
"from_out": 4,
"to_block": 6,
"to_in": 1
}
],
"comments": [],
"authors": []
}

83
examples/hour.mscd Normal file
View File

@ -0,0 +1,83 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "print",
"id": 2,
"collapsed": false,
"x": 470.0,
"y": 190.0,
"properties": [
{
"key": "label",
"value": "time"
}
]
},
{
"type": "button",
"id": 3,
"collapsed": false,
"x": 0.0,
"y": 0.0,
"properties": [
{
"key": "value",
"value": "1"
},
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "hour",
"id": 4,
"collapsed": false,
"x": 250.0,
"y": 90.0,
"properties": []
},
{
"type": "print",
"id": 5,
"collapsed": false,
"x": 530.0,
"y": 20.0,
"properties": [
{
"key": "label",
"value": "ms"
}
]
}
],
"connections": [
{
"from_block": 3,
"from_out": 1,
"to_block": 4,
"to_in": 6
},
{
"from_block": 4,
"from_out": 5,
"to_block": 2,
"to_in": 1
},
{
"from_block": 4,
"from_out": 4,
"to_block": 5,
"to_in": 1
}
],
"comments": [],
"authors": []
}

208
examples/keyboard.mscd Normal file
View File

@ -0,0 +1,208 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "print",
"id": 2,
"collapsed": false,
"x": 440.0,
"y": 50.0,
"properties": [
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "char2float",
"id": 5,
"collapsed": false,
"x": 210.0,
"y": 160.0,
"properties": [
{
"key": "float",
"value": "60"
},
{
"key": "char",
"value": "a"
}
]
},
{
"type": "char2float",
"id": 6,
"collapsed": false,
"x": 210.0,
"y": 240.0,
"properties": [
{
"key": "float",
"value": "62.0"
},
{
"key": "char",
"value": "s"
}
]
},
{
"type": "char2float",
"id": 7,
"collapsed": false,
"x": 210.0,
"y": 310.0,
"properties": [
{
"key": "float",
"value": "64.0"
},
{
"key": "char",
"value": "d"
}
]
},
{
"type": "midi2freq",
"id": 8,
"collapsed": false,
"x": 390.0,
"y": 240.0,
"properties": []
},
{
"type": "oscillator",
"id": 9,
"collapsed": false,
"x": 570.0,
"y": 210.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "speaker",
"id": 10,
"collapsed": false,
"x": 840.0,
"y": 420.0,
"properties": []
},
{
"type": "adsr",
"id": 11,
"collapsed": false,
"x": 750.0,
"y": 230.0,
"properties": [
{
"key": "a",
"value": "50.0"
},
{
"key": "d",
"value": "20.0"
},
{
"key": "s",
"value": "100.0"
},
{
"key": "r",
"value": "50.0"
},
{
"key": "g",
"value": "0.5"
}
]
},
{
"type": "keyboard",
"id": 12,
"collapsed": false,
"x": 40.0,
"y": 100.0,
"properties": []
}
],
"connections": [
{
"from_block": 9,
"from_out": 4,
"to_block": 11,
"to_in": 1
},
{
"from_block": 11,
"from_out": 3,
"to_block": 10,
"to_in": 1
},
{
"from_block": 12,
"from_out": 2,
"to_block": 5,
"to_in": 1
},
{
"from_block": 12,
"from_out": 2,
"to_block": 2,
"to_in": 2
},
{
"from_block": 12,
"from_out": 2,
"to_block": 6,
"to_in": 1
},
{
"from_block": 12,
"from_out": 2,
"to_block": 7,
"to_in": 1
},
{
"from_block": 5,
"from_out": 2,
"to_block": 8,
"to_in": 1
},
{
"from_block": 6,
"from_out": 2,
"to_block": 8,
"to_in": 1
},
{
"from_block": 7,
"from_out": 2,
"to_block": 8,
"to_in": 1
},
{
"from_block": 8,
"from_out": 2,
"to_block": 9,
"to_in": 2
}
],
"comments": [],
"authors": []
}

188
examples/metronome.mscd Normal file
View File

@ -0,0 +1,188 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "adsr",
"id": 2,
"collapsed": false,
"x": 720.0,
"y": 150.0,
"properties": [
{
"key": "a",
"value": "100.0"
},
{
"key": "d",
"value": "20.0"
},
{
"key": "s",
"value": "100.0"
},
{
"key": "r",
"value": "50.0"
},
{
"key": "g",
"value": "0.8"
}
]
},
{
"type": "speaker",
"id": 3,
"collapsed": false,
"x": 790.0,
"y": 360.0,
"properties": []
},
{
"type": "metronome",
"id": 10,
"collapsed": false,
"x": 320.0,
"y": 80.0,
"properties": [
{
"key": "value",
"value": "1.0"
},
{
"key": "time",
"value": "100.0"
}
]
},
{
"type": "button",
"id": 11,
"collapsed": false,
"x": 40.0,
"y": 60.0,
"properties": [
{
"key": "value",
"value": "1"
},
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "random",
"id": 13,
"collapsed": false,
"x": 190.0,
"y": 180.0,
"properties": [
{
"key": "min",
"value": "1.0"
},
{
"key": "max",
"value": "12.0"
}
]
},
{
"type": "multiplyfloat",
"id": 14,
"collapsed": false,
"x": 400.0,
"y": 200.0,
"properties": []
},
{
"type": "float",
"id": 15,
"collapsed": false,
"x": 190.0,
"y": 290.0,
"properties": [
{
"key": "float_value",
"value": "100.0"
}
]
},
{
"type": "oscillator",
"id": 16,
"collapsed": false,
"x": 560.0,
"y": 280.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
}
],
"connections": [
{
"from_block": 2,
"from_out": 7,
"to_block": 3,
"to_in": 0
},
{
"from_block": 10,
"from_out": 0,
"to_block": 2,
"to_in": 6
},
{
"from_block": 11,
"from_out": 0,
"to_block": 10,
"to_in": 1
},
{
"from_block": 13,
"from_out": 0,
"to_block": 14,
"to_in": 0
},
{
"from_block": 15,
"from_out": 0,
"to_block": 14,
"to_in": 1
},
{
"from_block": 14,
"from_out": 2,
"to_block": 16,
"to_in": 1
},
{
"from_block": 16,
"from_out": 3,
"to_block": 2,
"to_in": 0
},
{
"from_block": 10,
"from_out": 0,
"to_block": 13,
"to_in": 1
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,103 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "modulus",
"id": 13,
"collapsed": false,
"x": 370.0,
"y": 100.0,
"properties": []
},
{
"type": "number",
"id": 14,
"collapsed": false,
"x": 160.0,
"y": 30.0,
"properties": [
{
"key": "value",
"value": "0.0"
},
{
"key": "label",
"value": "Dividend: "
},
{
"key": "min",
"value": "0.0"
},
{
"key": "max",
"value": "100.0"
}
]
},
{
"type": "number",
"id": 15,
"collapsed": false,
"x": 160.0,
"y": 170.0,
"properties": [
{
"key": "value",
"value": "0"
},
{
"key": "label",
"value": "Label"
},
{
"key": "min",
"value": "0"
},
{
"key": "max",
"value": "100"
}
]
},
{
"type": "print",
"id": 16,
"collapsed": false,
"x": 620.0,
"y": 70.0,
"properties": [
{
"key": "label",
"value": "Rest: "
}
]
}
],
"connections": [
{
"from_block": 14,
"from_out": 1,
"to_block": 13,
"to_in": 1
},
{
"from_block": 15,
"from_out": 1,
"to_block": 13,
"to_in": 2
},
{
"from_block": 13,
"from_out": 3,
"to_block": 16,
"to_in": 1
}
],
"comments": [],
"authors": []
}

79
examples/mouseclick.mscd Normal file
View File

@ -0,0 +1,79 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "mouseclick",
"id": 1,
"collapsed": false,
"x": 10.0,
"y": 100.0,
"properties": []
},
{
"type": "print",
"id": 2,
"collapsed": false,
"x": 350.0,
"y": 60.0,
"properties": [
{
"key": "label",
"value": "x"
}
]
},
{
"type": "print",
"id": 4,
"collapsed": false,
"x": 350.0,
"y": 190.0,
"properties": [
{
"key": "label",
"value": "y"
}
]
},
{
"type": "print",
"id": 5,
"collapsed": false,
"x": 360.0,
"y": 320.0,
"properties": [
{
"key": "label",
"value": "button"
}
]
}
],
"connections": [
{
"from_block": 1,
"from_out": 1,
"to_block": 2,
"to_in": 1
},
{
"from_block": 1,
"from_out": 2,
"to_block": 4,
"to_in": 1
},
{
"from_block": 1,
"from_out": 3,
"to_block": 5,
"to_in": 1
}
],
"comments": [],
"authors": []
}

75
examples/noiseFilter.mscd Normal file
View File

@ -0,0 +1,75 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "whitenoise",
"id": 1,
"collapsed": false,
"x": 130.0,
"y": 160.0,
"properties": []
},
{
"type": "speaker",
"id": 2,
"collapsed": false,
"x": 490.0,
"y": 130.0,
"properties": []
},
{
"type": "highpass",
"id": 3,
"collapsed": false,
"x": 290.0,
"y": 160.0,
"properties": []
},
{
"type": "range",
"id": 4,
"collapsed": false,
"x": 80.0,
"y": 260.0,
"properties": [
{
"key": "value",
"value": "0.0"
},
{
"key": "label",
"value": "Label"
},
{
"key": "min",
"value": "0.0"
},
{
"key": "max",
"value": "10000.0"
}
]
}
],
"connections": [
{
"from_block": 1,
"from_out": 0,
"to_block": 3,
"to_in": 0
},
{
"from_block": 3,
"from_out": 3,
"to_block": 2,
"to_in": 0
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,153 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "orientationchange",
"id": 1,
"collapsed": false,
"x": 100.0,
"y": 180.0,
"properties": []
},
{
"type": "bool2float",
"id": 6,
"collapsed": false,
"x": 300.0,
"y": 50.0,
"properties": []
},
{
"type": "rgb",
"id": 8,
"collapsed": false,
"x": 560.0,
"y": 100.0,
"properties": []
},
{
"type": "background",
"id": 10,
"collapsed": false,
"x": 760.0,
"y": 150.0,
"properties": [
{
"key": "color",
"value": "#000000"
}
]
},
{
"type": "bool2float",
"id": 11,
"collapsed": false,
"x": 310.0,
"y": 320.0,
"properties": []
},
{
"type": "rgb",
"id": 12,
"collapsed": false,
"x": 560.0,
"y": 210.0,
"properties": []
},
{
"type": "float",
"id": 13,
"collapsed": false,
"x": 310.0,
"y": 220.0,
"properties": [
{
"key": "float_value",
"value": "150.0"
}
]
},
{
"type": "float",
"id": 15,
"collapsed": false,
"x": 310.0,
"y": 130.0,
"properties": [
{
"key": "float_value",
"value": "220.0"
}
]
}
],
"connections": [
{
"from_block": 1,
"from_out": 1,
"to_block": 6,
"to_in": 1
},
{
"from_block": 6,
"from_out": 2,
"to_block": 8,
"to_in": 1
},
{
"from_block": 8,
"from_out": 4,
"to_block": 10,
"to_in": 1
},
{
"from_block": 1,
"from_out": 2,
"to_block": 11,
"to_in": 1
},
{
"from_block": 11,
"from_out": 2,
"to_block": 12,
"to_in": 3
},
{
"from_block": 12,
"from_out": 4,
"to_block": 10,
"to_in": 1
},
{
"from_block": 13,
"from_out": 1,
"to_block": 12,
"to_in": 1
},
{
"from_block": 13,
"from_out": 1,
"to_block": 12,
"to_in": 2
},
{
"from_block": 15,
"from_out": 1,
"to_block": 8,
"to_in": 2
},
{
"from_block": 15,
"from_out": 1,
"to_block": 8,
"to_in": 3
}
],
"comments": [],
"authors": []
}

45
examples/playback.mscd Normal file
View File

@ -0,0 +1,45 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "playback",
"id": 1,
"collapsed": false,
"x": 180.0,
"y": 110.0,
"properties": [
{
"key": "loop",
"value": "False"
},
{
"key": "label",
"value": "Playback"
}
]
},
{
"type": "speaker",
"id": 2,
"collapsed": false,
"x": 440.0,
"y": 220.0,
"properties": []
}
],
"connections": [
{
"from_block": 1,
"from_out": 0,
"to_block": 2,
"to_in": 0
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,234 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "button",
"id": 1,
"collapsed": false,
"x": 20.0,
"y": 0.0,
"properties": [
{
"key": "value",
"value": "1.0"
},
{
"key": "label",
"value": "Start"
}
]
},
{
"type": "random",
"id": 2,
"collapsed": false,
"x": 530.0,
"y": 90.0,
"properties": [
{
"key": "min",
"value": "50.0"
},
{
"key": "max",
"value": "100.0"
}
]
},
{
"type": "beat",
"id": 3,
"collapsed": false,
"x": 260.0,
"y": 30.0,
"properties": [
{
"key": "value",
"value": "5.0"
},
{
"key": "time",
"value": "500.0"
}
]
},
{
"type": "button",
"id": 4,
"collapsed": false,
"x": 20.0,
"y": 80.0,
"properties": [
{
"key": "value",
"value": "1.0"
},
{
"key": "label",
"value": "Stop"
}
]
},
{
"type": "print",
"id": 5,
"collapsed": false,
"x": 700.0,
"y": 50.0,
"properties": [
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "midi2freq",
"id": 6,
"collapsed": false,
"x": 700.0,
"y": 180.0,
"properties": []
},
{
"type": "oscillator",
"id": 7,
"collapsed": false,
"x": 280.0,
"y": 310.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "adsr",
"id": 9,
"collapsed": false,
"x": 490.0,
"y": 310.0,
"properties": [
{
"key": "a",
"value": "50.0"
},
{
"key": "d",
"value": "2.0"
},
{
"key": "s",
"value": "100.0"
},
{
"key": "r",
"value": "50.0"
},
{
"key": "g",
"value": "0.5"
}
]
},
{
"type": "speaker",
"id": 10,
"collapsed": false,
"x": 700.0,
"y": 310.0,
"properties": []
},
{
"type": "sinewave",
"id": 12,
"collapsed": false,
"x": 700.0,
"y": 400.0,
"properties": [
{
"key": "width",
"value": "640"
},
{
"key": "height",
"value": "240"
}
]
}
],
"connections": [
{
"from_block": 1,
"from_out": 1,
"to_block": 3,
"to_in": 2
},
{
"from_block": 3,
"from_out": 1,
"to_block": 2,
"to_in": 2
},
{
"from_block": 4,
"from_out": 1,
"to_block": 3,
"to_in": 3
},
{
"from_block": 2,
"from_out": 1,
"to_block": 5,
"to_in": 1
},
{
"from_block": 2,
"from_out": 1,
"to_block": 6,
"to_in": 1
},
{
"from_block": 6,
"from_out": 2,
"to_block": 7,
"to_in": 2
},
{
"from_block": 9,
"from_out": 3,
"to_block": 10,
"to_in": 1
},
{
"from_block": 7,
"from_out": 4,
"to_block": 9,
"to_in": 1
},
{
"from_block": 3,
"from_out": 1,
"to_block": 9,
"to_in": 2
},
{
"from_block": 9,
"from_out": 3,
"to_block": 12,
"to_in": 1
}
],
"comments": [],
"authors": []
}

112
examples/range-example.mscd Normal file
View File

@ -0,0 +1,112 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "range",
"id": 1,
"collapsed": false,
"x": 310.0,
"y": 80.0,
"properties": [
{
"key": "value",
"value": "150.0"
},
{
"key": "label",
"value": "Label"
},
{
"key": "min",
"value": "50.0"
},
{
"key": "max",
"value": "200.0"
}
]
},
{
"type": "print",
"id": 2,
"collapsed": false,
"x": 660.0,
"y": 190.0,
"properties": [
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "check",
"id": 4,
"collapsed": false,
"x": 0.0,
"y": 0.0,
"properties": [
{
"key": "value",
"value": "0"
},
{
"key": "label",
"value": "Label"
}
]
},
{
"type": "number",
"id": 5,
"collapsed": false,
"x": 120.0,
"y": 340.0,
"properties": [
{
"key": "value",
"value": "0"
},
{
"key": "label",
"value": "Label"
},
{
"key": "min",
"value": "0"
},
{
"key": "max",
"value": "100"
}
]
}
],
"connections": [
{
"from_block": 1,
"from_out": 1,
"to_block": 2,
"to_in": 1
},
{
"from_block": 5,
"from_out": 1,
"to_block": 1,
"to_in": 2
},
{
"from_block": 4,
"from_out": 1,
"to_block": 5,
"to_in": 2
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,56 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "select",
"id": 1,
"collapsed": false,
"x": 90.0,
"y": 120.0,
"properties": [
{
"key": "label",
"value": "wave type"
},
{
"key": "values",
"value": "sine,sawtooth,triangle,square"
}
]
},
{
"type": "print",
"id": 2,
"collapsed": false,
"x": 290.0,
"y": 40.0,
"properties": [
{
"key": "label",
"value": "Str"
}
]
}
],
"connections": [
{
"from_block": 1,
"from_out": 2,
"to_block": 2,
"to_in": 1
},
{
"from_block": 1,
"from_out": 1,
"to_block": 2,
"to_in": 4
}
],
"comments": [],
"authors": []
}

56
examples/simple_osc.mscd Normal file
View File

@ -0,0 +1,56 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "oscillator",
"id": 1,
"collapsed": false,
"x": 40.0,
"y": 130.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "speaker",
"id": 2,
"collapsed": false,
"x": 220.0,
"y": 130.0,
"properties": []
}
],
"connections": [
{
"from_block": 1,
"from_out": 3,
"to_block": 2,
"to_in": 0
}
],
"comments": [
{
"x": 20.0,
"y": 10.0,
"properties": [
{
"key": "text",
"value": "This is a simple oscillator"
}
]
}
],
"authors": []
}

154
examples/spectogram.mscd Normal file
View File

@ -0,0 +1,154 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "speaker",
"id": 1,
"collapsed": false,
"x": 630.0,
"y": 110.0,
"properties": []
},
{
"type": "oscillator",
"id": 2,
"collapsed": false,
"x": 220.0,
"y": 70.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "mouseposition",
"id": 3,
"collapsed": false,
"x": 10.0,
"y": 120.0,
"properties": []
},
{
"type": "GUI.print",
"id": 4,
"collapsed": false,
"x": 280.0,
"y": 280.0,
"properties": [
{
"key": "label",
"value": "x"
}
]
},
{
"type": "oscillator",
"id": 5,
"collapsed": false,
"x": 320.0,
"y": 170.0,
"properties": [
{
"key": "freq",
"value": "440"
},
{
"key": "type",
"value": "sine"
}
]
},
{
"type": "addsound",
"id": 6,
"collapsed": false,
"x": 460.0,
"y": 90.0,
"properties": []
},
{
"type": "GUI.print",
"id": 7,
"collapsed": false,
"x": 270.0,
"y": 400.0,
"properties": [
{
"key": "label",
"value": "y"
}
]
},
{
"type": "GUI.spectrogram",
"id": 8,
"collapsed": false,
"x": 630.0,
"y": 240.0,
"properties": []
}
],
"connections": [
{
"from_block": 3,
"from_out": 0,
"to_block": 2,
"to_in": 1
},
{
"from_block": 3,
"from_out": 0,
"to_block": 4,
"to_in": 0
},
{
"from_block": 3,
"from_out": 1,
"to_block": 5,
"to_in": 1
},
{
"from_block": 2,
"from_out": 3,
"to_block": 6,
"to_in": 0
},
{
"from_block": 5,
"from_out": 3,
"to_block": 6,
"to_in": 1
},
{
"from_block": 6,
"from_out": 2,
"to_block": 1,
"to_in": 0
},
{
"from_block": 3,
"from_out": 1,
"to_block": 7,
"to_in": 0
},
{
"from_block": 6,
"from_out": 2,
"to_block": 8,
"to_in": 0
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,50 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "print",
"id": 2,
"collapsed": false,
"x": 450.0,
"y": 110.0,
"properties": [
{
"key": "label",
"value": "Str"
}
]
},
{
"type": "text",
"id": 3,
"collapsed": false,
"x": 0.0,
"y": 0.0,
"properties": [
{
"key": "value",
"value": ""
},
{
"key": "label",
"value": "Label"
}
]
}
],
"connections": [
{
"from_block": 3,
"from_out": 1,
"to_block": 2,
"to_in": 4
}
],
"comments": [],
"authors": []
}

View File

@ -0,0 +1,50 @@
{
"source": "XML_CONVERTED",
"data": "DIAGRAM",
"version": "0.0.1",
"zoom": 1.0,
"language": "javascript",
"code_template": {},
"blocks": [
{
"type": "title",
"id": 1,
"collapsed": false,
"x": 370.0,
"y": 140.0,
"properties": [
{
"key": "title",
"value": "Mosaicode - Document Title"
}
]
},
{
"type": "text",
"id": 2,
"collapsed": false,
"x": 60.0,
"y": 100.0,
"properties": [
{
"key": "value",
"value": ""
},
{
"key": "label",
"value": "Title: "
}
]
}
],
"connections": [
{
"from_block": 2,
"from_out": 1,
"to_block": 1,
"to_in": 1
}
],
"comments": [],
"authors": []
}

12
ports/bool.json Normal file
View File

@ -0,0 +1,12 @@
{
"source": "JSON",
"data": "PORT",
"version": "0.0.1",
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.bool",
"language": "javascript",
"hint": "BOOL",
"color": "#000",
"multiple": true,
"var_name": "$block[label]$_$block[id]$_$port[name]$",
"code": "$output$.push($input$);\n"
}

12
ports/char.json Normal file
View File

@ -0,0 +1,12 @@
{
"source": "JSON",
"data": "PORT",
"version": "0.0.1",
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.char",
"language": "javascript",
"hint": "CHAR",
"color": "#000",
"multiple": true,
"var_name": "$block[label]$_$block[id]$_$port[name]$",
"code": "$output$.push($input$);\n"
}

12
ports/color.json Normal file
View File

@ -0,0 +1,12 @@
{
"source": "JSON",
"data": "PORT",
"version": "0.0.1",
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.color",
"language": "javascript",
"hint": "COLOR",
"color": "#000",
"multiple": true,
"var_name": "$block[label]$_$block[id]$_$port[name]$",
"code": "$output$.push($input$);\n"
}

12
ports/float.json Normal file
View File

@ -0,0 +1,12 @@
{
"source": "JSON",
"data": "PORT",
"version": "0.0.1",
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.float",
"language": "javascript",
"hint": "FLOAT",
"color": "#000",
"multiple": true,
"var_name": "$block[label]$_$block[id]$_$port[name]$",
"code": "$output$.push($input$);\n"
}

12
ports/midi.json Normal file
View File

@ -0,0 +1,12 @@
{
"source": "JSON",
"data": "PORT",
"version": "0.0.1",
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.midi",
"language": "javascript",
"hint": "MIDI",
"color": "#000",
"multiple": true,
"var_name": "$block[label]$_$block[id]$_$port[name]$",
"code": "$output$.push($input$);\n"
}

12
ports/point.json Normal file
View File

@ -0,0 +1,12 @@
{
"source": "JSON",
"data": "PORT",
"version": "0.0.1",
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.point",
"language": "javascript",
"hint": "POINT",
"color": "#000",
"multiple": true,
"var_name": "$block[label]$_$block[id]$_$port[name]$",
"code": "$output$.push($input$);\n"
}

Some files were not shown because too many files have changed in this diff Show More