{"abstract":"Samples in the second half of a frame are attributed to the next frame.","category":"Broadcast timecode arithmetic","checks":9,"contract":"At 48000 samples per second and rate N/D, the frame containing sample s is floor(s*N/(48000*D)); frame k starts at sample ceil(k*48000*D/N). Return [frame, offset of s inside its frame, number of samples in that frame].","evaluation_group":"w2-broadcast-timecode-arithmetic-audio-sample-cadence","failed_approach":"Dividing by a truncated whole number of samples per frame drifts at NTSC rates.","family":"w2-broadcast-timecode-arithmetic-audio-sample-cadence-frame-index","id":"FA-78666","implementations":{"attempt":{"sha256":"0f6cb7587b3c64b5147ef669cbdc74a78169d09f90f10ba7b336021a8cd1bbd0","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(sample, rate):\n    num,den={'23.976':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1)}[rate]\n    frame=sample//(48000*den//num)\n    start=-(-frame*48000*den//num)\n    return [frame,sample-start,-(-(frame+1)*48000*den//num)-start]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: frame index', [1601, '29.97'], [0, 1601, 1602]), ('regression variant: frame index', [1602, '23.976'], [0, 1602, 2002]), ('partial repair probe: frame index', [5867905, '29.97'], [3663, 1244, 1602]), ('partial repair variant: frame index', [8247925, '29.97'], [5149, 1286, 1601]), ('boundary control', [1602, '29.97'], [1, 0, 1602]), ('boundary control', [2002, '23.976'], [1, 0, 2002]), ('normal control', [3204, '29.97'], [2, 0, 1601]), ('normal control', [1919, '29.97'], [1, 317, 1602]), ('normal control', [1920, '30'], [1, 320, 1600])], [('regression: frame index', [1602, '24'], [0, 1602, 2000]), ('regression variant: frame index', [1601, '25'], [0, 1601, 1920]), ('partial repair probe: frame index', [8007, '29.97'], [4, 1600, 1601]), ('partial repair variant: frame index', [5303585, '29.97'], [3311, 687, 1602]), ('boundary control', [3204, '29.97'], [2, 0, 1601]), ('boundary control', [1602, '29.97'], [1, 0, 1602]), ('normal control', [8008, '25'], [4, 328, 1920]), ('normal control', [0, '25'], [0, 0, 1920]), ('normal control', [8008, '29.97'], [5, 0, 1602])], [('regression: frame index', [1600, '25'], [0, 1600, 1920]), ('regression variant: frame index', [1920, '23.976'], [0, 1920, 2002]), ('partial repair probe: frame index', [3494632, '29.97'], [2181, 1542, 1602]), ('partial repair variant: frame index', [8735595, '29.97'], [5454, 468, 1601]), ('boundary control', [1920, '25'], [1, 0, 1920]), ('boundary control', [3204, '29.97'], [2, 0, 1601]), ('normal control', [1, '23.976'], [0, 1, 2002]), ('normal control', [0, '24'], [0, 0, 2000]), ('normal control', [2002, '24'], [1, 2, 2000])], [('regression: frame index', [9580501, '29.97'], [5981, 1331, 1602]), ('regression variant: frame index', [2041513, '30'], [1275, 1513, 1600]), ('partial repair probe: frame index', [3203, '29.97'], [1, 1601, 1602]), ('partial repair variant: frame index', [7203996, '29.97'], [4497, 1600, 1601]), ('boundary control', [2002, '23.976'], [1, 0, 2002]), ('boundary control', [1920, '25'], [1, 0, 1920]), ('normal control', [8009, '30'], [5, 9, 1600]), ('normal control', [0, '23.976'], [0, 0, 2002]), ('normal control', [1600, '30'], [1, 0, 1600])], [('regression: frame index', [3203, '25'], [1, 1283, 1920]), ('regression variant: frame index', [1601, '24'], [0, 1601, 2000]), ('partial repair probe: frame index', [3315925, '29.97'], [2070, 613, 1602]), ('partial repair variant: frame index', [3637063, '29.97'], [2270, 1431, 1602]), ('boundary control', [1602, '29.97'], [1, 0, 1602]), ('boundary control', [2002, '23.976'], [1, 0, 2002]), ('normal control', [1, '24'], [0, 1, 2000]), ('normal control', [2002, '25'], [1, 82, 1920]), ('normal control', [8009, '29.97'], [5, 1, 1602])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"8c544bdcff96fe2df20d4770fd98c4e1fcc56b97eb33870112bfc75b6aa6b1dd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(sample, rate):\n    num,den={'23.976':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1)}[rate]\n    frame=(sample*num+24000*den)//(48000*den)\n    start=-(-frame*48000*den//num)\n    return [frame,sample-start,-(-(frame+1)*48000*den//num)-start]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: frame index', [1601, '29.97'], [0, 1601, 1602]), ('regression variant: frame index', [1602, '23.976'], [0, 1602, 2002]), ('partial repair probe: frame index', [5867905, '29.97'], [3663, 1244, 1602]), ('partial repair variant: frame index', [8247925, '29.97'], [5149, 1286, 1601]), ('boundary control', [1602, '29.97'], [1, 0, 1602]), ('boundary control', [2002, '23.976'], [1, 0, 2002]), ('normal control', [3204, '29.97'], [2, 0, 1601]), ('normal control', [1919, '29.97'], [1, 317, 1602]), ('normal control', [1920, '30'], [1, 320, 1600])], [('regression: frame index', [1602, '24'], [0, 1602, 2000]), ('regression variant: frame index', [1601, '25'], [0, 1601, 1920]), ('partial repair probe: frame index', [8007, '29.97'], [4, 1600, 1601]), ('partial repair variant: frame index', [5303585, '29.97'], [3311, 687, 1602]), ('boundary control', [3204, '29.97'], [2, 0, 1601]), ('boundary control', [1602, '29.97'], [1, 0, 1602]), ('normal control', [8008, '25'], [4, 328, 1920]), ('normal control', [0, '25'], [0, 0, 1920]), ('normal control', [8008, '29.97'], [5, 0, 1602])], [('regression: frame index', [1600, '25'], [0, 1600, 1920]), ('regression variant: frame index', [1920, '23.976'], [0, 1920, 2002]), ('partial repair probe: frame index', [3494632, '29.97'], [2181, 1542, 1602]), ('partial repair variant: frame index', [8735595, '29.97'], [5454, 468, 1601]), ('boundary control', [1920, '25'], [1, 0, 1920]), ('boundary control', [3204, '29.97'], [2, 0, 1601]), ('normal control', [1, '23.976'], [0, 1, 2002]), ('normal control', [0, '24'], [0, 0, 2000]), ('normal control', [2002, '24'], [1, 2, 2000])], [('regression: frame index', [9580501, '29.97'], [5981, 1331, 1602]), ('regression variant: frame index', [2041513, '30'], [1275, 1513, 1600]), ('partial repair probe: frame index', [3203, '29.97'], [1, 1601, 1602]), ('partial repair variant: frame index', [7203996, '29.97'], [4497, 1600, 1601]), ('boundary control', [2002, '23.976'], [1, 0, 2002]), ('boundary control', [1920, '25'], [1, 0, 1920]), ('normal control', [8009, '30'], [5, 9, 1600]), ('normal control', [0, '23.976'], [0, 0, 2002]), ('normal control', [1600, '30'], [1, 0, 1600])], [('regression: frame index', [3203, '25'], [1, 1283, 1920]), ('regression variant: frame index', [1601, '24'], [0, 1601, 2000]), ('partial repair probe: frame index', [3315925, '29.97'], [2070, 613, 1602]), ('partial repair variant: frame index', [3637063, '29.97'], [2270, 1431, 1602]), ('boundary control', [1602, '29.97'], [1, 0, 1602]), ('boundary control', [2002, '23.976'], [1, 0, 2002]), ('normal control', [1, '24'], [0, 1, 2000]), ('normal control', [2002, '25'], [1, 82, 1920]), ('normal control', [8009, '29.97'], [5, 1, 1602])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"2aa3c30be298d8686c03cb5ac4d21fd1a41a3b2ba9af914bd3ecd1cc7316eae1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(sample, rate):\n    num,den={'23.976':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1)}[rate]\n    frame=sample*num//(48000*den)\n    start=-(-frame*48000*den//num)\n    return [frame,sample-start,-(-(frame+1)*48000*den//num)-start]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: frame index', [1601, '29.97'], [0, 1601, 1602]), ('regression variant: frame index', [1602, '23.976'], [0, 1602, 2002]), ('partial repair probe: frame index', [5867905, '29.97'], [3663, 1244, 1602]), ('partial repair variant: frame index', [8247925, '29.97'], [5149, 1286, 1601]), ('boundary control', [1602, '29.97'], [1, 0, 1602]), ('boundary control', [2002, '23.976'], [1, 0, 2002]), ('normal control', [3204, '29.97'], [2, 0, 1601]), ('normal control', [1919, '29.97'], [1, 317, 1602]), ('normal control', [1920, '30'], [1, 320, 1600])], [('regression: frame index', [1602, '24'], [0, 1602, 2000]), ('regression variant: frame index', [1601, '25'], [0, 1601, 1920]), ('partial repair probe: frame index', [8007, '29.97'], [4, 1600, 1601]), ('partial repair variant: frame index', [5303585, '29.97'], [3311, 687, 1602]), ('boundary control', [3204, '29.97'], [2, 0, 1601]), ('boundary control', [1602, '29.97'], [1, 0, 1602]), ('normal control', [8008, '25'], [4, 328, 1920]), ('normal control', [0, '25'], [0, 0, 1920]), ('normal control', [8008, '29.97'], [5, 0, 1602])], [('regression: frame index', [1600, '25'], [0, 1600, 1920]), ('regression variant: frame index', [1920, '23.976'], [0, 1920, 2002]), ('partial repair probe: frame index', [3494632, '29.97'], [2181, 1542, 1602]), ('partial repair variant: frame index', [8735595, '29.97'], [5454, 468, 1601]), ('boundary control', [1920, '25'], [1, 0, 1920]), ('boundary control', [3204, '29.97'], [2, 0, 1601]), ('normal control', [1, '23.976'], [0, 1, 2002]), ('normal control', [0, '24'], [0, 0, 2000]), ('normal control', [2002, '24'], [1, 2, 2000])], [('regression: frame index', [9580501, '29.97'], [5981, 1331, 1602]), ('regression variant: frame index', [2041513, '30'], [1275, 1513, 1600]), ('partial repair probe: frame index', [3203, '29.97'], [1, 1601, 1602]), ('partial repair variant: frame index', [7203996, '29.97'], [4497, 1600, 1601]), ('boundary control', [2002, '23.976'], [1, 0, 2002]), ('boundary control', [1920, '25'], [1, 0, 1920]), ('normal control', [8009, '30'], [5, 9, 1600]), ('normal control', [0, '23.976'], [0, 0, 2002]), ('normal control', [1600, '30'], [1, 0, 1600])], [('regression: frame index', [3203, '25'], [1, 1283, 1920]), ('regression variant: frame index', [1601, '24'], [0, 1601, 2000]), ('partial repair probe: frame index', [3315925, '29.97'], [2070, 613, 1602]), ('partial repair variant: frame index', [3637063, '29.97'], [2270, 1431, 1602]), ('boundary control', [1602, '29.97'], [1, 0, 1602]), ('boundary control', [2002, '23.976'], [1, 0, 2002]), ('normal control', [1, '24'], [0, 1, 2000]), ('normal control', [2002, '25'], [1, 82, 1920]), ('normal control', [8009, '29.97'], [5, 1, 1602])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"A deterministic bounded teaching model with a stipulated toy contract; it does not claim conformance to SMPTE or any broadcast standard. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-broadcast-timecode-arithmetic-audio-sample-cadence-frame-index","generated_at":"2026-09-29T14:49:37.334344+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Timecode arithmetic errors misplace edits, commercial breaks and captions against the broadcast clock.","repair":"Floor the sample position in frames.","root_cause":"The frame index is rounded to nearest instead of floored.","sha256":"a64e236d0c1bd4bdf65687731697ba2c6c2fb43f441cbe9f31decfa974c4cc6c","title":"Audio sample to frame cadence at 48 kHz: frame index · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.237,"exit_code":1,"observations":[{"actual":[1,-1,1602],"check":"regression: frame index","expected":[0,1601,1602],"passed":false},{"actual":[0,1602,2002],"check":"regression variant: frame index","expected":[0,1602,2002],"passed":true},{"actual":[3665,-1959,1602],"check":"partial repair probe: frame index","expected":[3663,1244,1602],"passed":false},{"actual":[5151,-1917,1602],"check":"partial repair variant: frame index","expected":[5149,1286,1601],"passed":false},{"actual":[1,0,1602],"check":"boundary control","expected":[1,0,1602],"passed":true},{"actual":[1,0,2002],"check":"boundary control","expected":[1,0,2002],"passed":true},{"actual":[2,0,1601],"check":"normal control","expected":[2,0,1601],"passed":true},{"actual":[1,317,1602],"check":"normal control","expected":[1,317,1602],"passed":true},{"actual":[1,320,1600],"check":"normal control","expected":[1,320,1600],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: frame index\", \"actual\": [1, -1, 1602], \"expected\": [0, 1601, 1602], \"passed\": false}, {\"check\": \"regression variant: frame index\", \"actual\": [0, 1602, 2002], \"expected\": [0, 1602, 2002], \"passed\": true}, {\"check\": \"partial repair probe: frame index\", \"actual\": [3665, -1959, 1602], \"expected\": [3663, 1244, 1602], \"passed\": false}, {\"check\": \"partial repair variant: frame index\", \"actual\": [5151, -1917, 1602], \"expected\": [5149, 1286, 1601], \"passed\": false}, {\"check\": \"boundary control\", \"actual\": [1, 0, 1602], \"expected\": [1, 0, 1602], \"passed\": true}, {\"check\": \"boundary control\", \"actual\": [1, 0, 2002], \"expected\": [1, 0, 2002], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [2, 0, 1601], \"expected\": [2, 0, 1601], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [1, 317, 1602], \"expected\": [1, 317, 1602], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [1, 320, 1600], \"expected\": [1, 320, 1600], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.437,"exit_code":1,"observations":[{"actual":[1,-1,1602],"check":"regression: frame index","expected":[0,1601,1602],"passed":false},{"actual":[1,-400,2002],"check":"regression variant: frame index","expected":[0,1602,2002],"passed":false},{"actual":[3664,-358,1601],"check":"partial repair probe: frame index","expected":[3663,1244,1602],"passed":false},{"actual":[5150,-315,1602],"check":"partial repair variant: frame index","expected":[5149,1286,1601],"passed":false},{"actual":[1,0,1602],"check":"boundary control","expected":[1,0,1602],"passed":true},{"actual":[1,0,2002],"check":"boundary control","expected":[1,0,2002],"passed":true},{"actual":[2,0,1601],"check":"normal control","expected":[2,0,1601],"passed":true},{"actual":[1,317,1602],"check":"normal control","expected":[1,317,1602],"passed":true},{"actual":[1,320,1600],"check":"normal control","expected":[1,320,1600],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: frame index\", \"actual\": [1, -1, 1602], \"expected\": [0, 1601, 1602], \"passed\": false}, {\"check\": \"regression variant: frame index\", \"actual\": [1, -400, 2002], \"expected\": [0, 1602, 2002], \"passed\": false}, {\"check\": \"partial repair probe: frame index\", \"actual\": [3664, -358, 1601], \"expected\": [3663, 1244, 1602], \"passed\": false}, {\"check\": \"partial repair variant: frame index\", \"actual\": [5150, -315, 1602], \"expected\": [5149, 1286, 1601], \"passed\": false}, {\"check\": \"boundary control\", \"actual\": [1, 0, 1602], \"expected\": [1, 0, 1602], \"passed\": true}, {\"check\": \"boundary control\", \"actual\": [1, 0, 2002], \"expected\": [1, 0, 2002], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [2, 0, 1601], \"expected\": [2, 0, 1601], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [1, 317, 1602], \"expected\": [1, 317, 1602], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [1, 320, 1600], \"expected\": [1, 320, 1600], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":38.615,"exit_code":0,"observations":[{"actual":[0,1601,1602],"check":"regression: frame index","expected":[0,1601,1602],"passed":true},{"actual":[0,1602,2002],"check":"regression variant: frame index","expected":[0,1602,2002],"passed":true},{"actual":[3663,1244,1602],"check":"partial repair probe: frame index","expected":[3663,1244,1602],"passed":true},{"actual":[5149,1286,1601],"check":"partial repair variant: frame index","expected":[5149,1286,1601],"passed":true},{"actual":[1,0,1602],"check":"boundary control","expected":[1,0,1602],"passed":true},{"actual":[1,0,2002],"check":"boundary control","expected":[1,0,2002],"passed":true},{"actual":[2,0,1601],"check":"normal control","expected":[2,0,1601],"passed":true},{"actual":[1,317,1602],"check":"normal control","expected":[1,317,1602],"passed":true},{"actual":[1,320,1600],"check":"normal control","expected":[1,320,1600],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: frame index\", \"actual\": [0, 1601, 1602], \"expected\": [0, 1601, 1602], \"passed\": true}, {\"check\": \"regression variant: frame index\", \"actual\": [0, 1602, 2002], \"expected\": [0, 1602, 2002], \"passed\": true}, {\"check\": \"partial repair probe: frame index\", \"actual\": [3663, 1244, 1602], \"expected\": [3663, 1244, 1602], \"passed\": true}, {\"check\": \"partial repair variant: frame index\", \"actual\": [5149, 1286, 1601], \"expected\": [5149, 1286, 1601], \"passed\": true}, {\"check\": \"boundary control\", \"actual\": [1, 0, 1602], \"expected\": [1, 0, 1602], \"passed\": true}, {\"check\": \"boundary control\", \"actual\": [1, 0, 2002], \"expected\": [1, 0, 2002], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [2, 0, 1601], \"expected\": [2, 0, 1601], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [1, 317, 1602], \"expected\": [1, 317, 1602], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [1, 320, 1600], \"expected\": [1, 320, 1600], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}