feature: add pitch control to signal tone (#347)

This commit is contained in:
dman776 2019-01-31 16:57:30 -06:00 committed by GitHub
parent ddda727da0
commit 3abc82f529
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -181,7 +181,8 @@ $header = <<EOF;
gainNode.gain.value = 1; gainNode.gain.value = 1;
function toneFreq(snr) { function toneFreq(snr) {
oscillator.frequency.value = snr * 20; var p = document.getElementById("tonePitch").value;
oscillator.frequency.value = snr * p;
} }
function toneOn() { function toneOn() {
@ -264,7 +265,7 @@ $page = $page . <<EOF;
<div id="snrValues" style="float: left;"> <div id="snrValues" style="float: left;">
EOF EOF
$page = $page . "<div><h3>SNR: <span id='snr'>0</span>dB</h3></div>" if($parms{"realtime"} eq "1"); $page = $page . "<div><h3>SNR: <span id='snr'>0</span>dB</h3></div>" if($parms{"realtime"} eq "1");
$page = $page . "<div style='float: right;'>Sound: <button id='toneOn' onclick='toneOn();'>On</button>&nbsp;<button id='toneOff' disabled onclick='toneOff();'>Off</button></div>" if($parms{"realtime"} eq "1"); $page = $page . "<div style='float: right;'>Sound: <button id='toneOn' onclick='toneOn();'>On</button>&nbsp;<button id='toneOff' disabled onclick='toneOff();'>Off</button><br /><br />Pitch:&nbsp;<input type='range' id='tonePitch' name='tonePitch' min='5' max='100'></input></div>" if($parms{"realtime"} eq "1");
$page = $page . <<EOF; $page = $page . <<EOF;
</div> </div>
<div id="chartContainer" style="width: 80%; height: 60%;"></div> <div id="chartContainer" style="width: 80%; height: 60%;"></div>