Web Audio API
Create and manipulate audio
AdvancedTopic: Browser API
JavaScript Web Audio API Program
This program helps you to learn the fundamental structure and syntax of JavaScript programming.
const audioContext = new AudioContext();
const oscillator = audioContext.createOscillator();
oscillator.connect(audioContext.destination);
oscillator.start();Output
// Plays audio tone
Understanding Web Audio API
Web Audio API creates and processes audio.
Note: To write and run JavaScript programs, you need to set up the local environment on your computer. Refer to the complete article Setting up JavaScript Development Environment. If you do not want to set up the local environment on your computer, you can also use online IDE to write and run your JavaScript programs.