It has all the bases for something nice, but I think handling envelope differently would provide much larger possibilities

Let me explain:
The YM chip enveloppes are very basic, there is only one usable for the all three channels, and the worse is that you lose control on the volume, so personally I would not use the hardware enveloppes at all to do sound shaping, I would only use them (leave them for the music for example) to actually define the grittiness of a sound, the sound texture if you want, where you play it on auto repeat at a much higher frequency than you would normally change sound parameter.
Instead of using the enveloppe, I would just manually change the volume in the IRQ callback, like 50 or 100 times a second, which allows you to do things normally not doable with the AY, like:
- Start and end at any volume you want
- Possibility to have custom attack, decay, sustain and release values
- Possibility to interpolate volume cleanly from one sound to another
- Possibility to have different shapes for each of the three channels
When I worked on my entry for the CEO competition I wrote a small "virtual registers" implementation, which allows the main code to change all the registers easily and only update them when needed in the IRQ to avoid weird sound conflicts, not sure if that can help anyone but it's here if anyone is interested:
https://osdn.net/projects/oricsdk/scm/s ... Road/vbl.s