npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@modplayjs/fmt-sid

v0.2.3

Published

Commodore 64 SID music (PSID/RSID) format plugin for modplayjs — pristine 1:1 TypeScript port of libcRSID 1.58 by Hermit (Mihaly Horvath).

Readme

@modplayjs/fmt-sid

Commodore 64 SID music (PSID/RSID) plugin for @modplayjs/core — a pristine 1:1 TypeScript port of libcRSID 1.58 by Mihály Horváth (Hermit), from the reference copy in reference/cRSID-1.58.

Unlike the tracker formats, SID is a machine emulation: the plugin contains the whole C64 playback machine, not a pattern player —

  • 6510 CPU with the illegal opcodes scene tunes use (CPU.c, 510 lines)
  • SID chip: oscillators (light + high-quality oversampled paths), combined waveforms (4×4096 sampled tables), filter, ADSR with the exponential curve + DAC table, $D418 volume-register digi and the PSID $D4xx digi player
  • CIA1/2 timers, VIC raster IRQ, PLA memory banking, KERNAL stub ROM
  • PSID/RSID loader with Vsync/CIA timing-source selection, subtune handling, video-standard (PAL/NTSC) clock selection

All data tables (combined waveforms, filter curves, Sinc window, ADSR DAC) are verbatim copies, verified byte-identical against the C build.

Verification

Rendered audio is sample-exact against a C oracle built from the reference tree: byte-identical on all 48 test-corpus .sid files (incl. the RSID file, CIA-timed tunes, multi-subtune files), and corr 1.0000 / maxdiff 0.000 through the standard player pipeline at 48 kHz.

Note on engine fidelity: this is the cRSID implementation's own audio — table-based filter/waveform models, not reSIDfp's sampled-from-silicon analog models (which are GPL-licensed and cannot be ported here). See the repository README for the engine comparison.

Install

npm install @modplayjs/fmt-sid

Usage

import { CorePlayer } from '@modplayjs/core';
import { plugin as sidPlugin, sidDsp, sidStartTune } from '@modplayjs/fmt-sid';

const core = new CorePlayer();
core.registries.registerFormat(sidPlugin);
core.registries.registerDsp(sidDsp);
core.loadModule(bytes);              // .sid file

// at playback start (engine is sample-paced, not tick-paced):
core.setDsp('sid');
core.setSampleRate(deviceRate);
core.startPlayer();
sidStartTune(bytes, deviceRate, 1);  // subtune 1

The engine renders through the sid DSP plugin at exact host-buffer pacing; the tracker player just keeps the pipeline flowing. Loop semantics: the stub module loops forever (loop=0 in playBuffer).

Settings

import { getSidSettings, applySidSettings } from '@modplayjs/fmt-sid';

applySidSettings({
  volume: 255,              // 0..255 engine master volume
  highQualitySID: true,     // oversampled waveform path (light = sample-rate)
  highQualityResampler: false, // Sinc FIR decimator (only with highQualitySID)
  stereo: 0,                // 0 mono / 1 stereo / 3 narrow (2SID+ tunes)
  model: 0,                 // 0 header default / 6581 / 8580 (forced)
  videoStandard: undefined, // undefined header default / 0 NTSC / 1 PAL
});

volume, highQualitySID, highQualityResampler and stereo apply live (the engine reads them through its per-sample shadow sync, as in the C host). model and videoStandard are init-time — they take effect on the next sidStartTune call (the C player re-inits the tune for these as well). getSidSettings() reads the current values back.

Note: stereo only routes differently on multi-SID tunes (PSID v3+ with a SID2 address in the header) — single-SID tunes always play mono, so getSidChipCount() lets players disable the control for them.

Seek

import { sidSeek, getSidPlayTimeSeconds } from '@modplayjs/fmt-sid';

sidSeek(180);                        // fast-forward the engine to 3:00
const t = getSidPlayTimeSeconds();   // engine runtime in seconds

cRSID has no native seek — sidSeek fast-forwards the machine emulation (rendering the skipped samples into a discard buffer, ≈20× realtime) and restarts the tune first for backwards seeks. Pair with the Songlengths database for a working seek bar on known tunes.

Also exports

Full engine surface for direct use without the player core: cRSID_init, cRSID_initSIDtune, cRSID_generateSample, cRSID_processSIDfileData, cRSID_playSIDtune, cRSID_pauseSIDtune, cRSID_close, plus the cRSID/cRSID_C64 global objects for inspection.

Part of the modplayjs monorepo. BSD-3-Clause for the port; the underlying cRSID is WTF license by the original author (see NOTICE).