1.5.1 • Published 3 years ago
soundamplitude v1.5.1
Sound Amplitude
Demo
Installation
npm install soundamplitude
ES6
import Soundamplitude from "./node_module/soundamplitude/soundamplitude.js"
Initalize object
var options = {} options.fps = 50 // control how frequent the callback return
var url = "https://www.xxx.com/xxx.mp3"
var soundamplitude = new Soundamplitude(url,options)
play / stop (please make sure you must start play by a click event)
soundamplitude.play()
Call back to get amplitude
soundamplitude.on("amplitude",e=>{
console.log(e.amplitude) })
Callback when ended
soundamplitude.on("ended",()=>{
})
change volume
0< volume <1
soundamplitude.changevolume(volume)
Release
soundamplitude.release()