diff --git a/demo/demo.js b/demo/demo.js
index d2a7f49..aa1bbb4 100644
--- a/demo/demo.js
+++ b/demo/demo.js
@@ -1,5 +1,25 @@
import React, { Component } from 'react';
-import { Analyser, Compressor, Song, Sequencer, Sampler, Synth } from '../src';
+
+import {
+ Analyser,
+ Bitcrusher,
+ Chorus,
+ Compressor,
+ Delay,
+ Filter,
+ MoogFilter,
+ Overdrive,
+ Phaser,
+ PingPong,
+ Reverb,
+ Song,
+ Sequencer,
+ Sampler,
+ Synth,
+} from '../src';
+
+import Polysynth from './polysynth';
+import Visualization from './visualization';
import './index.css';
@@ -14,27 +34,8 @@ export default class Demo extends Component {
this.audioProcess = this.audioProcess.bind(this);
this.playToggle = this.playToggle.bind(this);
}
- componentDidMount() {
- this.ctx = this.canvas.getContext('2d');
- }
audioProcess(analyser) {
- if (this.ctx) {
- const gradient = this.ctx.createLinearGradient(0, 0, 0, 512);
- gradient.addColorStop(1, '#000000');
- gradient.addColorStop(0.75, '#2ecc71');
- gradient.addColorStop(0.25, '#f1c40f');
- gradient.addColorStop(0, '#e74c3c');
-
- const array = new Uint8Array(analyser.frequencyBinCount);
- analyser.getByteFrequencyData(array);
- this.ctx.clearRect(0, 0, 800, 512);
- this.ctx.fillStyle = gradient;
-
- for (let i = 0; i < (array.length); i++) {
- const value = array[i];
- this.ctx.fillRect(i * 12, 512, 10, value * -2);
- }
- }
+ this.visualization.audioProcess(analyser);
}
playToggle() {
this.setState({
@@ -46,13 +47,60 @@ export default class Demo extends Component {
+
+
+
+
+
+
+
+
+
-
-
-
-
-