Crate ym2149_wasm

Crate ym2149_wasm 

Source
Expand description

WebAssembly bindings for YM2149 PSG emulator.

This crate provides WebAssembly bindings for playing YM2149 chiptune files directly in web browsers using the Web Audio API.

§Features

  • Load and play YM2-YM6 format files
  • Load and play Arkos Tracker (.aks) files
  • Load and play AY format files
  • Playback control (play, pause, stop, seek)
  • Volume control
  • Metadata extraction (title, author, comments)
  • Channel muting/solo
  • Real-time waveform data for visualization

§Example Usage (JavaScript)

import init, { Ym2149Player } from './ym2149_wasm.js';

async function playYmFile(fileData) {
    await init();

    const player = Ym2149Player.new(fileData);
    const metadata = player.get_metadata();
    console.log(`Playing: ${metadata.title} by ${metadata.author}`);

    player.play();
}

§Module Organization

Internal modules handle:

  • Metadata types and conversion functions
  • Player wrappers for different file formats

Structs§

Ym2149Player
Main YM2149 player for WebAssembly.

Constants§

YM_SAMPLE_RATE_F32
Sample rate used for audio generation.

Functions§

init_panic_hook
Set panic hook for better error messages in the browser console.