1.0.1 • Published 2 years ago
stcengine v1.0.1
stcengine
playback engine for ZX Spectrum Soundtracker (.stc) files
Installation
npm install stcengineUsage
This package exports a class STCEngine whose constructor accepts an STC data structure as returned by stcformat. This object provides the following properties:
getAudioFrame()- Returns the next frame of data, as a list of AY register writes each expressed as[register, value]looped- True if previous calls togetAudioFramehave reached the end of the module (at which point further calls will start again from the start of the module)reset()- Reset state to start playing from the start of the module.
const fs = require("fs");
const { readSTC } = require("stcformat");
const { STCEngine } = require("stcengine");
const buf = fs.readFileSync('myfile.stc'));
const stcModule = readSTC(buf);
const engine = new STCEngine(stcModule);
while (!engine.looped) {
console.log(engine.getAudioFrame());
}