KNOB test
by Ehsan Ziya
HTML
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://anthonyterrien.com/js/jquery.kontrol.js"></script>
<input type="text" class="dial" data-min="300" data-max="800">
JavaScript
var context = new webkitAudioContext();
var osc = context.createOscillator();
var gain = context.createGain();
osc.connect(gain);
gain.connect(context.destination);
gain.gain.value = 0;
osc.noteOn(0);
$(".dial").dial({
'min': 300,
'max': 800,
'start' : function(){
gain.gain.value = 1;
},
'change': function (e) {
osc.frequency.value = e;
gain.gain.value = 1;
},
'release' : function(){
osc.frequency.value = osc.frequency.value;
gain.gain.value = 0;
}
});