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

Suggestion: Rework the codebase into a .hsb/.rmf extractor #10

Open
nehochupechatat opened this issue Jan 26, 2022 · 11 comments
Open

Suggestion: Rework the codebase into a .hsb/.rmf extractor #10

nehochupechatat opened this issue Jan 26, 2022 · 11 comments

Comments

@nehochupechatat
Copy link

I suggest that someone (maybe fuzziqer) reworks this into something that can rip .rmf/.hsb files.
It also uses snd/esnd/csnd, midi/emid/cmid/ecmi, SONG and INST.
Documentation on hsb/rmf can be found in the miniBAE source code. ALIS is for duplicate patches.

@fuzziqersoftware
Copy link
Owner

Interesting idea. I haven't seen .rmf or .hsb files before; could you upload or link to some examples here? I can't promise I'll get to this soon, but will consider it.

@nehochupechatat
Copy link
Author

rmf is basically beatnik's file format for music mixed with custom samples and it's a lot like mac soundmusicsys songs but with a different structure.

https://github.com/heyigor/miniBAE/tree/main/minibae/Content/rmf
Here are some rmf songs (the bigger ones include custom samples, some use MPEG)

https://github.com/heyigor/miniBAE/tree/main/minibae/banks
hsb banks

hsb and rmf files were used mainly on WebTV, web pages and old cellphones (T-Mobile Sidekick, Nokias)

@nehochupechatat
Copy link
Author

Documentation on the ALIS format (basically duplicate patches - patch 5 will direct to patch 4 for example)
Documentation is available in the source code (documentation folder)

@nehochupechatat
Copy link
Author

Maybe you could also make the tool dump the instrument and alias info into a txt file so people could recreate these instruments in other synths. Maybe you could even implement this INST disassembler into resource_dasm!

@fuzziqersoftware
Copy link
Owner

I've implemented support for .rmf/.hsb/.bsn files; you can use the --index-format=hirf option with resource_dasm to extract the contents. The contents go through the same decoding steps as Mac OS resource forks, so everything gets decrypted and decompressed, snds become .wav files, etc. Curiously, the SONG resource format is different in RMF files and incompatible with the SONG format in resource forks; I implemented support for both formats.

I also added a decoder that turns INSTs into JSON files (as we currently do with SONGs), which hopefully will make them easier to use with other software. I'm not much of a musician and am not familiar with music authoring software so I just used the existing smssynth JSON format, which probably isn't compatible with any popular music software. It's at least human-readable, so you can manually set up the instruments. If there's a specific output format that would be more useful, I might be able to make resource_dasm export in that format.

Unfortunately, I think there's a bug in the ima4 decoder that corrupts certain stereo snds when decoding them. None of my ~700 test cases with Mac OS snd resources trigger this bug, so it might be specific to how Beatnik handles ima4 compression. Like the above, I can't promise I'll be able to fix this soon, but I've added it to the to-do list.

@nehochupechatat
Copy link
Author

nehochupechatat commented Jan 28, 2022

I see. Well, I built on linux mint and it says 'can't open file' for some reason. On raspbian (i use an x86 port) phosg's string test fails. Would you mind releasing a pre-compiled binary?

UPDATE: Solved the problem, thanks.

@nehochupechatat
Copy link
Author

I tried running it and the ima adpcm sample it exports is really broken, not to mention it isn't even actually stereo
for how beatnik handles ima adpcm, use X_IMA.c

http://onj3.andrelouis.com/phonetones/Software%20and%20Soundbanks/Soundbanks/Beatnik%20miniBAE/Danger%20Hiptop.hsb
the hsb i used it with

@nehochupechatat
Copy link
Author

nehochupechatat commented Jan 28, 2022

It seems to export all samples as stereo and truncate them on other hsbs, even if they're actually mono
I tried opening them as raw PCM, and it works but the problem is that the loop points are lost. Could you perhaps update it to export as mono?

@fuzziqersoftware
Copy link
Owner

I added a hack to treat most snds in HIRF archives as mono, and fixed the ALIS template so the text files are readable. The .hsb that you linked above seems to decode properly now. (I don't know what the sounds are supposed to sound like, but they sound reasonable / not corrupted to me.)

@nehochupechatat
Copy link
Author

nehochupechatat commented Jan 28, 2022

.Thanks a lot!
The loop points don't seem to export correctly on this bank and the Hiptop bank though.
http://onj3.andrelouis.com/phonetones/Software%20and%20Soundbanks/Soundbanks/Beatnik%20miniBAE/Sony%20Ericsson%20P800.hsb

Also what else would be nice would be adding ADSR, resonance, sample volume and other valumes into the json.
It's also a part of the documentation

If you want to listen to beatnik stuff for reference use playBAE - a friend got it to compile
https://github.com/zefie/miniBAE

To look at samples through .bsns - use Beatnik Editor (use wine for it) and activate expertconverter
http://onj3.andrelouis.com/phonetones/Software%20and%20Soundbanks/Software/Beatnik%20Editor.zip

.bsn is basically a project file for hsb, so this will let you look at some sample loop points if there is a .bsn for that .hsb.
And also ADSR values.

@nehochupechatat
Copy link
Author

Another goal would be to dump RMF metadata with composer credits (an example file is tropicalist-full.rmf found in the source code)
I think it's a part of the SONG documentation txt

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