Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript make sound

function beep() {
  var context = new AudioContext();
  var oscillator = context.createOscillator();
  oscillator.type = "sine";
  oscillator.frequency.value = 800;
  oscillator.connect(context.destination);
  oscillator.start(); 
  // Beep for 500 milliseconds
  setTimeout(function () {
      oscillator.stop();
  }, 500);
}

beep();

// See source for a parametrized sound
Comment

JS sound

var audio = new Audio('assets/audio.mp3');

> Play
audio.play();
> Stop
sound.pause();
> Back to start
sound.currentTime = 0;
Comment

js play sound

const sound = require("sound-play");
sound.play("file.mp3");
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript array remove empty strings 
Javascript :: get DOM node with xpath 
Javascript :: disable unused vars 
Javascript :: match word in string js 
Javascript :: localstorage save array 
Javascript :: javascript check if set 
Javascript :: get column from 2D array javascript 
Javascript :: meteor update package 
Javascript :: javascript thousand separator 
Javascript :: js stop redirect 
Javascript :: javascript remove duplicate in two arrays 
Javascript :: get random numbers javascript 
Javascript :: vuex v-model 
Javascript :: replace object in array javascript 
Javascript :: javascript date minus minutes 
Javascript :: create a category discord.js 
Javascript :: jQuery UI Sortable, then write order into a database 
Javascript :: asp.net core 3.1 convert system.collections.generic.list`1[system.string] to javascript 
Javascript :: how to add parameters to url javascript 
Javascript :: how to negate a boolena variable javascript 
Javascript :: seleccionar value select2 js 
Javascript :: express api make 
Javascript :: style font size javascript 
Javascript :: onload multiple functions 
Javascript :: moment in react native 
Javascript :: ajax get with parameters 
Javascript :: read from s3 bucket nodejs 
Javascript :: javascript const require 
Javascript :: how to redirect to another page in javascript on submit type 
Javascript :: datatable column width 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =