A robust TypeScript library and CLI tool for decoding and encoding Slow Scan Television (SSTV) signals.
npm install sstv
Decode a WAV file containing an SSTV signal:
sstv -d input.wav -o output.png
Encode a PNG image into an SSTV audio signal:
sstv -e input.png -o output.wav
-d, --decode <file>: Input WAV file to decode.-e, --encode <file>: Input PNG file to encode.-o, --output <file>: Output file path (default: result.png or result.wav).-m, --mode <mode>: SSTV mode for encoding (default: "Martin 1").-s, --skip <seconds>: Skip the first N seconds of the audio file.--list-modes: List all supported modes.-h, --help: Show help message.import { readWav, SSTVDecoder } from 'sstv';
import * as fs from 'fs';
// Read WAV file
const { samples, sampleRate } = await readWav('input.wav');
// Create decoder
const decoder = new SSTVDecoder(samples, sampleRate);
// Decode
const png = decoder.decode();
// Save image
if (png) {
png.pack().pipe(fs.createWriteStream('output.png'));
}
import { SSTVEncoder, spec, writeWav } from 'sstv';
import { PNG } from 'pngjs';
import * as fs from 'fs';
// Load PNG
const png = PNG.sync.read(fs.readFileSync('input.png'));
// Create encoder
const encoder = new SSTVEncoder();
// Encode (Martin 1)
const samples = encoder.encode(png, spec.M1);
// Save WAV
await writeWav('output.wav', { samples, sampleRate: 48000 });
| Mode | Decode | Encode |
|---|---|---|
| Martin 1 | ✅ | ✅ |
| Martin 2 | ✅ | ❌ |
| Scottie 1 | ✅ | ❌ |
| Scottie 2 | ✅ | ❌ |
| Scottie DX | ✅ | ❌ |
| Robot 36 | ✅ | ❌ |
| Robot 72 | ✅ | ❌ |
MIT