I would like to create a HTML meter to display the reduction made by the compressor node.
I used this code but it does not change the metter
compressor = context.createDynamicsCompressor();
compressor.threshold = -50;
compressor.ratio = 12;
compressor.attack = 0.003;
compressor.reduction.onchange = function () {
var gainReduction = pluginSlot1.reduction;
document.getElementById("meter").value = gainReduction.value;
};
This is connected to this HTML
< meter id="meter" min="0" max="100">
What do I need to do in order for it to work?
Here's a quick and dirty jsbin example: http://jsbin.com/ahocUt/1/edit
Unless there's something I'm missing in the spec, the
reduction
param doesn't fire any events. You just need to read it on-demand. In my example, that's just happening with arequestAnimationFrame
loop.The other thing you're missing is that you need to set the params with
compressor.threshold.value
, becausecompressor.threshold
is actually an object.Hope that helps.