undisbeliever / terrific-audio-driver

A homebrew audio driver for the Super Nintendo
Other
15 stars 3 forks source link

New pan and volume instructions #15

Open undisbeliever opened 3 weeks ago

undisbeliever commented 3 weeks ago

Updated 22 November 2024

KungFuFurby commented 3 weeks ago

First feedback here will be with the inversion settings.

It looks like you have things set up in the inversion settings so that waveform cancelation doesn't become a problem in mono. I recommend adding an optional mono word specification to the bytecode assembly that will allow the mono flag to be set or not set according to the user's preference, and something similar in MML would also get involved (probably a lowercase m). It can also be implied to be set if both sides are set.

I also recommend a sound driver setting that will allow left and right channels to be inverted separately (as in like mono/stereo/surround: surround allows all of them, stereo means no separate inversion settings for left/right (treat like mono when handling inversion) but allow panning, and mono also doesn't have panning) to prevent waveform cancelation issues. This would also apply to the echo volume, as that also supports negative values. The main volume (referring to the MVOL DSP registers) is in the same situation, but is never changed from $7F.

undisbeliever commented 3 weeks ago

I recommend adding an optional mono word specification to the bytecode assembly that will allow the mono flag to be set or not set according to the user's preference, and something similar in MML would also get involved (probably a lowercase m). It can also be implied to be set if both sides are set.

In this context are you talking about a command to set the channel inversion mono flag? or the global stereo/mono flag?

I also recommend a sound driver setting that will allow left and right channels to be inverted separately (as in like mono/stereo/surround: surround allows all of them, stereo means no separate inversion settings for left/right (treat like mono when handling inversion) but allow panning, and mono also doesn't have panning) to prevent waveform cancelation issues. This would also apply to the echo volume, as that also supports negative values. The main volume (referring to the MVOL DSP registers) is in the same situation, but is never changed from $7F.

A surround global flag sounds useful. I'll need to code golf a way to efficiently detect sign changes in set_stereo_echo_volume, but it shouldn't be too hard.

KungFuFurby commented 3 weeks ago

I recommend adding an optional mono word specification to the bytecode assembly that will allow the mono flag to be set or not set according to the user's preference, and something similar in MML would also get involved (probably a lowercase m). It can also be implied to be set if both sides are set.

In this context are you talking about a command to set the channel inversion mono flag? or the global stereo/mono flag?

I meant the m bit in the invert command, so the channel inversion mono flag that you specified.

undisbeliever commented 1 day ago

Updated the syntax of the MML syntax of the invert instruction.


@KungFuFurby should the MML syntax for volume/pan slides use ticks or length? I'm leaning towards ticks as that matches the vibrato, tremolo, panbrello and early-release effects.

I've noticed that PMDMML has a q [l length] syntax (ie ql16 is set_early_release 6 on a 96 ZenLen) and uses l length on a few commands that have tick arguments. I could add that to the syntax, use ticks by default and optionally allow a volume slide for a given length (ie, vs+5,l4).

What are your thoughts on the matter?

KungFuFurby commented 15 hours ago

Sounds like a good call.


I think I understand most of the logic for the inversion syntaxes... except I'm leaning towards M being an optional add-on to any of those since it would logically set the m bit for the invert command. It also makes for a nice match-up to the bytecode assembly syntax you defined up above.