0.3.0 • Published 2 months ago

punkomatic v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

punkomatic-js

A Punk-O-Matic 2 song data parser and player.

Try it out online!

How to use

You'll need the data folder from POM Converter. You can download it from the developer website.

I also host a copy in the repo. These are not mine, but they are publicly available.

All other code and assets are published under the MIT license.

In browser

<script type="module">
  import * as pm from "./punkomatic.browser.js";

  // render a song to a WAV blob
  const blob = await pm.renderSong({
    sampleDir: "./path-to/samples",
    songData: "<your song data here>",
  }); // returns a Promise<Blob>

  // to play or download it:
  const url = URL.createObjectUrl(blob);
  document.querySelector("audio#my-song").src = url;
</script>

In Node

// CommonJS
const pm = require("punkomatic-js");
// ESM
import * as pm from "punkomatic.js";

const blob = await pm.renderSong({
  sampleDir: "./path-to/samples",
  songData: "<your song data here>",
}); // returns a Promise<Blob>

// to write it to a file:
const fs = require("node:fs/promises");
await fs.writeFile("output.wav", new Buffer(await blob.arrayBuffer()));
0.3.0

2 months ago

0.2.2

11 months ago