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