a MIDI interface for the OPL2 Audio Board and OPL3 Duo!
To make the experience fit your profile, pick a username and tell us what interests you.
I came up with a name, or at least a working title for the project. I will call it the OPL Studio.
After a few weeks of refactoring a lot of the initial code I'm back at the ponit where I was in the last log, but with a much more solid foundation that makes it really east to extend the UI and build new functional modules for the project. Besides the MIDI code that was always running in the background there are now a few other modules running in the background:
With these controllers running in the background the UI can talk to a controller whenever you change something. For example changing the volume by fdagging a volume slider will change the value in the MixerController. This also works from MIDI; a MIDI event to change volume will be routed to the MixerController to change the volume and this is detected by the UI to repaint the volume slider of the MIDI channel that was changed.
This makes it much easier to code the UI and another great benefit is that it takes much less resouces for the UI to render now it only needs the updte elements that have changed. There are still some UI tasks that need streamlining, for instance when many elements need to update while also MIDI data is received it shou;d not block the audio. Currently this is only noticable slightly when a window is opened and a bot more noticable when a window is closed and the Teensy clears its memory and repaints the background.
There are a few new features thanks to the controllers
The Mixer is now fully working! The volume sliders work, panning works, as well as the mute and solo buttons.. Maybe I'll make a change still to the level indicators to take into account instruments without a sustain to immediately start dropping off instead of waiting for a note off event.
The Drum Sequencer is now using the new TransportController and its UI for timing and playing. The clock source can either be a MIDI clock or internal clock. The buttons now have familiar playout icons and they function a bit different: play is now a toggle button so playout can be started and paused. Stop will stop and reset playout to the beginning of the sequence. The recording function is still missing here.
The patch editor has received a big update. It can now edit both 4-OP and 2-OP patches and select between melodic and percussive instruments. The synthesizer mode now also has a visual indicator to better show the connection between the operators. The transpose now works and it chooses the drum note when editing a percussive instrument.
On the home screen there is a new icon for the Melody Sequencer and there is a 'transparent' logo in the corner. Not sure yet if I'll keep it... I though it was nice to try out now I gave the project a working title.
This is now the next big work in progress module. It will be used to record MIDI events from one channel to create small...Read more »
Since the last log I've spend a lot of time to make the three modules more functional. The mixer now has a functioning scrollbar so all 16 MIDI channels can be shown in the window. Also the mute and solo buttons have now been implemented. The channel volume sliders do not function yet. They will show the volume of the MIDI channel when changed, but draging the slider has no actual effect yet. Also panning is still missing.
In the drum sequencer the volume slider is now working. Each drum track can be set to a different volume level. Also now the sequencer uses the MIDI controller to play the drums. This means that currently the drums will only use 2-operator drum sounds instead of the 4-op drums I had before. This is only temporary until the MIDI controller code is more capable and can handle 2-op and 4-op on every channel. Currently melodic channels use 4-op instruments and the drum channel uses 2-op instruments.
For the patch editor I only made some small bug fixes and I added a transpose control.
The biggest visible change is the new home screen from where you can launch the three modules by tapping their icon. I drew the icons myself, taking a lot of inspiration from Windows 3.1 icons and imagining how they could look for the different modules.
The windows now also have a functioning close button that takes you back to the home screen. The app modules do not run in the background yet. For example when the patch editor is closed it is also removed from memory. The patches, though, are kept globally so they will not be erased and any MIDI channel that uses the patch will still sounds exactly as it was edited.
The next step will be to allow the controllers of the modules to run in the background. For example the sequencer can be playing while you edit the instrument patch to immediately hear the change or have live control over the sound. Or you can use the mixer to adjust channel volumes on the fly. The module controllers will work independently of the UI and hold the state of each module. This is to save on the memory consumed by the UI when a module is not actively in use.
I also started working on a melody sequencer module. This one is not very functional yet and can only record and play 16 MIDI note on events on a single channel. It's just a bunch of loose UI elements for now without a window. I first want to flesh out the controllers of the various modules more and improve the MIDI controller to make my life easier to continue with this sequencer.
Over the past 2 weeks I've been busy figuring out how to implement the different modules such as the sequencer, bank editor and mixer of my project. Also a lot of time has gone into setting up the event system to direct touch events from the pointer to the correct UI component of the active module. The three modules that I have now look like small individual apps that I can run on the device. There is still some plumbing needed to launch the different modules, so for now it will just run whatever module is hardcoded to launch.
Of course I need a bank editor to change the OPL3 values of each instrument. The bank editor is why I started this project. I've broken out all the settings of the 4 operators of a channel in separate tabs. All settings can already be changed and will immediately change on the MIDI program that is selected, so after changing the OPL3 settings you can hear the result by playing some notes on the keyboard. It's a lot of fun to experiment with!
Currently only 4-operator instruments are supported, but I also want 2-operator bank support in the near future. Right now the my MIDI code simply assumes 4-operator instruments, because I wrote it for my OPL3 Duo boards. Also some additional work is still needed to bring it all together, such as changing the name of an instrument, visualization of the synth mode (AM-AM ... FM-FM) and eventually I want to be able to save and load instrument banks...
MIDI Channel Mixer
The MIDI Channel Mixer is the second module I've started to work on. It shows per channel the program, volume, panning, mute and solo buttons and some LED indicators to thow the output level. This all works in real time from the MIDI events that are received. It's not just a static display; you can drag the sliders to change volume, toggle the mute and solo buttons by clicking them and this will directly influence the MIDI player in the background.
There is still quite some work to be done. The vertical scroll bar to scroll past channel 8 is not yet functional and I have not yet implemented panning iin the MIDI code. Clicking the program name to select a different program is probably also desirable. Some code optimizations are also needed, for example whenever a volume change event is received it will immediately update the volume slider and this can delay processing other MIDI events, so the visual update should only happen during the update of the module.
So far I think it looks great and functionality is already quite nice!
I've been working on the little drum sequencer module.
It now has the following abilities:
Some things that are still missing:
The UI is going to be my own design and it's going to look like something you could find on a classic DOS / Windows PC in the early 90s. It should fit the era where these OPL2 / OPL3 chips were commonly used. To have full control over the UI and especially the memory it will consume I'm writing it from scratch. It's a big task, but I plenty of experience in this area and already so I'm confident that I can pull it off!
After a few evenings of writing code I'm already very happy with the results. I can draw some UI elements such as text labels, buttons, spinners and windows. All are drawn using a lovely EGA palette to look appropriate for the early 90s PC era. I also wrote some functions that allow me to fill rectangles with a pattern to dither the colors and made a custom font.
The biggest hurdle up to now has been the touch screen. The coordinates that you read from the interface can be very erratic, even after calibrating the stylus. To get a reliable reading from the touch screen I'm taking the average of multiple readings of the touch position. I've added a little piezo speaker to make little clicking noises when you press a button.
Currently I'm at a stage where I'm playing around with the UI. Building mock up screens to test the few components that I've already written such as buttons and spinners and the events they generate.
Become a member to follow this project and never miss any updates