With the arrival of the runJavascript block for the Webviewer, it is now possible to play a tone/tones with an empty, hidden webviewer:
(note: I have shown the four options for "type")
Example JS playing a 1 second sine wave of A4
var frequency = 440;
var type = 'sine';
var volume = 0.5;
var duration = 1000;
var audioCtx = new AudioContext();
var oscillator = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();
oscillator.connect(gainNode);
gainNode.connect(audioCtx.destination);
gainNode.gain.value = volume;
oscillator.frequency.value = frequency;
oscillator.type = type;
oscillator.start();
setTimeout( function() {
oscillator.stop();
},
duration );

