furnace icon indicating copy to clipboard operation
furnace copied to clipboard

fur format

Open stefandrissen opened this issue 3 years ago • 1 comments
trafficstars

I thought it would be fun to write an E-Tracker module (SAM Coupé) to furnace converter.

However... while I used to enjoy hacking the bits out of binary files back in the day, I'm finding binary in 2022 very cumbersome.

Ideally, a furnace file could consist of legible data in something easy like json, with data that makes no sense being text (samples only?) remaining binary. This could then be something like an xslx, a structure of folders and files that are zipped into a single binary (.fur):

song_info.json instruments/01.json instruments/02.json instruments/01.iff patterns/01.json patterns/02.json

Since that could be a bridge too far for now, could the standard fur file be compressed with something easily uncompressible? zlib compression is not something that 7-zip will just uncompress meaning that I am having an unnecessarily hard time trying to create a reference fur file to compare with what I'm generating.

stefandrissen avatar Mar 23 '22 21:03 stefandrissen

Since I'm trying to learn some python for this experience, here's some python to uncompress the fur:

import zlib

with open( 'res/test.fur', 'rb' ) as reader:
    with open( 'res/test.uncompressed.fur', 'wb' ) as writer:
        writer.write(zlib.decompress(reader.read()))

stefandrissen avatar Mar 23 '22 21:03 stefandrissen

Yep, it's a binary format. I don't have plans for an archive-style project as that adds more complexity.

tildearrow avatar Jan 15 '23 19:01 tildearrow

Are you planning to allow furnace to write/export .fur to .wav tracks? Either via console command or with a separate source example?

Great work in any case!

r-lyeh avatar Jan 21 '23 18:01 r-lyeh

Are you planning to allow furnace to write/export .fur to .wav tracks? Either via console command or with a separate source example?

Great work in any case!

Furnace does support audio export using the -output option. Sadly, command line mode is broken under Windows for now...

tildearrow avatar Jan 21 '23 22:01 tildearrow

hey @tildearrow is the commandline fixed already on win32? cant manage to get it working unless i do as follows...

int main(int argc, char** argv) {

#ifdef _WIN32
    {
        if (!AttachConsole(ATTACH_PARENT_PROCESS) && GetLastError() != ERROR_ACCESS_DENIED)assert(AllocConsole() );
        printf("\n"); // print >= 1 byte to distinguish empty stdout from a redirected stdout (fgetpos() position <= 0)
        fpos_t pos = 0;
        if (fgetpos(stdout, &pos) != 0 || pos <= 0) {
            assert(freopen("CONIN$", "r", stdin));
            assert(freopen("CONOUT$", "w", stderr));
            assert(freopen("CONOUT$", "w", stdout));
        }
    }
#endif

// [rest of main]

image

r-lyeh avatar Feb 04 '23 17:02 r-lyeh