Close

Testing, Testing, Testing

A project log for OPL Studio - OPL2 / OPL3 MIDI Interface

a MIDI interface for the OPL2 Audio Board and OPL3 Duo!

maarten-janssenMaarten Janssen 02/21/2022 at 18:400 Comments

New Prototype PCBs

The new prototype boards have shown up and I have been busy assembling a new OPL Studio.

This new batch is again better than the previous one with only two small issues to tackle. First one is really simple and an unfortunate mistake where I left the hole for the screen just 1mm too small for the LCD to fit. The second one was removing the driver transistors for the MIDI activity led. Apart from these mistakes the new boards are working great! Previous issues with noise caused by the PWM signal of the LCD backlight is also fixed and with some extra testing and trying out filter capacitors it looks like also the noise issues caused by SPI and the tone() function appear to be fixed.

Testing, Bug Fixing and Refactoring

Most time I'm now spending on testing the OPL Studio by (attempting to) making music. (I'm not very musical). Once I started to use the device more like a real user would I found some serious issues that I had overlooked. The most serious being how the code was keeping track of which notes were playing. In MIDI land when you play a note you keep track of it using its channel and the note index. That way you know when a note off event occurs which note to stop. On the OPL Studio this gets more complicated, for example due to the linked patches where you can trigger the same note again with a delay, or where you can overlap sequences and play the same sequence multiple times. All this meant that it was relatively easy to confuse the player and clubber notes resulting in really choppy playout. It was also not possible to mix MIDI playback with sequence playback. 

This was quite a fundamental problem that turned into a substantial refactoring of the MIDI and OPL interface code. It resulted in separating the MIDI channels from the internal channels used by OPL Studio to play sequences. Sequences still depend on MIDI channels, but only as an input source, for example while recording. Playback will happen on one of eight internal channels. 

After refactoring I also enabled channel after touch and modulation. These will apply a vibrato to the channel. It will now also be relatively simple to implement external synth control over these parameters where you could control both the amplitude and frequency of the vibrato.

The clip below plays a short MIDI file with the improved MIDI and OPL interfaces.

Future Upgrades

In the future, if there is enough RAM left, what I want to do is to allow for more granular control over sequences. Currently sequences do not register pitch changes, volume changes or after touch, but it would be great if these effects are also recorded and editable for more interesting sounds. I have sketched out some ideas on how to do this, but I will leave it for later until after the initial OPL Studio is ready. Ow and also polyphonic melody sequences must be added back! Things for the first software update...

While playing around another big shortcoming was the song limit in the composer. '256 bars ought to be enough for anybody...' what was I thinking! So next improvement will be on the composer module to allow for longer songs.

Getting Ready for Production

All in all the OPL Studio project is finally getting ready for its initial release. I will spend still a few weeks to play with the device, do more bug fixing to get it into a good working state, get the final PCBs produced and then it will be time to release the OPL Studio to everyone!

Discussions