No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-04 21:13:25 +02:00
apps sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
.gitignore Open sourced project 2018-09-15 07:38:54 +02:00
color.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
color_test.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
decode.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
decode_test.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
encoder.go Open sourced project 2018-09-15 07:38:54 +02:00
encoder_test.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
go.mod sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
go.sum sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
LICENSE Open sourced project 2018-09-15 07:38:54 +02:00
martin.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
osc.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
pasokon.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
README.md sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
robot.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
scottie.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
wrasse.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
writer.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00
writer_test.go sophie rewrite and app addition 2026-11-04 21:13:25 +02:00

go SSTV

Encoding and decoding of images into/from audio using the Slow-Scan Television (SSTV) standard (supporting popular modes such as Martin, Robot, Scottie, Pasokon, and Wrasse), with live streaming decoding from rtl_tcp (RTL-SDR).

Encoding Usage

format := &audio.Format{
  SampleRate:  44100,
  NumChannels: 1,
}

tv := sstv.NewMartin(sstv.Martin1, format)

// Or for other modes:
// sstv.NewMartin(sstv.Martin2, format)
// sstv.NewRobot(sstv.Robot36, format)
// sstv.NewRobot(sstv.Robot72, format)
// sstv.NewScottie(sstv.Scottie1, format)
// sstv.NewScottie(sstv.Scottie2, format)
// sstv.NewScottie(sstv.ScottieDx, format)
// sstv.NewPasokon(sstv.Pasokon3, format)
// sstv.NewPasokon(sstv.Pasokon5, format)
// sstv.NewPasokon(sstv.Pasokon7, format)
// sstv.NewWrasse(sstv.WrasseSC2180, format)

buf := tv.Encode(img)

Decoding Usage

// 1. Decode a WAV file directly from disk:
img, modeName, err := sstv.DecodeWAVFile("capture.wav", "")

// 2. Decode an in-memory or streamed io.Reader:
img, modeName, err := sstv.DecodeWAV(reader, "")

// 3. Decode raw audio samples:
img, modeName, err := sstv.DecodeAudio(samples, sampleRate, "")

// 4. Real-time / streaming decoder with progressive scanline callback:
dec := sstv.NewDecoder(sampleRate, "", func(img *image.RGBA, mode string) {
    fmt.Printf("Completed image in mode %s!\n", mode)
})
dec.SetOnLine(func(line int, totalLines int, currentImg *image.RGBA) {
    fmt.Printf("Decoded scanline %d of %d\n", line, totalLines)
})
dec.WriteAudio(chunk)

Applications

1. sstv-cli (Command Line Encoder)

Encode local images into SSTV WAV audio files:

# Build CLI
$ go build -o sstv-cli/sstv-cli ./sstv-cli

# Generate a Robot 36 encoded audio file:
$ ./sstv-cli/sstv-cli -r36 input.png output.wav

# Generate a Martin 1 encoded audio file:
$ ./sstv-cli/sstv-cli -m1 input.png output.wav

# Generate a Scottie 1 encoded audio file:
$ ./sstv-cli/sstv-cli -s1 input.png output.wav

# Display all options:
$ ./sstv-cli/sstv-cli -help

2. sstv-ui (Desktop SDR Receiver & Decoder GUI)

A modern graphical desktop application powered by Fyne v2 that connects to an RTL-SDR via rtl_tcp (or opens local WAV files) with progressive real-time scanline decoding:

# Build GUI
$ go build -o sstv-ui/sstv-ui ./sstv-ui

# Launch GUI
$ ./sstv-ui/sstv-ui

Features:

  • RTL-TCP Streaming: Connects to any remote or local rtl_tcp server.
  • Demodulation: Real-time USB (analytic baseband) and NFM demodulation.
  • Direct Sampling: Supports Q-branch (mode 2) and I-branch (mode 1) for HF reception below 24 MHz (e.g. 5.900 MHz shortwave SSTV).
  • Frequency Presets: One-click tuning for ISS (145.800 MHz FM), 20m (14.230 MHz USB), 40m (7.171 MHz USB), 80m (3.845 MHz USB), and 49m Shortwave (5.900 MHz USB).
  • Progressive Line Rendering: Displays decoded scanlines in real time as they arrive over the air.
  • De-Dither Filter: Built-in multi-mode de-ditherer:
    • Smart De-Dither (Edge-Preserving): Smooths checkerboard, Bayer, and error-diffusion dot patterns into smooth continuous tones while preserving sharp outlines.
    • 3x3 Median Filter: Removes impulse clicks, salt-and-pepper RF static, and dropouts.
    • Hybrid Filter: Combines impulse de-speckling with adaptive dither blending.
  • Post-Processing & Enhancement:
    • Auto-Levels: Automatic contrast stretching to restore washed-out shortwave signals.
    • Slant Correction / Deskew: Fine slider and tilt buttons to correct transmitter/receiver clock drift in real time.
    • Brightness & Contrast: Interactive live tuning with instant GPU texture preview.
  • WAV Playback: Load and decode local WAV audio files with progressive rendering.
  • Export: Save enhanced or raw decoded images directly to PNG.
  • CLI Mode: Full headless support via ./sstv-ui -cli with -dedither, -autolevels, -slant, -brightness, and -contrast flags.

3. safebooru-tx (Automated Booru SSTV Broadcaster)

Automated continuous broadcaster daemon that queries Safebooru, downloads images, encodes them to SSTV audio, and transmits them using simtx-cli:

# Build broadcaster
$ go build -o safebooru-tx/safebooru-tx ./safebooru-tx

# Run default continuous broadcast ("paws furry" on 5.900 MHz Martin 2):
$ ./safebooru-tx/safebooru-tx

# Optional customization flags:
# -tags "paws furry"       Safebooru search tags
# -random                  Randomize image selection order (default: true)
# -mode m2                 SSTV mode (m1, m2, r36, r72, s1, s2, sdx, p3, p5, p7, wr180)
# -delay 5                 Seconds delay between transmissions
# -freq 5900000            SimTX frequency in Hz
# -station hf              SimTX station name
# -server-id argon         SimTX server ID
# -host argon.simtx.net    SimTX host
# -port 5556               SimTX port
# -mod USB                 Modulation
# -bw 3000                 Bandwidth in Hz
# -dry-run                 Test downloading & encoding to WAV without transmitting
# -once                    Process & transmit a single image then exit

Supported Modes

Mode VIS Code Resolution Color Space
Robot 36 0x08 (8) 320 × 240 YUV / YCbCr (4:2:0)
Robot 72 0x0C (12) 320 × 240 YUV / YCbCr (4:2:2)
Martin 1 0x2C (44) 320 × 256 G-B-R sequential
Martin 2 0x28 (40) 320 × 256 G-B-R sequential
Scottie 1 0x3C (60) 320 × 256 G-B-R sequential
Scottie 2 0x38 (56) 320 × 256 G-B-R sequential
Scottie DX 0x4C (76) 320 × 256 G-B-R sequential
Pasokon P3 0x71 (113) 640 × 496 R-G-B sequential
Pasokon P5 0x72 (114) 640 × 496 R-G-B sequential
Pasokon P7 0x73 (115) 640 × 496 R-G-B sequential
Wrasse SC2-180 0x37 (55) 320 × 256 R-G-B sequential

License

Copyright 2018 Johannes Donath <johannesd@torchmind.com>
and other copyright owners as documented in the project's IP log.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.