Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will support for ADPCM-B be added? #4

Open
tcalospora opened this issue Aug 26, 2023 · 3 comments
Open

Will support for ADPCM-B be added? #4

tcalospora opened this issue Aug 26, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@tcalospora
Copy link

Support for ADPCMB would be really useful for pitched samples. That way, a composer or developer can use 8 samples (one per octave)
and then change the playback speed to alter the pitch, instead of having one ADPCM-A sample for each note.
Also, the ADPCM-B auto-loop might be useful for longer, extended notes.
Deflemask support for ADPCMB would be great.

I realize this might not be an issue/bug, but there is not a suggestions category for this repo.

@ghost
Copy link

ghost commented Aug 26, 2023

I do believe that ADPCM-B support would benefit the driver greatly, but I don't have any time schedule in which I'll implement it, as I'm prioritizing other features (Mainly control macros, which are macros that run MLM commands with custom parameters each tick). Additionally, due to ADPCM sample end flags being easy to break, the initial 2.0 release won't have ADPCM-B support. This is to give people a driver version to revert to in case ADPCM-B support breaks SFX playback. I'll keep in mind the need for ADPCM-B in future releases.

@ghost ghost added the enhancement New feature or request label Aug 26, 2023
@tcalospora
Copy link
Author

Here is a quote from another repo. I found something about the ADPCM-B channel looping feature that might prove helpful if and when you get around to adding support:

I've made a discovery. After editing two of my samples, the popping became less pronounced, but the rest still sounded the same. After comparing their lengths, I found that they both took up 18684 bytes. This is extremely close to 18688, which is a multiple of 256.
I remember that the start and end addresses for the ADPCM-B channel on the YM2610 are 3 bytes long, but only the top 2 bytes can be set (the bottom byte being $0 or $FF). Perhaps the popping is because the channel doesn't loop until it reaches the end of 256 bytes, but most samples have some padding at the end, so the channel plays the padding of $0's.
This would also explain why the pops appear as a flat line in the oscilloscope.

My conclusion is that looped samples must be slightly under a multiple of 256 bytes long or they will have popping when the channel interprets padding as sample data.

After re-consulting the datasheet, I think the only way to get a smooth loop would be to use Timer A to generate an interrupt for the Z80 sound cpu, check the ADPCM status and manually reset the channel if it is near the end.

@ghost
Copy link

ghost commented Sep 19, 2023

Thank you, this might be quite helpful! I'll keep it in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant