raboof / unsfark

DEPRECATED - use https://github.com/raboof/sfArkXTm to uncompress sfArk files instead
https://github.com/raboof/sfArkXTm
4 stars 1 forks source link

ID not found. #1

Closed BenCollver closed 11 years ago

BenCollver commented 12 years ago

I downloaded "m3r organs.sfark" from the following location. http://www.soundfonts.gonet.biz/list.php

I ran: ./unsfark "m3r organs.sfark"

I received the following error: ID not found. File is corrupt or not a compressed soundfont

I ran: file "m3r organs.sfark"

I received the following output: m3r organs.sfark: sfArk compressed Soundfont

dennish commented 12 years ago

First, THANK YOU for this utility. This is desperately needed, especially on OS X Intel Macs. There is no other utility that I know of.

But...I'm having exactly the same issue as BenCollver. Steps to observe this problem: (i) Download "pianissimum.sfArk" from hammersound.com. (ii) Verify in hex editor that the "sfArk" ID is indeed located at byte offset 26. (iii) Run unsfark from the command line. (iv) Receive error message "ID not found. File is corrupt or not a compressed soundfont".

Compiled on "OS X" with this command:

gcc -Wall -g -mfpmath=387 -o unsfark unsfark.c unsfark-cli.c -lz

dennish commented 12 years ago

OK, I figured out the "ID not found. File is corrupt or not a compressed soundfont" issue:

On many systems, "sizeof(SfArkId)" will return the size of the pointer, not the size of the string that the pointer points to. On OS X SfArkId is an 8-byte pointer, so sizeof(SfArkId) == 8, not 6 as expected. To fix this issue, replace "sizeof(SfArkId)" with "strlen(SfArkid)" everywhere.

So that's good. Unfortunately...although the program now outputs an SF2 file, that file seems to be corrupt. It isn't working in my MIDI player (in fact it is crashing the player, although other SF2 files work fine). Any ideas on (i) why this might be, or (ii) how to check the integrity of an SF2 file? If I knew what the SF2 file were supposed to look like then I might be able to fix it.

raboof commented 12 years ago

Could you test 7a3a1dee5e83ee1bf4906499a32754142e98cdfd ? I sort of 'blindly' fixed the issue, i need to get a testsuite together :).

BenCollver commented 12 years ago

I tested 7a3a1d3 and the problem still exists.

One last occurrence of sizeof(SfArkId) still remains. I tried changing it to strlen(SfArkId) and that change seemed to fix the problem.

raboof commented 12 years ago

Woops, fixed that one too.

Does organs.sfark now actually convert correctly for you? I tried a couple of sfark's from the site you mentioned and haven't really had luck with any of them... (but didn't see an 'organs.sfark')

BenCollver commented 12 years ago

Yes, organs.sfark converts correctly for me now. Thanks for the fix!