Public
Edited
Sep 27, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
makeSound = function() {
play;
const time = audioContext.currentTime + delay;
const osc = audioContext.createOscillator();
const gainNode = audioContext.createGain();
osc.connect(gainNode);
gainNode.connect(audioContext.destination);
osc.frequency.value = frequency;
osc.type = oscillatorType;
gainNode.gain.value = volume;
osc.start(time)
osc.stop(time + 0.25)
}
Insert cell
viewof toggle = Inputs.toggle({label: "Active", value: true})
Insert cell
toggle
Insert cell
{
while (toggle) {
yield Promises.tick(500, makeSound()) //wait 1000 msec then run showTime
}
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more