Last active
February 14, 2025 20:13
-
-
Save alexlenail/0b487f5ced01380117416eeb2d01abbc to your computer and use it in GitHub Desktop.
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
from IPython.display import display, Javascript | |
def beep(): | |
display(Javascript('''(function() { | |
var context = new (window.AudioContext || window.webkitAudioContext)(); | |
var oscillator = context.createOscillator(); | |
oscillator.type = 'sine'; | |
oscillator.frequency.setValueAtTime(440, context.currentTime); // Frequency in Hz (440 is a standard 'A' note) | |
oscillator.connect(context.destination); | |
oscillator.start(); | |
oscillator.stop(context.currentTime + 0.2); // Beep duration: 0.2 seconds | |
})()''')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment