poweraudio
v0.1.8
Published
An innovative audio visualization library
Downloads
30
Readme
Power Audio
An innovative audio visualization library
Add PowerAudio to your project
Using npm
- Add this library into your project
npm i --save poweraudio
- Import the PowerAudio object from the lib
// JS ES5
const PowerAudio = require('poweraudio');
// JS ES6/TypeScript
import { PowerAudio } from 'poweraudio';
Using direct web import
- Import poweraudio.js in your html
<script src="https://raw.githubusercontent.com/7PH/poweraudio/master/dist/poweraudio.js"></script>
- That's it, you now have a global
PowerAudio
object registered towindow
Start a viz
To start a viz, it is as simple as instantiating a new PowerAudio.Viz object. You have to specify the following options:
- container: Query selector for where to put the visualization
- source: Audio source element (HTMLAudioElement)
// Create audio element
const audio = new Audio('music.mp3');
// Alternatively: Get audio element from the DOM
//const audio = document.querySelector('audio');
// Start viz in container with id `viz`
const viz = new PowerAudio.Viz({
container: '#viz',
source: audio,
});
// Play audio
audio.play();
// Make the PowerCircle (the big circle at the center of the screen) do a backflip
viz.flip();
Examples
Find examples below: