/*
* @title bookmarklet
* @description my bookmarklet
* @include http://*
* @license MIT License
* @require
*/
// Create an audio context
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
// Function to play a tone of 852Hz
function play852HzTone(durationInSeconds = 2) {
// Create an oscillator node
const oscillator = audioContext.createOscillator();
// Set the frequency to 852Hz
oscillator.frequency.setValueAtTime(852, audioContext.currentTime);
// Set the waveform type (sine wave is default)
oscillator.type = 'sine';
// Connect the oscillator to the audio context's destination (speakers)
oscillator.connect(audioContext.destination);
// Start the oscillator
oscillator.start();
// Stop the oscillator after the specified duration
oscillator.stop(audioContext.currentTime + durationInSeconds);
}
// Play the 852Hz tone for 2 seconds
play852HzTone();