2
0
Fork 0
Public archive of github.com/reales/OPL
Go to file
bsutherland 2482447f98 Fix some percussion recording issues. 2015-01-15 12:07:49 +09:00
Instruments Remove a bunch of duplicate instruments from synth.bbs (already in AdlibTracker). 2013-12-09 23:26:53 +08:00
Source Fix some percussion recording issues. 2015-01-15 12:07:49 +09:00
dro2midi Update README 2013-11-14 21:59:30 +08:00
img Fix channel reuse does not take into account release after keyOff and needlessly interrupts still audible notes. Now always selecting oldest free channel. 2014-08-25 23:36:25 +02:00
py Improve instrument ripper C++ output and add some instruments from Dune 2. 2013-09-15 00:47:55 +08:00
.gitignore Increment version number and ignore release directory. 2014-08-31 19:36:45 +09:00
COPYING Add GPL v2 license from DOSBox. 2013-10-27 16:47:01 +08:00
JuceOPLVSTi.jucer Fix some percussion recording issues. 2015-01-15 12:07:49 +09:00
readme.md Work in progress - refactoring for multiple instance DRO recording, bug fix. 2015-01-06 12:13:44 +09:00

readme.md

OPL VST plugin

This VST instrument provides an emulated OPL sound chip. It provides all features of the OPL2, and some features of the OPL3.

See here for Windows binaries, screenshots etc: http://bsutherland.github.io/JuceOPLVSTi/

What's an OPL?

The OPL is a digital sound synthesis chip developed by Yamaha in the mid 1980s. Among other products, it was used in sound cards for PC, including the Adlib card.

At a technical level: the emulator has channels comprised of 2 oscillators each. Each pair of oscillators is usually combined via phase modulation (basically frequency modulation). Each oscillator can produce one of eight waveforms (sine, half sine, absolute sine, quarter sine, alternating sine, camel sine, square, logarithmic sawtooth), and has an ADSR envelope controlling its amplitude. The unusual waveforms give it a characteristic sound.

Caveats and Limitations

Before I wrote this, I didn't know much about VST or the OPL at a technical level. This is the first VST plugin I've written. The sample rate is locked at 44.1 kHz. In hindsight I would have implemented things a bit differently, but it all basically works, and is now reasonably well tested.

How do I use it?

Each instance of the plugin emulates an entire OPL chip, but polyphony is implemented by using a channel per note. Parameter changes applied to all channels. With this plugin, essentially you are just working with two operators.

Some documentation which may be useful:

Percussion

Percussion mode is now supported! This mode is not very well documented, even in the original Yamaha documentation. It works with the DOSBox emulator, but doesn't seem to work too well in the ZDoom emulator. Here are some tips on using it based on experimentation and looking at the DOSBox source code.

  • Bass drum: Uses both operators. Essentially just doubles output amplitude?
  • Snare: Uses carrier settings. Abs-sine waveform recommended.
  • Tom: Uses modulator settings. Sine waveform recommended.
  • Cymbal: Uses carrier settings. Half-sine recommended.
  • Hi-hat: Uses modulator settings. Half-sine recommended.

Also, a link to some much more detailed notes on percussion mode based on experimentation with real hardware!

http://midibox.org/forums/topic/18625-opl3-percussion-mode-map/

How did you create the instrument programs?

To figure out the parameters used by the original games, I just added a printf to the DOSBox OPL emulator, compiled DOSBox, ran the games, and captured their output as raw register writes with timestamps.

I hacked together a Python script which parses the raw output, identifying unique instruments and outputting the parameter values.

How did you do this?

The emulation (ie, the hard part!) is taken straight from the excellent DOSBox and ZDoom projects. I also used a function from libgamemusic by Adam Nielsen for converting frequencies from Hertz into the "FNUM" values used by the OPL.

The VST was written using Juce, a cross-platform C++ library inspired by the Java JDK. Among other things, Juce provides a GUI for generating boilerplate for audio plugins.

The code I wrote is essentially a device driver for the emulated OPL, implementing the VST interface, and providing a UI.

Building

So far I've only built under Windows. Thanks to Juce, it should be possible to build under OSX and Linux too. Volunteers to build OSX/Linux releases would be appreciated (XCode required for OSX).

Windows Build Instructions

  1. Download Juce (http://www.juce.com/)
  2. Download the VST SDK (http://www.steinberg.net/en/company/developer.html)
  3. Run "The Introjucer" executable included in Juce.
  4. Open JuceOPLVSTi.jucer
    • Make any changes to the GUI layout and components here (PluginEditor.cpp).
    • Save PluginEditor.cpp if modified
  5. Hit "Save Project and Open in Visual Studio". I use Visual Studio Express 2013.
  6. (For Windows XP compatibility) In the project's properties, set platform toolset to Windows XP (Configuration Properties > General).
  7. Build!