Hacker News new | ask | show | jobs
by whoopdedo 2196 days ago
> = 0072 + 2 * (filenameLength // 2)

I'm having a hard time understanding what is meant by this. Particularly when 114 is the size of the patch after the 8 header bytes. The description also seems to get the word size wrong by treating the first 4 bytes as a NULL-terminated string.

A 4-byte ID and a 4-byte big-endian length is almost universal for audio data. There's even a Python module[1] for it. And it's often nested, so within a chunk of data will be smaller chunks described the same way.

The more complete and easier to analyze description of this patch would look like:

    "FORM" (114)
      "PTCH"
      "CAT " (4)
        "REFS"
      "DESC" (35)
        [BC 01 03 00 00 FF] -- ?
        (2) "17" -- File name
        (19) "Scream 4 Distortion" -- Patch name
      "PARM" (37)
        [BC 01] -- Another BC01
        (15) -- Number of params that follow
        [01 01]
        [02 3E]
        [03 00]
        [04 3E]
        [05 1E]
        [06 00]
        [07 00]
        [08 00]
        [09 00]
        [0A 00]
        [0B 69]
        [0C 28]
        [0D 00]
        [0E 00]
        [0F 55]
        [00]
      "BODY" (0)
(In fact, "FORM" is the header used by AIFF files.)

So a patch is a CAT, a DESC, a PARM, and a BODY (required even if not used). The number and meaning of parameters will depend on the type of effect, but from this we can guess they're all byte-sized, though a mix of signed and unsigned. The 0 byte after the list is a bit of a mystery.

The meanings of these parameters I assume was found by changing a value then seeing which byte changed in the file. The next step will be to compare a patch from a different effect. Even better to find one that makes use of the BODY section. Another fun way of reversing a format is to modify an unknown byte then see what happens when it is loaded.

As for the way the website is presented, I think it would be helpful if the description activated by clicking on a byte instead of hovering. That would make it possible to then select and copy the description. (Truthfully, I'm increasingly convinced that hover effects in general are bad UX.)

[1] https://docs.python.org/3/library/chunk.html

1 comments

thanks for this - and good suggestion about click vs hover - any particular bad examples of hover UX that you come to mind?