diff --git a/content.js b/content.js index 92e3862ad13cf205d7e61a0568e331a1ba685f64..9546f365faf60683902a608659b957b0af8db160 100644 --- a/content.js +++ b/content.js @@ -1,5 +1,5 @@ var audioContext = null; -var meter = {volume: 0}; +var meter = { volume: 0 }; var analyser = null; var rafID = null; var buflen = 1024; @@ -259,7 +259,7 @@ async function gotStream(stream) { let _sensibility = 5 if (event.data.volume) _volume = event.data.volume; - meter = {volume: _volume}; + meter = { volume: _volume }; } mediaStreamSource.connect(node); audioContext.resume(); @@ -449,7 +449,7 @@ function audioEvent() { volume = meter.volume * 1.4; value = value.replace('[' + template.templateFull + ']', (meter.volume * 1.4 < 1 ? range(template, volume) : 0)); } - else if (template.eventType == 'onset' && template.eventName == noteStrings[note % 12]) { + else if (template.eventType == 'onset' && template.eventName == noteStrings[note % 12] && meter.volume > 0.08) { eventIn = true; value = value.replace('[' + template.templateFull + ']', range(template, 1)); } @@ -458,6 +458,7 @@ function audioEvent() { eventIn = true; value = value.replace('[' + template.templateFull + ']', ''); } + console.log(meter.volume); } }); if (eventIn) {