-
Notifications
You must be signed in to change notification settings - Fork 41
Running OPL2 Audio Board Example Code on the OPL3 Duo
The OPL3 Duo board is backward compatible with the OPL2 Audio board. However with the current hardware and software there are two simple steps that you need to go through before the OPL2 Audio Board examples will work on your OPL3 Duo.
The OPL2 Audio board has different default connections from the OPL3 Duo. Therefore we must change the pinout when we create the OPL2 library instance to tell the library we're going to be using different pins.
If you rather leave the code as is then you need to change how some of the OPL3 Duo pins are connected the the Arduino. Two pins are swapped:
- /IC is connected to Arduino pin 8
- A0 is connected to Arduino pin 9
- All other pins remain the same, no software changes are needed
If you want to keep using the OPL3 Duo pinout, for example because you connect the board with a ribbon cable with a fixed connector, then you need to make a small change to the example code. In every example you will see the following line of code:
OPL2 opl2;
This creates an instance of the OPL2 library with the default pinout. To make it work with the OPL3 Duo pinout we replace this line as follows:
OPL2 opl2(9, 8, 10);
Now you can connect the OPL3 Duo board as you usually would.
There are two address lines, A1 and A2, that the OPL2 Audio Board does not have. Therefore we must put these line into a fixed state if we want to run the OPL2 Audio Board examples as to not 'confuse' the OPL3 Duo.
The simplest way to do this is to connect both the A1 and A2 line to GND. No code changes are needed and you can use the two free Arduino pins for your project.
You can also fix it in the software, but then you must keep A1 and A2 connected to the Arduino. In that case you add the following lines of code above OPL2.begin();
in the setup()
function of the example:
setup () {
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
opl2.begin();
This has the same effect as the hardware solution, but it keeps the way the OPL3 Duo is connected the same.
- OPL2 Audio Board assembly guide
- Connecting the OPL2 Audio Board
- Connecting the OPL3 Duo!
- Troubleshooting
- Definitions
- Constructors and initialization
- Utility functions and helpers
- Instrument functions
- Register getters and setters
- OPL3Duo extensions
- Low level access
- Running OPL2 Audio Board example code on your OPL3 Duo!
- In-depth OPL2 and OPL3 programming guide
- Making a sound
- Working with instruments
- Using the OPL3BankEditor
- DosBox configuration (MIDI only)
- DosBox-X configuration
- Nuke.YKT's serial OPL2/OPL3 protocol
- Bonus project: Touch sensor piano