Files
zefieandClaude Opus 5.5 4bc15bb585 NOAA APT decoder and encoder (browser, no build step)
Decoder: streaming APT.Decoder (coherent PLL or envelope demod, sync A+B
tracking loop with coasting and timing-jump re-lock), telemetry analysis,
Q-gated impulse (FM click) repair. GUI with fast / realtime decode,
Listen, live input, telemetry table, markers.

Encoder: APT.Encoder with test impairments (noise, clicks, clock offset,
fading, line-timing jump); encoder dialog that feeds the decoder.

Tools: offline decode/encode, quality survey, stub-DOM GUI smoke test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 20:58:22 -05:00

180 lines
7.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>NOAA APT Decoder / Encoder</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header id="toolbar">
<div class="group">
<span class="title">APT</span>
<label class="btn" title="Open a WAV (or any audio the browser can decode)">Open&hellip;
<input type="file" id="fileInput" accept="audio/*,.wav" hidden>
</label>
<span id="srcName" class="dim">no file</span>
<button id="btnEncoder" title="Make an APT signal from images or a test pattern">Encoder&hellip;</button>
</div>
<div class="group">
<button id="btnFast" disabled title="Decode the whole file as fast as possible">Fast decode</button>
<button id="btnRealtime" disabled title="Decode at playback speed">Realtime</button>
<select id="speed" title="Realtime speed">
<option value="1">1x</option><option value="2">2x</option>
<option value="4">4x</option><option value="8">8x</option>
</select>
<label class="chk" title="Play the audio while decoding in realtime / monitor live input"><input type="checkbox" id="listen" checked> Listen</label>
<input type="range" id="volume" min="0" max="1" step="0.01" value="0.5" title="Volume">
<button id="btnPause" disabled title="Pause / resume (space)">Pause</button>
<button id="btnStop" disabled>Stop</button>
</div>
<div class="group">
<button id="btnLive" title="Decode live audio input (SDR via line-in / virtual cable)">Live input</button>
<select id="device" title="Input device"><option value="">default input</option></select>
</div>
<div class="group">
<select id="view" title="View">
<option value="full">Full line</option>
<option value="AB">A + B images</option>
<option value="A">Channel A</option>
<option value="B">Channel B</option>
</select>
<select id="demod" title="Demodulator (applies to the next decode)">
<option value="coherent">Coherent</option>
<option value="envelope">Envelope</option>
</select>
<select id="repair" title="Impulse (click) repair: replaces only pixels that are clearly corrupted; the raw decode is kept">
<option value="off">Repair off</option>
<option value="normal" selected>Repair</option>
<option value="strong">Repair strong</option>
</select>
<label class="chk" title="Tint repaired pixels red (not saved)"><input type="checkbox" id="showRepairs"> show</label>
<select id="contrast" title="Levels">
<option value="telemetry">Telemetry levels</option>
<option value="auto">Auto contrast</option>
<option value="sync">Sync levels</option>
</select>
<select id="zoom" title="Zoom">
<option value="fit">Fit width</option>
<option value="1">1:1</option>
<option value="0.5">1:2</option>
</select>
<label class="chk"><input type="checkbox" id="follow" checked> Follow</label>
<button id="btnSave" disabled>Save PNG</button>
</div>
</header>
<div id="progress" title="Click to seek (realtime)"><div id="progressFill"></div><div id="progressPlay"></div></div>
<main>
<div id="viewport">
<div id="drop" class="hint">Drop an APT recording here, or use Open&hellip; / Live input</div>
<div id="stack">
<canvas id="image" width="2080" height="0"></canvas>
<canvas id="overlay" width="2080" height="0"></canvas>
</div>
</div>
<aside id="side">
<section>
<h2>Status</h2>
<table class="kv">
<tr><th>Mode</th><td id="stMode">idle</td></tr>
<tr><th>Input</th><td id="stRate">-</td></tr>
<tr><th>Position</th><td id="stPos">-</td></tr>
<tr><th>Lines</th><td id="stLines">0</td></tr>
<tr><th>Sync</th><td><span id="stLock" class="badge">-</span> <span id="stSync">-</span></td></tr>
<tr><th>Clock</th><td id="stClock">-</td></tr>
<tr><th>Repaired</th><td id="stRepair">-</td></tr>
</table>
</section>
<section>
<h2>Spectrum</h2>
<canvas id="spectrum" width="320" height="90"></canvas>
</section>
<section>
<h2>Last line</h2>
<canvas id="scope" width="320" height="80"></canvas>
</section>
<section>
<h2>Sync quality</h2>
<canvas id="synchist" width="320" height="40"></canvas>
</section>
<section>
<h2>Telemetry</h2>
<canvas id="wedges" width="320" height="70"></canvas>
<div id="frames" class="scroll"></div>
</section>
<section>
<h2>Cursor</h2>
<div id="cursor" class="mono dim">hover the image</div>
</section>
<section>
<h2>Markers <button id="btnCopyMarks" class="small" title="Copy marker list">copy</button> <button id="btnClearMarks" class="small">clear</button></h2>
<div id="markers" class="scroll mono"><span class="dim">click the image to mark a line</span></div>
</section>
</aside>
</main>
<dialog id="encDialog">
<form method="dialog" id="encForm">
<header class="dlg-head">
<span class="title">APT encoder</span>
<button value="close" class="small" title="Close">&times;</button>
</header>
<div class="enc-body">
<div class="enc-opts">
<fieldset>
<legend>Source</legend>
<label><input type="radio" name="encSrc" value="pattern" checked> Test pattern,
<input type="number" id="encLines" value="600" min="8" max="8000" step="1"> lines</label>
<label><input type="radio" name="encSrc" value="images"> Images for channels A and B</label>
<div class="sub">
<label>A <input type="file" id="encImgA" accept="image/*"></label>
<label>B <input type="file" id="encImgB" accept="image/*"> <span class="dim">(empty: same as A)</span></label>
<label class="chk"><input type="checkbox" id="encInvB"> invert B (IR: cold = white)</label>
</div>
<label><input type="radio" name="encSrc" value="frame"> Decoded APT image, full line (2080 wide)</label>
<div class="sub">
<input type="file" id="encFrame" accept="image/*">
<label class="chk"><input type="checkbox" id="encKeepTel" checked> keep its sync and telemetry</label>
</div>
</fieldset>
<fieldset>
<legend>Signal</legend>
<label>Channel A <select id="encChA"></select></label>
<label>Channel B <select id="encChB"></select></label>
<label>Sample rate <select id="encRate">
<option selected>11025</option><option>20800</option><option>44100</option><option>48000</option>
</select> Hz</label>
</fieldset>
<fieldset>
<legend>Impairments</legend>
<label class="chk"><input type="checkbox" id="encNoiseOn"> noise, SNR <input type="number" id="encSnr" value="12" step="1"> dB</label>
<label class="chk"><input type="checkbox" id="encClicksOn"> FM clicks <input type="number" id="encClicks" value="40" min="0" step="5"> /s</label>
<label>Clock offset <input type="number" id="encPpm" value="0" step="10"> ppm</label>
<label>Fading depth <input type="number" id="encFade" value="0" min="0" max="1" step="0.1"></label>
<label class="chk"><input type="checkbox" id="encJumpOn"> line-timing jump at line <input type="number" id="encJump" value="300" min="1" step="1"></label>
</fieldset>
</div>
<div class="enc-preview">
<canvas id="encCanvas" width="2080" height="1"></canvas>
<div id="encInfo" class="dim mono"></div>
<div id="encBar"><div id="encBarFill"></div></div>
</div>
</div>
<footer class="dlg-foot">
<button type="button" id="encDecode" title="Encode, load as the decoder input and fast decode">Encode &amp; decode</button>
<button type="button" id="encRealtime" title="Encode, load and decode in realtime (with Listen)">Encode &amp; decode realtime</button>
<button type="button" id="encSave">Download WAV</button>
</footer>
</form>
</dialog>
<script src="wav.js"></script>
<script src="apt.js"></script>
<script src="encoder.js"></script>
<script src="app.js"></script>
<script src="encoder-ui.js"></script>
</body>
</html>