I came up with a name, or at least a working title for the project. I will call it the OPL Studio.
Refactoring
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:
- MIDI controller - handles all the MIDI data that's received wither from USB or serial. It was based on the MIDI example code I wrote for the OPL2 library and is now almost completely rewritten for this project including some functions that need backporting the the OPL2 library such as panning and better drum sound handling.
- OPL controller - handles the interface to the OPL2 library to control the OPL3 Duo! or OPL2 Audio Board. Main responsibility of this controller is to manage the channels on the OPL2 / OPL3 chip, load instrument patches and route MIDI notes to a free OPL channel.
- Mixer controller - handles everything to do with volumes, panning and muting
- Transport controller - handles everything to do with timing from either MIDI clock or an internal clock and playing / recording for the sequencer modules
- Patch controller - handles all the 2-OP and 4-OP instrument patches. This controller makes it really easy to assign MIDI programs to either 2-OP or 4-OP instruments as the OPL2 library knows them.
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.
New Fretures
There are a few new features thanks to the controllers
Mixer
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.
Drum Sequencer
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.
Patch Editor
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.
Home Screen
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.
Melody Sequencer
This is now the next big work in progress module. It will be used to record MIDI events from one channel to create small melody sequences such as bass lines. Currently is mostly based on the Drum sequencer with some small changes. For instance there will be only one track so no track selection and mute buttons. I did put in a color + pattern selector so a sequence can be identified later in another module that I'm planning. I will probably add this color + pattern identifier also to the drum sequencer so that drum patterns can also have their own pattern to help identify them later.
Dialog boxes
There are now also two dialog boxes in the code. They are not used yet, but there now is an on-screen keyboard that can be used to edit the name of a patch in the patch editor. There is also a color + pattern picker for the Melody Sequencer that allows you to choose a foreground color, background color and pattern to more easilly identify a sequence.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.