Proof of concept with basic demo complete.
This commit is contained in:
BIN
tests/Elektronomia - Collide.mp3
Normal file
BIN
tests/Elektronomia - Collide.mp3
Normal file
Binary file not shown.
17
tests/index.html
Normal file
17
tests/index.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>AudioShowKit visual test</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' media='screen' href='main.css'>
|
||||
<script defer type="module" src='script.js'></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<button id="startbtn">Start.</button>
|
||||
</body>
|
||||
|
||||
</html>
|
0
tests/main.css
Normal file
0
tests/main.css
Normal file
24
tests/script.js
Normal file
24
tests/script.js
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
import bindHorizontalBar from "../src/patterns/HorizontalBar.js";
|
||||
import VisualizerCore from "../src/VisualizerCore.js";
|
||||
|
||||
// We will see if the visualizers core and event systems are working correctly.
|
||||
let startBtn = document.getElementById("startbtn");
|
||||
startBtn.addEventListener("click", async (ev) => {
|
||||
let mediaStream = new Audio("../tests/Elektronomia - Collide.mp3");
|
||||
mediaStream.addEventListener("canplaythrough", (ev) => {
|
||||
let visCore = new VisualizerCore(mediaStream, 128);
|
||||
let coreAndEventCanvas = document.createElement("canvas");
|
||||
coreAndEventCanvas.width = 640;
|
||||
coreAndEventCanvas.height = 200;
|
||||
|
||||
console.log("starting playthrough.");
|
||||
mediaStream.play();
|
||||
visCore.analyze();
|
||||
document.body.appendChild(coreAndEventCanvas);
|
||||
|
||||
bindHorizontalBar(coreAndEventCanvas, visCore);
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user