var context = null; var usingWebAudio = true; if (typeof AudioContext !== 'undefined') { context = new AudioContext(); } else if (typeof webkitAudioContext !== 'undefined') { context = new webkitAudioContext(); } else { usingWebAudio = false; } var playing = false; var osc = null; var freq = 1; var STEP_CONSTANT = Math.pow(2.0, 1.0/12.0); function toggle() { var button = document.getElementById("toggle"); if (playing && osc) { playing = false; osc.stop(0); button.value = "ON"; } else { playing = true; osc = context.createOscillator(); osc.connect(context.destination); osc.frequency.value = freq; osc.start(0); button.value = "OFF"; } } function updateFreq(newFreq) { freq = newFreq; if (osc) { osc.frequency.value = freq; } var text = document.getElementById("freqText").value = freq; var range = document.getElementById("freqRange").value = freq; } window.onload = function() { if (!usingWebAudio) { document.getElementById("audioControls").innerHTML = "

Web audio required.

" } }
Invention of the vacuum tube made electronic alternators possible. The electronic alternator controls the rate at which the current changes from positive to negative polarity and back again.

Connect the audio output of the computer to an amplifier. Connect the output of the amplifier to a linear motor.
Adjust the rate of alternation to 5 times per second. Then click the “On / Off” button to turn on the electronic alternator. The linear motor should move back and forth 5 times per second. Try increasing or decreasing the rate. What happens to the linear motor?