Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 868 Bytes

README.md

File metadata and controls

31 lines (25 loc) · 868 Bytes

Audio Visualizer

A plug-and-play audio visualizer

Frequency

Frequency

Wave

Wave

Usage

const visualizer = new AudioVisualizer('canvasId', {
  // optional
  type: 'wave',
  width: 700, height: 500,
  lineWidth: 2,
  backgroundColor: 'rgb(25, 25, 25)'
  strokeStyle: 'rgb(255, 255, 255)'
});

// Connect visualizer to an AnalyserNode which connected to the audio source
function getMediaStream (stream) {
  let source = audioContext.createMediaStreamSource(stream);
  let analyser = new AnalyserNode(audioContext);

  source.connect(analyser);
  visualizer.connect(analyser);
}