-
-
Save johan--/ae79bfbe907f81cffa0f1cb9b68b5944 to your computer and use it in GitHub Desktop.
Listen to your web pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const audioCtx = new (window.AudioContext || window.webkitAudioContext)() | |
| const observer = new MutationObserver(function(mutationsList) { | |
| const oscillator = audioCtx.createOscillator() | |
| oscillator.connect(audioCtx.destination) | |
| oscillator.type = "sine" | |
| oscillator.frequency.setValueAtTime( | |
| Math.log(mutationsList.length + 5) * 880, | |
| audioCtx.currentTime, | |
| ) | |
| oscillator.start() | |
| oscillator.stop(audioCtx.currentTime + 0.01) | |
| }) | |
| observer.observe(document, { | |
| attributes: true, | |
| childList: true, | |
| subtree: true, | |
| characterData: true, | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment