30 lines
1.0 KiB
JSON
30 lines
1.0 KiB
JSON
{
|
|
"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"
|
|
}
|
|
]
|
|
} |