From 355594d3c872a1cb24b5d332e86a9d385d4835f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Schiavoni?= Date: Thu, 17 Sep 2026 18:13:02 -0300 Subject: [PATCH] Copy from Alexandre repository --- blocks/GUI/background.json | 33 +++ blocks/GUI/button.json | 42 ++++ blocks/GUI/check.json | 45 ++++ blocks/GUI/color.json | 45 ++++ blocks/GUI/freqbar.json | 44 ++++ blocks/GUI/number.json | 63 +++++ blocks/GUI/print.json | 62 +++++ blocks/GUI/range.json | 63 +++++ blocks/GUI/select.json | 47 ++++ blocks/GUI/sinewave.json | 44 ++++ blocks/GUI/spectrogram.json | 26 ++ blocks/GUI/text.json | 45 ++++ blocks/GUI/title.json | 32 +++ blocks/MIDI/MIDI.json | 31 +++ blocks/MIDI/midi2freq.json | 30 +++ blocks/MIDI/stripmidi.json | 36 +++ blocks/Types/float.json | 32 +++ blocks/Types/point.json | 62 +++++ blocks/Types/string.json | 32 +++ blocks/arithmetics/addfloat.json | 36 +++ blocks/arithmetics/and.json | 38 +++ blocks/arithmetics/dividefloat.json | 36 +++ blocks/arithmetics/equals.json | 38 +++ blocks/arithmetics/greaterthan.json | 38 +++ blocks/arithmetics/greaterthanorequals.json | 38 +++ blocks/arithmetics/inc.json | 55 ++++ blocks/arithmetics/lessthan.json | 38 +++ blocks/arithmetics/lessthanorequals.json | 38 +++ blocks/arithmetics/maxfloat.json | 36 +++ blocks/arithmetics/modulus.json | 38 +++ blocks/arithmetics/multiplyfloat.json | 36 +++ blocks/arithmetics/not.json | 32 +++ blocks/arithmetics/notequals.json | 38 +++ blocks/arithmetics/or.json | 38 +++ blocks/arithmetics/subtractfloat.json | 36 +++ blocks/conversion/bool2float.json | 30 +++ blocks/conversion/char2float.json | 46 ++++ blocks/conversion/rgb.json | 42 ++++ blocks/input devices/date.json | 42 ++++ blocks/input devices/deviceorientation.json | 37 +++ blocks/input devices/hour.json | 54 ++++ blocks/input devices/keyboard.json | 31 +++ blocks/input devices/metronome.json | 57 +++++ blocks/input devices/microphone.json | 25 ++ blocks/input devices/mouseclick.json | 37 +++ blocks/input devices/mouseposition.json | 31 +++ blocks/input devices/orientationchange.json | 32 +++ blocks/input devices/random.json | 49 ++++ blocks/input devices/upkeyboard.json | 31 +++ blocks/sound/addsound.json | 37 +++ blocks/sound/addsoundfloat.json | 37 +++ blocks/sound/adsr.json | 113 +++++++++ blocks/sound/channelmerger.json | 37 +++ blocks/sound/delay.json | 40 +++ blocks/sound/distortion.json | 38 +++ blocks/sound/divsound.json | 37 +++ blocks/sound/divsoundfloat.json | 37 +++ blocks/sound/filter.json | 98 ++++++++ blocks/sound/gain.json | 52 ++++ blocks/sound/hrtf.json | 120 +++++++++ blocks/sound/mulsound.json | 37 +++ blocks/sound/mulsoundfloat.json | 37 +++ blocks/sound/oscillator.json | 65 +++++ blocks/sound/playback.json | 40 +++ blocks/sound/speaker.json | 24 ++ blocks/sound/subsound.json | 37 +++ blocks/sound/subsoundfloat.json | 37 +++ blocks/sound/whitenoise.json | 25 ++ codetemplates/webaudio.json | 30 +++ examples/additive.mscd | 180 ++++++++++++++ examples/analyser-example.mscd | 118 +++++++++ ...arithmetic_operations_logical_example.mscd | 170 +++++++++++++ examples/beat-example.mscd | 123 +++++++++ examples/color_example.mscd | 67 +++++ examples/date.mscd | 102 ++++++++ examples/device_orientation_example.mscd | 170 +++++++++++++ examples/envelope.mscd | 103 ++++++++ examples/filter.mscd | 110 ++++++++ examples/freqbar-example.mscd | 118 +++++++++ examples/hour.mscd | 83 +++++++ examples/keyboard.mscd | 208 ++++++++++++++++ examples/metronome.mscd | 188 ++++++++++++++ examples/modulus_example.mscd | 103 ++++++++ examples/mouseclick.mscd | 79 ++++++ examples/noiseFilter.mscd | 75 ++++++ examples/orientation_change_example.mscd | 153 ++++++++++++ examples/playback.mscd | 45 ++++ examples/random-example.mscd | 234 ++++++++++++++++++ examples/range-example.mscd | 112 +++++++++ examples/select_example.mscd | 56 +++++ examples/simple_osc.mscd | 56 +++++ examples/spectogram.mscd | 154 ++++++++++++ examples/text_example.mscd | 50 ++++ examples/title_example.mscd | 50 ++++ ports/bool.json | 12 + ports/char.json | 12 + ports/color.json | 12 + ports/float.json | 12 + ports/midi.json | 12 + ports/point.json | 12 + ports/sound.json | 12 + ports/string.json | 12 + 102 files changed, 5948 insertions(+) create mode 100644 blocks/GUI/background.json create mode 100644 blocks/GUI/button.json create mode 100644 blocks/GUI/check.json create mode 100644 blocks/GUI/color.json create mode 100644 blocks/GUI/freqbar.json create mode 100644 blocks/GUI/number.json create mode 100644 blocks/GUI/print.json create mode 100644 blocks/GUI/range.json create mode 100644 blocks/GUI/select.json create mode 100644 blocks/GUI/sinewave.json create mode 100644 blocks/GUI/spectrogram.json create mode 100644 blocks/GUI/text.json create mode 100644 blocks/GUI/title.json create mode 100644 blocks/MIDI/MIDI.json create mode 100644 blocks/MIDI/midi2freq.json create mode 100644 blocks/MIDI/stripmidi.json create mode 100644 blocks/Types/float.json create mode 100644 blocks/Types/point.json create mode 100644 blocks/Types/string.json create mode 100644 blocks/arithmetics/addfloat.json create mode 100644 blocks/arithmetics/and.json create mode 100644 blocks/arithmetics/dividefloat.json create mode 100644 blocks/arithmetics/equals.json create mode 100644 blocks/arithmetics/greaterthan.json create mode 100644 blocks/arithmetics/greaterthanorequals.json create mode 100644 blocks/arithmetics/inc.json create mode 100644 blocks/arithmetics/lessthan.json create mode 100644 blocks/arithmetics/lessthanorequals.json create mode 100644 blocks/arithmetics/maxfloat.json create mode 100644 blocks/arithmetics/modulus.json create mode 100644 blocks/arithmetics/multiplyfloat.json create mode 100644 blocks/arithmetics/not.json create mode 100644 blocks/arithmetics/notequals.json create mode 100644 blocks/arithmetics/or.json create mode 100644 blocks/arithmetics/subtractfloat.json create mode 100644 blocks/conversion/bool2float.json create mode 100644 blocks/conversion/char2float.json create mode 100644 blocks/conversion/rgb.json create mode 100644 blocks/input devices/date.json create mode 100644 blocks/input devices/deviceorientation.json create mode 100644 blocks/input devices/hour.json create mode 100644 blocks/input devices/keyboard.json create mode 100644 blocks/input devices/metronome.json create mode 100644 blocks/input devices/microphone.json create mode 100644 blocks/input devices/mouseclick.json create mode 100644 blocks/input devices/mouseposition.json create mode 100644 blocks/input devices/orientationchange.json create mode 100644 blocks/input devices/random.json create mode 100644 blocks/input devices/upkeyboard.json create mode 100644 blocks/sound/addsound.json create mode 100644 blocks/sound/addsoundfloat.json create mode 100644 blocks/sound/adsr.json create mode 100644 blocks/sound/channelmerger.json create mode 100644 blocks/sound/delay.json create mode 100644 blocks/sound/distortion.json create mode 100644 blocks/sound/divsound.json create mode 100644 blocks/sound/divsoundfloat.json create mode 100644 blocks/sound/filter.json create mode 100644 blocks/sound/gain.json create mode 100644 blocks/sound/hrtf.json create mode 100644 blocks/sound/mulsound.json create mode 100644 blocks/sound/mulsoundfloat.json create mode 100644 blocks/sound/oscillator.json create mode 100644 blocks/sound/playback.json create mode 100644 blocks/sound/speaker.json create mode 100644 blocks/sound/subsound.json create mode 100644 blocks/sound/subsoundfloat.json create mode 100644 blocks/sound/whitenoise.json create mode 100644 codetemplates/webaudio.json create mode 100644 examples/additive.mscd create mode 100644 examples/analyser-example.mscd create mode 100644 examples/arithmetic_operations_logical_example.mscd create mode 100644 examples/beat-example.mscd create mode 100644 examples/color_example.mscd create mode 100644 examples/date.mscd create mode 100644 examples/device_orientation_example.mscd create mode 100644 examples/envelope.mscd create mode 100644 examples/filter.mscd create mode 100644 examples/freqbar-example.mscd create mode 100644 examples/hour.mscd create mode 100644 examples/keyboard.mscd create mode 100644 examples/metronome.mscd create mode 100644 examples/modulus_example.mscd create mode 100644 examples/mouseclick.mscd create mode 100644 examples/noiseFilter.mscd create mode 100644 examples/orientation_change_example.mscd create mode 100644 examples/playback.mscd create mode 100644 examples/random-example.mscd create mode 100644 examples/range-example.mscd create mode 100644 examples/select_example.mscd create mode 100644 examples/simple_osc.mscd create mode 100644 examples/spectogram.mscd create mode 100644 examples/text_example.mscd create mode 100644 examples/title_example.mscd create mode 100644 ports/bool.json create mode 100644 ports/char.json create mode 100644 ports/color.json create mode 100644 ports/float.json create mode 100644 ports/midi.json create mode 100644 ports/point.json create mode 100644 ports/sound.json create mode 100644 ports/string.json diff --git a/blocks/GUI/background.json b/blocks/GUI/background.json new file mode 100644 index 0000000..421be2d --- /dev/null +++ b/blocks/GUI/background.json @@ -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" + } + ] +} diff --git a/blocks/GUI/button.json b/blocks/GUI/button.json new file mode 100644 index 0000000..2b6d33b --- /dev/null +++ b/blocks/GUI/button.json @@ -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
\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" + } + ] +} diff --git a/blocks/GUI/check.json b/blocks/GUI/check.json new file mode 100644 index 0000000..9786c24 --- /dev/null +++ b/blocks/GUI/check.json @@ -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 $prop[label]$
\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" + } + ] +} diff --git a/blocks/GUI/color.json b/blocks/GUI/color.json new file mode 100644 index 0000000..dc79e29 --- /dev/null +++ b/blocks/GUI/color.json @@ -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]$
\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" + } + ] +} diff --git a/blocks/GUI/freqbar.json b/blocks/GUI/freqbar.json new file mode 100644 index 0000000..a6bdb44 --- /dev/null +++ b/blocks/GUI/freqbar.json @@ -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\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" + } + ] +} \ No newline at end of file diff --git a/blocks/GUI/number.json b/blocks/GUI/number.json new file mode 100644 index 0000000..1d8751a --- /dev/null +++ b/blocks/GUI/number.json @@ -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]$
\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" + } + ] +} diff --git a/blocks/GUI/print.json b/blocks/GUI/print.json new file mode 100644 index 0000000..3cf3b1e --- /dev/null +++ b/blocks/GUI/print.json @@ -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]$
\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" + } + ] +} \ No newline at end of file diff --git a/blocks/GUI/range.json b/blocks/GUI/range.json new file mode 100644 index 0000000..2e89dde --- /dev/null +++ b/blocks/GUI/range.json @@ -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]$
\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" + } + ] +} diff --git a/blocks/GUI/select.json b/blocks/GUI/select.json new file mode 100644 index 0000000..779a280 --- /dev/null +++ b/blocks/GUI/select.json @@ -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]$
\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" + } + ] +} diff --git a/blocks/GUI/sinewave.json b/blocks/GUI/sinewave.json new file mode 100644 index 0000000..168375c --- /dev/null +++ b/blocks/GUI/sinewave.json @@ -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\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" + } + ] +} \ No newline at end of file diff --git a/blocks/GUI/spectrogram.json b/blocks/GUI/spectrogram.json new file mode 100644 index 0000000..8230950 --- /dev/null +++ b/blocks/GUI/spectrogram.json @@ -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

