kometbomb / klystrack

A chiptune tracker
http://kometbomb.github.io/klystrack/
Other
481 stars 29 forks source link

file(1) magic #219

Closed alexmyczko closed 6 years ago

alexmyczko commented 6 years ago

Hi

I was refering to https://github.com/file/file so using libs is no option, here's the example for goattracker2 (/etc/magic):

magic for Goattracker2, http://covertbitops.c64.org/

from Alex Myczko alex@aiei.ch

0 string GTS5 GoatTracker 2 song

4 string >\0 \b, "%s" 36 string >\0 \b by %s 68 string >\0 \b (C) %s 100 byte >0 \b, %u subsong(s)

0 string cyd!song Klystrack song

0 string cyd!inst Klystrack instrument

You might want to enhance the klystrack stuff, and forward the patch (only the klystrack song/instrument parts) to the file maintainer.

To test, just run file *.kt

kometbomb commented 6 years ago

It probably needs a few different signatures because the song name position differs between versions. Or, the song name could only be shown for the latest version.

alexmyczko commented 6 years ago

How many file format versions exists? Where/how is the version stored? Maybe have a peek at https://github.com/file/file/blob/master/magic/Magdir/audio for examples of other formats?

What about the licenses of the examples directory (instruments, and songs)?

kometbomb commented 6 years ago

At least 17 versions exist, probably more (defined in music.h) but the song title location doesn't change except a few times. Main change is from a fixed length to variable length (first byte tells the length). First byte aftet the signature string tells the version.

I think it's fine to only support versions after 17 because most tunes are at least from that onwards, IIRC.

14.12.2017 10.33 "Alex" notifications@github.com kirjoitti:

How many file format versions exists? Where/how is the version stored? Maybe have a peek at https://github.com/file/file/ blob/master/magic/Magdir/audio for examples of other formats?

What about the licenses of the examples directory (instruments, and songs)?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kometbomb/klystrack/issues/219#issuecomment-351642925, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCK6R8HnrqqRAWxWPD5L8UFjXqgUKA2ks5tAN1cgaJpZM4RAMO9 .

alexmyczko commented 6 years ago

$ file .kt /*.kt AmsterdamBoppe.kt: Klystrack song, version 27 Diverted_Experience.kt: Klystrack song, version 18 Ocean Loader III.kt: Klystrack song, version 27 Paranoimia (Suntronic).kt: Klystrack song, version 24 Sprock'n'Sprawl.kt: Klystrack song, version 12 castlevania.kt: Klystrack song, version 17 dr.happy.kt: Klystrack song, version 17 hskv03-rygar_trance.kt: Klystrack song, version 14 hwv 437.kt: Klystrack song, version 18 obspatial.kt: Klystrack song, version 14 phonkeh.kt: Klystrack song, version 14 ringmod.kt: Klystrack song, version 6 smp_dingleberries_fix.kt: Klystrack song, version 18 smp_dpintro.kt: Klystrack song, version 17 n00bstar-examples/Arps.kt: Klystrack song, version 25 n00bstar-examples/Buzz.kt: Klystrack song, version 25 n00bstar-examples/FXBus.kt: Klystrack song, version 25 n00bstar-examples/Multiplex.kt: Klystrack song, version 25 n00bstar-examples/Oscillators_And_Wavetable.kt: Klystrack song, version 25 n00bstar-examples/Ringmod.kt: Klystrack song, version 25 n00bstar-examples/Sync.kt: Klystrack song, version 25

Does that look right, more or less?

kometbomb commented 6 years ago

Looks about right. As you can see you need to handle quite few tunes before version 17.

2017-12-14 14:13 GMT+02:00 Alex notifications@github.com:

$ file .kt /*.kt AmsterdamBoppe.kt: Klystrack song, version 27 Diverted_Experience.kt: Klystrack song, version 18 Ocean Loader III.kt: Klystrack song, version 27 Paranoimia (Suntronic).kt: Klystrack song, version 24 Sprock'n'Sprawl.kt: Klystrack song, version 12 castlevania.kt: Klystrack song, version 17 dr.happy.kt: Klystrack song, version 17 hskv03-rygar_trance.kt: Klystrack song, version 14 hwv 437.kt: Klystrack song, version 18 obspatial.kt: Klystrack song, version 14 phonkeh.kt: Klystrack song, version 14 ringmod.kt: Klystrack song, version 6 smp_dingleberries_fix.kt: Klystrack song, version 18 smp_dpintro.kt: Klystrack song, version 17 n00bstar-examples/Arps.kt: Klystrack song, version 25 n00bstar-examples/Buzz.kt: Klystrack song, version 25 n00bstar-examples/FXBus.kt: Klystrack song, version 25 n00bstar-examples/Multiplex.kt: Klystrack song, version 25 n00bstar-examples/Oscillators_And_Wavetable.kt: Klystrack song, version 25 n00bstar-examples/Ringmod.kt: Klystrack song, version 25 n00bstar-examples/Sync.kt: Klystrack song, version 25

Does that look right, more or less?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kometbomb/klystrack/issues/219#issuecomment-351694361, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCK6X2oQTFoU2VPUdR_7datnj6iXLL-ks5tARDvgaJpZM4RAMO9 .

alexmyczko commented 6 years ago

https://github.com/file/file/commit/089a6c3222c77aaca18a185a2a3222b7474ce580

kometbomb commented 6 years ago

Thanks!