Skip to content

lanceewing/opl3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OPL3 emulator

OPL3 emulator usable as a CLI tool or as a library.

Ported from Yamaha YMF262 (OPL3) Emulator by Robson Cozendey.

Using from command line

Install OPL3 emulator as npm install -g opl3.

OPL3 emulator v0.3.3
Usage: opl3 <input file> [OPTIONS]

Options:
  --mp3            Export to MP3
  --wav            Export to WAV
  --ogg            Export to OGG
  --mid            Export to MIDI
  --laa            Use LAA format
  --mus            Use MUS format
  --dro            Use DRO format
  --imf            Use IMF format
  --raw            Use RAW format
  -h, --help       You read that just now
  -n, --normalize  PCM audio normalization (default on, turn off with -n0)
  -p, --play       Play after processing
  -o, --output     Output directory

Examples:
  opl3 ./laa/dott_logo.laa --mp3 dott_logo.mp3 --wav dott_logo.wav --ogg dott_logo.ogg

Copyright (c) 2016 IDDQD@doom.js

Accepts glob patterns as input file, like opl3 **/*.mus.

Using from JavaScript

Use OPL3 and a format handler (like LAA) to process:

var fs = require('fs');

var OPL3 = require('opl3').OPL3;
var LAA = require('opl3').format.LAA;
var Player = require('opl3').Player;
var WAV = require('opl3').WAV;

var player = new Player(LAA);
player.load(fs.readFileSync('./laa/dott logo.laa'), function(err, result){
    if (err) return console.log(err);
    fs.writeFileSync('./dott.wav', new Buffer(WAV(result, 49700)));
    console.log('done!');
}, function(msg){
    // msg format:
    // { cmd: 'position', samples: 0 /* bytes */, duration: 0 /* seconds */ }
    // { cmd: 'progress', value: 100 /* percent */ }
    // { cmd: 'end' }
    process.stdout.write('.');
});

Supported format types

  • LAA: LucasArts music
  • MUS: Doom music
  • DRO: DosBox RAW OPL
  • IMF: Id Music Format
  • RAW: Rdos Raw OPL Capture

Supported audio export formats

PCM audio normalization

By default the command line utility uses peak normalization on the PCM audio result buffer. To turn off this feature, please use -n0 argument.

To enable normalization in the Player interface, instantiate the player like:

var player = new Player(LAA, { normalization: true });

Packages

No packages published

Languages

  • JavaScript 97.1%
  • HTML 2.9%