kopiro / siriwave

The Apple® Siri wave-form replicated in a JS library.
http://kopiro.github.io/siriwave/
MIT License
1.62k stars 169 forks source link

how to use this as audio visualiser for web browser ? #18

Closed ghost closed 6 years ago

ghost commented 6 years ago

hey, great work. Can you pleasee point me to the directions how to use this wave generator with mic audio, to use this lib as visualizer for the mic

gusdaud-zz commented 6 years ago

Hey @rrm-relishly its simple actually. I'm using the wavebell component for that (https://github.com/skylerlee/wavebell). Here's some sample code:

import Bell from 'wavebell';

...

  /* After the div is rendered */
  initialize = (container) => {
    this.siriwave = new SiriWave({
      container,
      width: 288,
      height: 100,
      style: 'ios9',
      color: '#1FB1A6',
      speed: 0.05,
      frequency: 10,
    });
    this.bell = new Bell();
    this.siriwave.start();

    this.bell.start(1000 / 25);
    this.bell.on('wave', (e) => {
      this.siriwave.setAmplitude(e.value * 2);
    });
}