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

spc-converter

v2.1.0

Published

🎮🎶 Node.js library and command line program to convert Super Nintendo SPC files to WAV or PCM audio.

Readme

🎮🎶 spc-converter npm

Node.js library and command line program to convert Super Nintendo SPC files to WAV files or PCM data.

Use as a command line program

Install

npm i -g spc-converter

Use

Convert to WAV file

spc-converter file.spc file.wav

Outputs file.wav.

Options

spc-converter file.spc file.wav --length=120 --fade=5000 --rate=44100
  • --length: How many seconds to play the song for before it fades out. Defaults to the length in the file's ID666 tag, or 150 seconds if it doesn't have one.
  • --fade: How many milliseconds the song fades out for, after its length. Defaults to the fade in the file's ID666 tag, or 8000 if it doesn't have a length.
  • --xid6-length: Take the song's length from its xid6 tags instead of its ID666 tag, if it has them. They're more exact, but are wrong in many files.
  • --silence: How many seconds of silence end the song early. Defaults to 6. Use 0 to always play the whole length.
  • --rate: The WAV file's sample rate. Defaults to 48000. The Super Nintendo's own is 32000, which needs no resampling.
  • --no-amplification: Ignoring the amplification in xid6 tags.

An option that isn't one of these (like --lenght=10) is an error, which suggests the option you may have meant.

Use in Node.js

Install

npm i spc-converter

Use

Convert a SPC file to a WAV file in your own Node.js script:

const fs = require('fs')
const file = 'file.spc'

// initialize SPCPlayer module
const SPCPlayer = await require('spc-converter')()

// convert SPC file to WAV Buffer
const wavBuffer = await SPCPlayer.renderToWavBlob(file)

// write to file
const outputFileName = file.split('.spc')[0] + '.wav'
fs.writeFileSync(outputFileName, wavBuffer)

You can also use this library to convert a SPC file directly to PCM audio:

const file = 'file.spc'

// initialize SPCPlayer module
const SPCPlayer = await require('spc-converter')()

// convert SPC file to PCM Buffer
const pcmBuffer = await SPCPlayer.renderToPCMBuffer(file)
console.log(pcmBuffer) // then you can do something with the PCM audio data

The PCM audio is interleaved stereo 32-bit floats at 48000 Hz, as the bytes of a Uint8Array.

Both functions take a file path or the file's bytes, and an optional object of options:

  • lengthSeconds: How many seconds to play the song for before it fades out.
  • fadeMilliseconds: How many milliseconds the song fades out for, after its length.
  • xid6Length: true to take the song's length from its xid6 tags instead of its ID666 tag, if it has them. They're more exact (an intro, a loop played a number of times, and an end, to 1/64000th of a second), but are wrong in many files, which is why game-music-emu ignores them.
  • silenceSeconds: How many seconds of silence end the song early. Defaults to 6. Use 0 to always play the whole length.
  • sampleRate: The sample rate to convert to. Defaults to 48000. The Super Nintendo's own is 32000, which needs no resampling. Converting to other rates uses a windowed sinc filter, which doesn't add the distortion simpler resampling does.
  • amplification: false ignore the amplification in its xid6 tags.
const pcmBuffer = await SPCPlayer.renderToPCMBuffer(file, { lengthSeconds: 120, fadeMilliseconds: 5000, sampleRate: 32000 })

Songs play for as long as their ID666 tag says (in either of its text or binary formats), then fade out for as long as it says. Songs whose tag doesn't say how long to play, including files without a tag, play for 150 seconds then fade out over 8 seconds, as game-music-emu does. A song that goes silent for 6 seconds ends there (keeping a second of the silence), also as game-music-emu does, so songs that finish sooner than their length don't trail off into silence. To find out how long a song will be without converting it (at most, since whether it goes silent sooner can't be known without playing it):

const { lengthSeconds, fadeMilliseconds } = SPCPlayer.getSongLength(file)

Development

Install Node.js and either Docker or Emscripten.

  1. Clone this repo.
  2. npm ci
  3. git submodule update --init
  4. npm run build
  5. npm t