today's "iliana hacks on xer minidisc bullshit again" progress report1 is that mdrecord now has a --gapless option, which:
- uses ffmpeg to combine your tracks into a single 44100 kHz 16-bit raw audio stream
- sends that single audio stream over NetMD to the recorder
- uses factory mode commands to read the first two UTOC sectors
- uses netmd-tocmanip to parse those sectors
- manipulates the UTOC
- uses netmd-tocmanip to the manipulated javascript objects into sectors again, and factory mode to write them back to the disc
- uses netmd-exploits to upload an exploit to the player that prevents it from writing the (now-wrong) in-memory UTOC to the disc, then reminds you to reset the player by taking the batteries out
kinda bonkers! but it mostly works! "mostly" because i have recorded an album to test it and while it all looks fine and most of the transitions between tracks are indeed gapless, some aren't; here is a summary of the UTOC from recording business pastel's color wheel:
| tracks | is it fine | cluster | sector | group |
|---|---|---|---|---|
| 1->2 | glitch | 177 | 0 | 5->6 |
| 2->3 | ok | 303 | 16 | 1->2 |
| 3->4 | glitch | 427 | 16 | 5->6 |
| 4->5 | ok | 556 | 17 | 8->9 |
| 5->6 | ok | 685 | 1->2 | 10->0 |
| 6->7 | glitch | 835 | 17 | 4->5 |
| 7->8 | ok | 968 | 9 | 8->9 |
| 8->9 | ok | 1121 | 3->4 | 10->0 |
"glitch" here means noticeable duplicated audio samples. i didn't notice any glitches in the other direction (i.e. skipped samples), but i suspect that would be harder to tell by ear.
briefly: a sector is 11 groups, and a cluster is 32 sectors. each sound group is 512 samples of monaural audio, so for stereo audio two consecutive groups2 contains the 512 samples for both channels. my theory was that maybe some of these transitions were happening in the middle of a stereo "pair" of groups, but if the pairs are adjacent, then given the above list all of the transitions are in the middle of a pair or none of them are. so i don't know!
my next step is going to be to test if nudging the transitions one group before or after fixes this issue. and if it doesn't, my next next step is going to be to hit the Track Mark button randomly, listen to it back to see if any new glitches occur, and dumping the TOC to see if i can find any interesting patterns. because the only one i can discern right now is "maybe transitions involving group 5 are cursed"
-
this post is more for future me than it is anyone else, tbh
-
well, supposedly! i am assuming this based on ffmpeg's ATRAC1 decoder, which reads two 212-byte groups at a time when decoding stereo audio. seems like a reasonable assumption.
