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

Support for multi-block ADPCM #1

Open
viciious opened this issue Sep 18, 2024 · 3 comments
Open

Support for multi-block ADPCM #1

viciious opened this issue Sep 18, 2024 · 3 comments

Comments

@viciious
Copy link

Hello!

Thanks for writing and publishing your project on github! Getting VEDIT2 to work is such an ordeal, so VocTool is a godsend.

If I may, I'd like to suggest adding support for multi-block ADPCM files. Looking at the source code, it appears that source PCM data is always encoded as a single block, meaning the predictor is never reset when mean error gets too high. Or maybe just do that at fixed intervals to keep the error in line.

Cheers!

@TerrySoba
Copy link
Owner

Hi viciious,

I'm glad you find VocTool useful.

I've not done a thorough investigation of the usage of multi-block ADPCM files, so I cannot say how much this would improve audio quality. In my tests so far I have not seen a significant drift of the generated output in comparison with the original, so I have not bothered with it until now.

I have appended the image of a step response of the encoder with compression level 6. The above is the original.
image
I think this could be a good point for a new ADPCM block, as the step currently takes about 3 samples and makes it look more like slope.

Currently I don't have much time to work on VocTool, but if you are interested I'd be happy to merge a pull request by you that implements the feature. I'll also happily answer any question you have about the current code.

@viciious
Copy link
Author

viciious commented Sep 18, 2024

Ideally VocTool needs to be married with adpcm-xq's noise shaping algorithm that improves perceived audio fidelity and also its prediction initialization algorithm that minimizes the error.

UP: I actually did add support for Creative Lab's 4-bit ADPCM to adpcm-xq at some point, albeit getting away with the RIFF container format instead of VOC: https://github.com/viciious/adpcm-xq/blob/c9652e80f87557ac85e1c072026b330f00441bad/adpcm-lib.c

@TerrySoba
Copy link
Owner

That sounds very interesting. Currently VocTool pretty much brute forces the encoding of ADPCM and simply minimizes the squared error. No noise shaping at all.

The code you linked is quite intriguing, as I've not found any other open source Creative Lab's 4-bit ADPCM code before.
If I find the time I might try to add adpcm-xq as an option in VocTool, but no promises ;)

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

No branches or pull requests

2 participants