A Punk-O-Matic 2 song data parser and player.
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.
<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>",
compress: true, // slower, but file takes less space
}); // returns a Promise<Blob>
// to play or download it:
const url = URL.createObjectUrl(blob);
document.querySelector("audio#my-song").src = url;
</script>
// ESM only
import * as pm from "punkomatic.js";
const blob = await pm.renderSong({
sampleDir: "./path-to/samples",
songData: "<your song data here>",
compress: true, // slower, but file takes less space; may currently be broken in Node
}); // 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()));