Prompt file imported from kevinnz/SSTV-MEL (
.github/prompts/add-sstv-mode.prompt.md). Copyright stays with the author.
Add a New SSTV Mode
I want to add a new SSTV mode to SSTV-MEL. Guide me through the implementation step by step.
Steps
- Create the mode file in
Sources/SSTVCore/Modes/following the pattern inPD120Mode.swiftandPD180Mode.swift - Define all timing constants — use explicit named constants matching the published SSTV specification. Include inline comments referencing the spec.
- Implement the
SSTVModeprotocol — define image dimensions, line timing, frequency ranges, color encoding order, and VIS code - Register the mode in
SSTVModeSelection/ModeParameters.swiftwith its VIS code - Add the mode to the CLI — update the
SSTVModeenum inDecodeCommand.swiftso it's available via--mode - Create tests:
- Unit test for mode timing constants
- If a sample WAV is available, add a golden-file decode test using PSNR/SSIM comparison
- Update documentation — add the mode to README.md supported modes list
Key Rules
- Modes are stateless — they define timing and structure, not DSP
- All math uses normalized Double values (0.0–1.0)
- Use time-based decoding with fractional sample interpolation
- Do NOT hardcode sample counts
- Do NOT copy-paste from other modes — share common logic via
ModeTimings