Pretty substantial update on this one.
I've taken some considerable steps backward as I have decided to make my own envelope-based sound engine for the VERA/PSG bits. This moves the Dream Tracker away from Concerto. Although I do want to be clear - I find the Concerto engine to be brilliant!!! It reminds me a lot of the richness of my MidiBox MB6582 synth and I'm actually quite excited to see how it will mature and plan on using it for other projects, probably in tandem with a MIDI expansion card and turning the X16 into synthesizer not unlike the MB6582. There the complexity and richness of Concerto is a really good fit for something like that and I'm actually quite looking forward to being able to use the X16 in this way and route it through my Eurorack among other things.
The problem I was running into is one of paradigms. Treating the X16 like a synthesizer is different than treating it like a soundchip. It takes extra work to make complex sounds in a C64 tracker that are very easy on the MB6582 but the flipside other things take much more work on the MB6582, such as trying to exploit all voices for different things at the same time and the ease of modulating things independently. Concerto isn't quite in that extreme but it does feel more like a synthesizer than a tracker and was causing limitations in how I wanted to do modulations common to chiptune trackers.
Given the paradigm of both how I approach trackers and how I expect other tracker composers do, it made sense to jump down to a low level and make the tracker interface more directly mapped to VERA. In many ways this aligns Dream Tracker more to Famitracker, Furnace, etc. ; although it still approaches the UI from an Impulse Tracker approach.
Currently I'm working on just VERA voices for now since FM will be different and require less fanciness I suspect.
The PSG sound engine now operates around the concept of instruments, channel registers and envelopes.
Instruments setup what end up being defaults for a channel. So when there's an instrument change in the pattern data, the engine loads up the instrument data. This includes defaults like volume, wave, pan, etc. but also includes envelope assignment (at present that is just volume but it will be wave/PW and pitch as well).
Envelopes are global and there are currently 32 and they can be up to 256 bytes in length. That was strictly to make the math easy to find an envelope in BRAM since I can use the top byte of the address to quickly lookup and env (A0 = env 0, A1 = env 1, etc.). The bottom byte is then the position.
By global I mean multiple instruments could share the same envelope and for different things. For example, instrument 00 might use envelope 04 for its volume. Instrument 01 might use envelope 04 for it's PWM. Currently envelopes are evaluated at vblank speed but I plan on adding speed flags (much like how speed works for the pattern) to slow them down if required. Each channel keeps a position of the envelope it is on so at vblank, enabled envelopes for each channel are advanced by 1 and each channel is then updated.
Loops will be support in the future as well but not at present, meaning the envelope is evaluated from 0 to 255 over and over. Envelope positions reset on a new note.
To get an idea, here are mockups of the various views I plan on implementing for instrument and env editors:
- inst.png (42.54 KiB) Viewed 24611 times
- full.png (37.43 KiB) Viewed 24611 times
- split.png (37.11 KiB) Viewed 24611 times
What's missing are potential automation options external to vera, though it remains to be seen how much I may want to put that in an instrument vs pattern effects (including macros or tables).
At present, volume envelopes are already implemented in the engine (including enable/disable) and basic instrument support. But there's no UI to manage these at present which definitely makes things pretty limiting though folks can play around with them by adjusting values in init_song.asm. On that note load/saving of instruments and envelopes isn't present (to save them within songs or separately). Adding them to songs will be easy.
Reason being the PSG instruments and envelopes sit on their own BRAM pages. So it's just a matter of saving the pages in the right spot in the file and loading them back out. That should be fairly trivial to do (but doesn't exist yet).