@0b5vr/wavenerd-deck
v0.8.10
Published
The deck engine for Wavenerd
Readme
wavenerd-deck
The GLSL live-coding deck engine for Wavenerd.
wavenerd-deck can compile GLSL fragment shaders and play the rendered result as audio in realtime. It uses WebGL on OffscreenCanvas/Worker, and Web Audio API.
Mainly indended for use in Wavenerd but can be used as a standalone library. Don't expect a super polished API or thorough support though.
Install
npm install @0b5vr/wavenerd-deckUsage
import WavenerdDeck from '@0b5vr/wavenerd-deck';
const audio = new AudioContext();
// Create a deck, connect it to the audio destination
const deck = new WavenerdDeck({ audio, bpm: 140 });
deck.node.connect(audio.destination);
// Compile a GLSL fragment shader and apply it
await deck.compile(glslCode);
deck.applyCue(); // apply at the next bar boundary
deck.applyCueImmediately(); // apply immediately
// Transport
deck.play();
deck.pause();
deck.rewind();
// Update loop (call every frame)
async function update() {
await deck.update();
setTimeout(update);
}
update();See example/index.html for a more complete example.
