5 ms·
I got stumped decoding the tempo. I see in a spoiler that the Hex is 00 00 F0 42 but I don't understand how 120.000 is decoded from that.
by amalag 12y ago
I got stumped decoding the tempo. I see in a spoiler that the Hex is 00 00 F0 42 but I don't understand how 120.000 is decoded from that.
- jlouis 12y agoLook up how we usually encode IEEE 754 floating point numbers and then also think about endianess (little or big).
- amalag 12y agoThank you. I feel better prepared to lookup binary formats now. I should have played with Synalize a bit more.
- bradleyjg 12y agoI got stuck on what TFA calls Len. I didn't need it to solve the problem but I couldn't have modified the file without knowing what it was. Luckily a friend of mine saw it almost right away. A fun problem!
- jlouis 12y agoMy first version didn't account for the Len field either. It was only after a while someone told me about its purpose via a hint.
- peteretep 12y ago> state( "Magic", { consume(16), toString(), assert("SPLICE") } ), > state( "Length", { consume( 1), fromOrd(), cropInput() } ), > state( "Version", { consume(32), toString(), setVersion() } ), > state( "Tempo", { consume( 4), fromFloat(), setTempo() }), > state( "Instruments", { exhaust([snip]) } ), The layout, from my abortive attempt to write a parser. http://en.wikipedia.org/wiki/Single-precision_floating-point_format http://en.wikipedia.org/wiki/Single-precision_floating-point...