-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Peter Monta
committed
Jan 14, 2023
0 parents
commit f3730e5
Showing
12 changed files
with
210,215 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
download: | ||
wget http://www.pmonta.com/data/cd/cd-stitched.png | ||
|
||
process: | ||
python track.py | ||
python resample.py <waveform.dat >channel-symbols.dat | ||
python nrzi.py <channel-symbols.dat >channel-bits.dat | ||
python efm-decode.py <channel-bits.dat >frames.dat | ||
python c1-decode.py <frames.dat >c1-codewords.dat | ||
|
||
clean: | ||
rm -f waveform.dat channel-symbols.dat channel-bits.dat frames.dat c1-codewords.dat | ||
rm -f *~ | ||
rm -rf __pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | ||
01 a7 fc 8b f9 f2 ff 9c 05 3f fe 4c b0 77 d7 e7 ff ae fb c6 03 62 03 db fb c8 04 ff 39 0d bc 53 | ||
fe a1 fe b9 fc c1 00 be 01 ea 03 d3 67 7d 2f 56 01 78 f6 67 01 91 03 41 fa 7c 09 93 98 c4 16 af | ||
ff 4b 00 a1 fd 45 00 db 00 03 05 c7 81 10 c2 4e 01 64 f8 f8 02 4f 02 f8 f9 ff 05 67 75 88 49 a8 | ||
00 b8 02 95 fe c3 fe 28 ff b6 02 f9 8e 9e 3c af 01 61 f9 4b ff 26 05 6c f6 4f 03 8f 09 d5 1a 64 | ||
fa f1 04 d2 fd f5 fc f2 fd 4f 04 47 07 a7 db 9f 02 48 f5 30 ff 0f 02 65 f4 3e 03 93 b2 09 f0 c7 | ||
fb 06 03 15 fd 43 ff c5 fe 59 05 af 57 85 8d b1 06 8a f6 bd fc 17 ff 23 f9 b1 04 46 77 9b 66 fc | ||
fc 6f 03 58 fb a8 02 cc ff ac 04 51 a3 8d b9 3a 06 e5 fa df fc ca 00 37 ff 2c fe 83 70 0d 1e f4 | ||
fc 27 04 c7 fc 7f fe c7 00 8e 06 85 4b 0a 8b 65 03 cd fc 04 fa 10 03 e4 00 76 fa 74 0d dc a6 b4 | ||
fb 55 00 fb fd 7a f8 94 ff d6 04 80 a7 10 b5 86 00 cb fe da f9 81 00 bc 04 4e fb 50 76 11 f9 c3 | ||
fa 52 fd cc fe 3b f9 34 01 e9 01 04 b6 5b eb 93 ff a2 02 a2 f7 4b 01 2b 02 1c f9 73 c6 43 37 a4 | ||
fb d4 ff dd 01 b9 fc 02 00 d9 00 1d 64 b4 65 3b fd 8f 01 63 f9 d3 00 90 03 1b f8 2a 68 13 f0 ea | ||
f8 65 fd 36 03 dd ff fb fc 5f fe b9 ae 5a 39 30 00 4a 01 ea f7 aa 01 25 05 7a f5 60 70 0b bf 63 | ||
fa ce f8 38 04 57 00 bc fd 1f fe 1c e6 c2 44 9a fd 94 03 ce f4 8b fe 53 01 d4 f4 d4 a0 5a f0 68 | ||
fb 1b fc cd 03 9c 00 53 ff fe ff 36 48 45 ef 83 ff ca 07 cf f8 1e 00 cb ff 0f fb fa 7c ac 0d 48 | ||
fd e1 fc 08 04 62 00 c9 02 39 ff cd bd 01 25 a7 00 4f 04 8f fa 2c fd c6 02 b0 00 1c 75 6a 02 ea | ||
f7 f9 fc 99 03 fb ff 2e fb e2 00 26 e0 39 e5 6a ff 4a 02 ae fe b8 f9 9f 02 be 01 88 83 df 7e 05 | ||
0b 64 fa 66 ff f6 01 ad f7 c0 fe 74 80 6e a6 fb 02 ee 00 77 ff a2 fb 25 01 67 04 6a 00 a7 f2 1d | ||
f5 80 f9 57 fd 91 01 cd fa 06 01 4a 00 9a 5c cf 03 80 fe f1 02 fd fa 41 01 64 01 db ab 78 de bf | ||
fc 9c fa 74 fe ae ff 23 fc cf ff be 93 14 af 79 04 dc fe c6 01 2f fa 7d 01 12 05 14 0e ab 87 28 | ||
f7 fa f9 82 fc 1a 03 c7 ff f4 fc 63 f3 76 35 1a 08 e6 00 5a 02 62 f8 95 ff 78 04 cf 9e 2b dc f6 | ||
fc fd fa b3 fa 03 05 53 00 8b ff f5 0a bd d7 10 05 01 fe c7 04 9b f8 5d ff 14 00 a9 66 9d 25 8d | ||
fb ec f8 7d fd b8 03 8c 00 ac ff e0 99 6e 85 be 00 41 00 fd 07 7b f4 a7 ff 2d ff a3 90 01 ce 65 | ||
00 57 fe 61 fc 7d 01 d2 ff bc 01 9e 7d bc 3b 61 ff 0d 00 7c 03 e9 f9 39 fd eb 02 23 22 4a df f9 | ||
00 aa 00 07 fc 31 02 a2 00 ab fa 2b a4 9a 71 03 04 65 00 29 00 27 fd 76 f8 70 01 53 b5 d3 15 bb | ||
02 04 03 fc f9 41 ff ea 01 dd f7 0e 86 06 30 30 05 63 02 ae 00 a7 fe ed fc 03 01 0e 3b fb f7 48 | ||
fe f3 f3 11 fa 00 fe 59 00 83 fc f5 3e 58 78 d8 04 4c 02 05 fd d0 ff e5 f9 04 00 d2 69 d7 f3 e4 | ||
00 4c f8 a1 f7 34 ff 27 00 82 fd 87 d8 52 76 47 06 fa 06 a0 ff eb 02 57 f9 30 02 cf 43 6e 50 2f | ||
03 5f ff 20 f8 df ff 82 05 76 00 17 f8 bd c0 bd 06 9b 07 87 fe f5 01 65 f9 8b fe 24 65 58 5e 3c | ||
fb 4e f5 3c fc e9 fa 7c 05 66 00 c3 e6 ae dd 1c 07 be 03 db ff 59 02 7c f7 87 00 f3 37 b8 4a 39 | ||
00 4a fe 01 fa b4 fa 2c 01 b4 00 36 92 44 f3 12 07 b1 fe ae 00 98 03 de f4 d7 fd 1d 31 0e 0d cb | ||
fd 4a fe 32 fa a5 fc 26 02 93 ff 8b 26 f3 97 66 06 46 02 0c 00 b4 03 e3 fa 70 fb 9a 8e 97 a8 7f | ||
00 78 02 ef 0a ba fa 80 01 1d 01 49 93 fd bc 79 03 b0 05 f3 01 fd 01 37 ff 44 f9 3e e2 3b ac 26 | ||
ff e2 01 9e fa 42 f6 4e ff 49 01 e1 d5 75 b3 c5 01 25 05 9b 03 8a fd df fc dc fb 22 cd 13 3f 0b | ||
01 90 01 ee f7 0f f7 13 fd af ff 4c e4 ad 56 0b 00 08 05 ef 02 b0 ff 8f 02 f5 f9 f0 be de 04 2d | ||
fd a6 00 bc f3 2a f9 a7 fe 28 01 56 2f 58 10 51 fc 03 06 9d 07 26 01 2e 01 f7 f8 8d 6d 6a b1 88 | ||
01 fa 01 6a 00 a9 f6 86 fc 02 06 16 15 5c 59 dc fd d6 07 2f 06 72 02 24 01 72 f9 d1 04 be d2 09 | ||
08 0f fa 66 f7 a8 fb ba f7 4c 04 f5 69 24 47 23 ff ff 07 f9 02 a2 01 08 02 66 f6 df 23 23 2e d2 | ||
0e 64 02 ae fe 6d fe 0a fc 95 01 b3 94 7d e9 a3 fd 18 06 1a fe d4 02 6d 04 d7 f6 e9 5d d9 ed c0 | ||
10 74 fd 79 ff d0 03 30 fb 7f 02 d3 40 7b 63 a2 fc cf 05 38 04 c8 07 4f 02 9f fb 25 e7 1f 88 ea | ||
10 06 ff 94 04 fb fc e7 f9 f0 ff 1c e1 56 a2 96 fe 73 02 6e 05 fb 06 b9 ff 46 00 50 f6 0d cf 8d | ||
15 4c ff 6d fd c8 12 0a f6 92 ff 97 d6 80 15 85 fd 33 01 f2 05 01 06 d9 fe cb fc 38 5b 36 71 27 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import sys | ||
from reedsolo import RSCodec | ||
|
||
def parse(t): | ||
t = t.split() | ||
f = bytearray(32) | ||
fe = bytearray(32) | ||
for i in range(32): | ||
if t[i+1]=='--': | ||
f[i] = 0 | ||
fe[i] = 1 | ||
else: | ||
f[i] = int(t[i+1],16) | ||
fe[i] = 0 | ||
if i in [12,13,14,15,28,29,30,31]: | ||
f[i] = 255 - f[i] | ||
return f,fe | ||
|
||
class delay1(): | ||
def __init__(self): | ||
self.f0 = bytearray(32) | ||
self.f0e = bytearray(32) | ||
def delay(self, f, fe): | ||
r = bytearray(32) | ||
re = bytearray(32) | ||
r[0::2] = f[0::2] | ||
r[1::2] = self.f0[1::2] | ||
re[0::2] = fe[0::2] | ||
re[1::2] = self.f0e[1::2] | ||
for i in range(32): | ||
self.f0[i] = f[i] | ||
self.f0e[i] = fe[i] | ||
return r,re | ||
|
||
rsc = RSCodec(4) | ||
d = delay1() | ||
frame = 0 | ||
|
||
for t in sys.stdin.readlines(): | ||
f,e = parse(t) | ||
f,e = d.delay(f,e) | ||
try: | ||
dec0,dec1,epos = rsc.decode(f,erase_pos=[i for i in range(28) if e[i]]) | ||
for i in range(32): | ||
b = dec1[i] | ||
print("%02x "%b,end='') | ||
if i==11 or i==15 or i==27: | ||
print(" ",end='') | ||
print() | ||
except: | ||
for i in range(32): | ||
print("-- ",end='') | ||
if i==11 or i==15 or i==27: | ||
print(" ",end='') | ||
print() | ||
frame += 1 |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import numpy as np | ||
import sys | ||
import efm | ||
|
||
def decode_cd(s): | ||
if s in efm.efm_decode_table: | ||
return "%02x"%efm.efm_decode_table[s] | ||
elif s=='00100000000001': | ||
return "s0" | ||
elif s=='00000000010010': | ||
return "s1" | ||
else: | ||
return "--" | ||
|
||
def decode(s): | ||
if s in efm.efm_decode_table: | ||
return efm.efm_decode_table[s] | ||
else: | ||
return 0 | ||
|
||
while True: | ||
s = sys.stdin.read(588) | ||
if len(s)!=588: | ||
break | ||
if s[0:24]!='100000000001000000000010': | ||
print("bad sync") | ||
sys.exit() | ||
for i in range(33): | ||
b14 = s[24+3+17*i:24+3+17*i+14] | ||
b = decode_cd(b14) | ||
print("%s "%b,end='') | ||
if i==0 or i==12 or i==16 or i==28: | ||
print(" ",end='') | ||
print() |
Oops, something went wrong.