On 12/8/2022 at 4:25 PM, TomXP411 said:
I don't think octave is needed. In fact, it gets in the way. MIDI note numbers are simpler and faster. It requires fewer parameter lookups, so less time is spent parsing the command, and transposing keys is easier if you leave out octaves. For example, going from C to G is as simple as adding 7 to the note number. That works for any note, no matter where it is on the scale. And as a musician, I really don't think in terms of fixed octaves... I'm thinking more of the relative location of any two notes - especially on piano and guitar, where everything is relative, and shifting keys is just a matter of moving left or right a few spaces.
Combining note and oct into a single argument would make the command parsing a little simpler, definitely.
I was thinking along the lines of note=0-12 where 0 = off, and 1-12 = C .. B
Using a nybble-packed byte in a format similar to what the YM2151 uses seems to make the most sense to me, as it facilitates an easy 12-value LUT for the pitches (in octave 4) and then just << or >> the resulting value to shift it into the correct octave.
Plus, as the intended audience is the novice user / musician, I think keeping it all in terms of note names makes more sense than a raw continuum of intervals. I don't have to stop and think "what's A4 again?"
So I'm thinking xxNOTE <channel>,<value>[, <volume>] seems to work.
channel = 0-8 for FM, and 0-16 for PSG (where 0 = all channels)
value = $xy where x=octave, y=note
note is 0-12, 0=off, else notes on the C .. B scale. (YM uses C# .. C for some odd reason, but that'd just be up to the driver to handle)
As for instruments on PSG - I'm going to nope out of that. It would be necessary to add an ADSR processor and states, and have it be called during IRQ in order to work, and putting that into the IRQ processing just seems like a waste for the majority case. I think the point here is to make it where you can just type a command and hear the tone coming out of the PSG. This does raise the issue of having a command (or syntax variant) for modifying the volume of an existing note on a channel... Hmmm.....
Remember, this isn't intended to be something super awesome, mostly just there to make simple access to sound. I don't think BASIC is well suited for playback of music that gets very intricate anyway, being as slow and not-well-timed as it is.... It's mostly going to be for playing ditties and or simple sound effects during BASIC programs. Heck, I've got a demo program in Zsound that makes a background ZSM player for BASIC. If you want real music in BASIC, you can always just use that. (or a more fleshed-out version of it - the one that's there is quite bare-bones)
As for the underlying code being added to the ROM bank, there's definitely room for discussion about some more advanced things to put in there... not sure if ADSR processing is in scope or not, but having some common tasks done in ROM means that everyone's programs get to be smaller for not having those routines in RAM. There could probably be a MID2PSG call that computes the PSG pitch values based on a MIDI note. How many MIDI pitch values are there in the standard?