stcengine

1.0.1 • Public • Published

stcengine

playback engine for ZX Spectrum Soundtracker (.stc) files

Installation

npm install stcengine

Usage

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 to getAudioFrame have 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());
}

Readme

Keywords

none

Package Sidebar

Install

npm i stcengine

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

9.18 kB

Total Files

4

Last publish

Collaborators

  • gasman