SpectrogramVisualizer_Block$id$

\n
\n \n
\n\n" + }, + "properties": [], + "ports": [ + { + "type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound", + "label": "Input", + "conn_type": "Input", + "name": "input" + } + ] +} \ No newline at end of file diff --git a/blocks/GUI/text.json b/blocks/GUI/text.json new file mode 100644 index 0000000..cc09480 --- /dev/null +++ b/blocks/GUI/text.json @@ -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]$
\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" + } + ] +} diff --git a/blocks/GUI/title.json b/blocks/GUI/title.json new file mode 100644 index 0000000..d1e315b --- /dev/null +++ b/blocks/GUI/title.json @@ -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" + } + ] +} diff --git a/blocks/MIDI/MIDI.json b/blocks/MIDI/MIDI.json new file mode 100644 index 0000000..7129d82 --- /dev/null +++ b/blocks/MIDI/MIDI.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/MIDI/midi2freq.json b/blocks/MIDI/midi2freq.json new file mode 100644 index 0000000..fe6c9ea --- /dev/null +++ b/blocks/MIDI/midi2freq.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/MIDI/stripmidi.json b/blocks/MIDI/stripmidi.json new file mode 100644 index 0000000..f48bb0f --- /dev/null +++ b/blocks/MIDI/stripmidi.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/Types/float.json b/blocks/Types/float.json new file mode 100644 index 0000000..6157328 --- /dev/null +++ b/blocks/Types/float.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/Types/point.json b/blocks/Types/point.json new file mode 100644 index 0000000..db5dc4d --- /dev/null +++ b/blocks/Types/point.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/Types/string.json b/blocks/Types/string.json new file mode 100644 index 0000000..5a22b70 --- /dev/null +++ b/blocks/Types/string.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/arithmetics/addfloat.json b/blocks/arithmetics/addfloat.json new file mode 100644 index 0000000..766609d --- /dev/null +++ b/blocks/arithmetics/addfloat.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/arithmetics/and.json b/blocks/arithmetics/and.json new file mode 100644 index 0000000..07480d8 --- /dev/null +++ b/blocks/arithmetics/and.json @@ -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" + } + ] +} diff --git a/blocks/arithmetics/dividefloat.json b/blocks/arithmetics/dividefloat.json new file mode 100644 index 0000000..6f6a4d3 --- /dev/null +++ b/blocks/arithmetics/dividefloat.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/arithmetics/equals.json b/blocks/arithmetics/equals.json new file mode 100644 index 0000000..e67ed07 --- /dev/null +++ b/blocks/arithmetics/equals.json @@ -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" + } + ] +} diff --git a/blocks/arithmetics/greaterthan.json b/blocks/arithmetics/greaterthan.json new file mode 100644 index 0000000..954abd2 --- /dev/null +++ b/blocks/arithmetics/greaterthan.json @@ -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" + } + ] +} diff --git a/blocks/arithmetics/greaterthanorequals.json b/blocks/arithmetics/greaterthanorequals.json new file mode 100644 index 0000000..28e2a9a --- /dev/null +++ b/blocks/arithmetics/greaterthanorequals.json @@ -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" + } + ] +} diff --git a/blocks/arithmetics/inc.json b/blocks/arithmetics/inc.json new file mode 100644 index 0000000..fc1834d --- /dev/null +++ b/blocks/arithmetics/inc.json @@ -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" + } + ] +} diff --git a/blocks/arithmetics/lessthan.json b/blocks/arithmetics/lessthan.json new file mode 100644 index 0000000..12f3cb9 --- /dev/null +++ b/blocks/arithmetics/lessthan.json @@ -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" + } + ] +} diff --git a/blocks/arithmetics/lessthanorequals.json b/blocks/arithmetics/lessthanorequals.json new file mode 100644 index 0000000..48a4697 --- /dev/null +++ b/blocks/arithmetics/lessthanorequals.json @@ -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" + } + ] +} diff --git a/blocks/arithmetics/maxfloat.json b/blocks/arithmetics/maxfloat.json new file mode 100644 index 0000000..939650b --- /dev/null +++ b/blocks/arithmetics/maxfloat.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/arithmetics/modulus.json b/blocks/arithmetics/modulus.json new file mode 100644 index 0000000..e6b489c --- /dev/null +++ b/blocks/arithmetics/modulus.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/arithmetics/multiplyfloat.json b/blocks/arithmetics/multiplyfloat.json new file mode 100644 index 0000000..be02368 --- /dev/null +++ b/blocks/arithmetics/multiplyfloat.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/arithmetics/not.json b/blocks/arithmetics/not.json new file mode 100644 index 0000000..5ebf552 --- /dev/null +++ b/blocks/arithmetics/not.json @@ -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" + } + ] +} diff --git a/blocks/arithmetics/notequals.json b/blocks/arithmetics/notequals.json new file mode 100644 index 0000000..d297240 --- /dev/null +++ b/blocks/arithmetics/notequals.json @@ -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" + } + ] +} diff --git a/blocks/arithmetics/or.json b/blocks/arithmetics/or.json new file mode 100644 index 0000000..ec8f3e8 --- /dev/null +++ b/blocks/arithmetics/or.json @@ -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" + } + ] +} diff --git a/blocks/arithmetics/subtractfloat.json b/blocks/arithmetics/subtractfloat.json new file mode 100644 index 0000000..2abcd1f --- /dev/null +++ b/blocks/arithmetics/subtractfloat.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/conversion/bool2float.json b/blocks/conversion/bool2float.json new file mode 100644 index 0000000..9a30cdb --- /dev/null +++ b/blocks/conversion/bool2float.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/conversion/char2float.json b/blocks/conversion/char2float.json new file mode 100644 index 0000000..e299c41 --- /dev/null +++ b/blocks/conversion/char2float.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/conversion/rgb.json b/blocks/conversion/rgb.json new file mode 100644 index 0000000..da15406 --- /dev/null +++ b/blocks/conversion/rgb.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/input devices/date.json b/blocks/input devices/date.json new file mode 100644 index 0000000..b1e483e --- /dev/null +++ b/blocks/input devices/date.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/input devices/deviceorientation.json b/blocks/input devices/deviceorientation.json new file mode 100644 index 0000000..f11dd67 --- /dev/null +++ b/blocks/input devices/deviceorientation.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/input devices/hour.json b/blocks/input devices/hour.json new file mode 100644 index 0000000..bdbcf7b --- /dev/null +++ b/blocks/input devices/hour.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/input devices/keyboard.json b/blocks/input devices/keyboard.json new file mode 100644 index 0000000..79b0be9 --- /dev/null +++ b/blocks/input devices/keyboard.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/blocks/input devices/metronome.json b/blocks/input devices/metronome.json new file mode 100644 index 0000000..8abf1ec --- /dev/null +++ b/blocks/input devices/metronome.json @@ -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" + } + ] +} diff --git a/blocks/input devices/microphone.json b/blocks/input devices/microphone.json new file mode 100644 index 0000000..6230d4f --- /dev/null +++ b/blocks/input devices/microphone.json @@ -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\n
\n Microphone\n
\n
\n
\n Gain\n \n 0 db\n
\n
\n\n\n \n \n\n \n
\n\n $code[html]$\n \n\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" + } +} diff --git a/examples/additive.mscd b/examples/additive.mscd new file mode 100644 index 0000000..f4aeb35 --- /dev/null +++ b/examples/additive.mscd @@ -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": [] +} diff --git a/examples/analyser-example.mscd b/examples/analyser-example.mscd new file mode 100644 index 0000000..d37e4fd --- /dev/null +++ b/examples/analyser-example.mscd @@ -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": [] +} diff --git a/examples/arithmetic_operations_logical_example.mscd b/examples/arithmetic_operations_logical_example.mscd new file mode 100644 index 0000000..4cad317 --- /dev/null +++ b/examples/arithmetic_operations_logical_example.mscd @@ -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": [] +} diff --git a/examples/beat-example.mscd b/examples/beat-example.mscd new file mode 100644 index 0000000..2279e9b --- /dev/null +++ b/examples/beat-example.mscd @@ -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": [] +} diff --git a/examples/color_example.mscd b/examples/color_example.mscd new file mode 100644 index 0000000..5141aac --- /dev/null +++ b/examples/color_example.mscd @@ -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": [] +} diff --git a/examples/date.mscd b/examples/date.mscd new file mode 100644 index 0000000..2150754 --- /dev/null +++ b/examples/date.mscd @@ -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": [] +} diff --git a/examples/device_orientation_example.mscd b/examples/device_orientation_example.mscd new file mode 100644 index 0000000..bdb59d5 --- /dev/null +++ b/examples/device_orientation_example.mscd @@ -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": [] +} diff --git a/examples/envelope.mscd b/examples/envelope.mscd new file mode 100644 index 0000000..65f1824 --- /dev/null +++ b/examples/envelope.mscd @@ -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": [] +} diff --git a/examples/filter.mscd b/examples/filter.mscd new file mode 100644 index 0000000..66cba31 --- /dev/null +++ b/examples/filter.mscd @@ -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": [] +} diff --git a/examples/freqbar-example.mscd b/examples/freqbar-example.mscd new file mode 100644 index 0000000..287495d --- /dev/null +++ b/examples/freqbar-example.mscd @@ -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": [] +} diff --git a/examples/hour.mscd b/examples/hour.mscd new file mode 100644 index 0000000..9086cb6 --- /dev/null +++ b/examples/hour.mscd @@ -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": [] +} diff --git a/examples/keyboard.mscd b/examples/keyboard.mscd new file mode 100644 index 0000000..509fcd4 --- /dev/null +++ b/examples/keyboard.mscd @@ -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": [] +} diff --git a/examples/metronome.mscd b/examples/metronome.mscd new file mode 100644 index 0000000..38b0154 --- /dev/null +++ b/examples/metronome.mscd @@ -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": [] +} diff --git a/examples/modulus_example.mscd b/examples/modulus_example.mscd new file mode 100644 index 0000000..e964be0 --- /dev/null +++ b/examples/modulus_example.mscd @@ -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": [] +} diff --git a/examples/mouseclick.mscd b/examples/mouseclick.mscd new file mode 100644 index 0000000..2aa3696 --- /dev/null +++ b/examples/mouseclick.mscd @@ -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": [] +} diff --git a/examples/noiseFilter.mscd b/examples/noiseFilter.mscd new file mode 100644 index 0000000..cc2e726 --- /dev/null +++ b/examples/noiseFilter.mscd @@ -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": [] +} diff --git a/examples/orientation_change_example.mscd b/examples/orientation_change_example.mscd new file mode 100644 index 0000000..a827a70 --- /dev/null +++ b/examples/orientation_change_example.mscd @@ -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": [] +} diff --git a/examples/playback.mscd b/examples/playback.mscd new file mode 100644 index 0000000..91afe76 --- /dev/null +++ b/examples/playback.mscd @@ -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": [] +} diff --git a/examples/random-example.mscd b/examples/random-example.mscd new file mode 100644 index 0000000..0cea550 --- /dev/null +++ b/examples/random-example.mscd @@ -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": [] +} diff --git a/examples/range-example.mscd b/examples/range-example.mscd new file mode 100644 index 0000000..4a3196b --- /dev/null +++ b/examples/range-example.mscd @@ -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": [] +} diff --git a/examples/select_example.mscd b/examples/select_example.mscd new file mode 100644 index 0000000..f441c17 --- /dev/null +++ b/examples/select_example.mscd @@ -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": [] +} diff --git a/examples/simple_osc.mscd b/examples/simple_osc.mscd new file mode 100644 index 0000000..d98772c --- /dev/null +++ b/examples/simple_osc.mscd @@ -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": [] +} diff --git a/examples/spectogram.mscd b/examples/spectogram.mscd new file mode 100644 index 0000000..822d4e4 --- /dev/null +++ b/examples/spectogram.mscd @@ -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": [] +} diff --git a/examples/text_example.mscd b/examples/text_example.mscd new file mode 100644 index 0000000..b7e8019 --- /dev/null +++ b/examples/text_example.mscd @@ -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": [] +} diff --git a/examples/title_example.mscd b/examples/title_example.mscd new file mode 100644 index 0000000..7ff029c --- /dev/null +++ b/examples/title_example.mscd @@ -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": [] +} diff --git a/ports/bool.json b/ports/bool.json new file mode 100644 index 0000000..a06bbb1 --- /dev/null +++ b/ports/bool.json @@ -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" +} \ No newline at end of file diff --git a/ports/char.json b/ports/char.json new file mode 100644 index 0000000..44a57de --- /dev/null +++ b/ports/char.json @@ -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" +} \ No newline at end of file diff --git a/ports/color.json b/ports/color.json new file mode 100644 index 0000000..fc20406 --- /dev/null +++ b/ports/color.json @@ -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" +} \ No newline at end of file diff --git a/ports/float.json b/ports/float.json new file mode 100644 index 0000000..b8e0252 --- /dev/null +++ b/ports/float.json @@ -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" +} \ No newline at end of file diff --git a/ports/midi.json b/ports/midi.json new file mode 100644 index 0000000..16bc7f3 --- /dev/null +++ b/ports/midi.json @@ -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" +} \ No newline at end of file diff --git a/ports/point.json b/ports/point.json new file mode 100644 index 0000000..87861da --- /dev/null +++ b/ports/point.json @@ -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" +} \ No newline at end of file diff --git a/ports/sound.json b/ports/sound.json new file mode 100644 index 0000000..1f159e5 --- /dev/null +++ b/ports/sound.json @@ -0,0 +1,12 @@ +{ + "source": "JSON", + "data": "PORT", + "version": "0.0.1", + "type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound", + "language": "javascript", + "hint": "SOUND", + "color": "#000", + "multiple": true, + "var_name": "$block[label]$_$block[id]$_$port[name]$", + "code": "$output$.connect($input$);\n" +} \ No newline at end of file diff --git a/ports/string.json b/ports/string.json new file mode 100644 index 0000000..3dcb247 --- /dev/null +++ b/ports/string.json @@ -0,0 +1,12 @@ +{ + "source": "JSON", + "data": "PORT", + "version": "0.0.1", + "type": "mosaicode_lib_javascript_webaudio.extensions.ports.string", + "language": "javascript", + "hint": "STRING", + "color": "#000", + "multiple": true, + "var_name": "$block[label]$_$block[id]$_$port[name]$", + "code": "$output$.push($input$);\n" +} \ No newline at end of file