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 BRR samples without loop headers #302

Open
PhoenixBound opened this issue Sep 26, 2024 · 0 comments
Open

Support BRR samples without loop headers #302

PhoenixBound opened this issue Sep 26, 2024 · 0 comments

Comments

@PhoenixBound
Copy link
Contributor

CoilSnake currently assumes all BRR samples have an AddMusicK-style header at the beginning (two bytes with the loop point). It's possible to check for this header by seeing whether len(brr_data) % 9 is 0 or 2, but CoilSnake doesn't check that:

# Load BRR data
for inst, filename in zip(instruments, instrument_files):
try:
brr_raw_data: bytes = file_loader(filename, astext=False).read()
brr_data = Block()
brr_data.from_array(array('B', brr_raw_data))
except FileNotFoundError:
raise InvalidUserDataError("instrument BRR '{}' doesn't exist in instrument pack directory".format(filename))
inst.sample = brr_data[2:]
inst.sample_loop_offset = brr_data.read_multi(0, 2)

As a result, if the user takes the direct output of many ordinary BRR sample converters (Bregalad's brrtools excluding some forks, kleinesfilmroellchen's BRR converter, etc), CoilSnake silently corrupts them. At the very least, it should check file size invariants if only headered samples are supported. But since it's easy to check the format, it also might make sense to just support those samples and use a dummy loop point. (Maybe with a non-fatal warning message if the sample ends with a "loop" block?)

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

1 participant