JavaSSTV is a Java-based library and application for encoding images into SSTV (Slow Scan Television) audio signals. SSTV is a method used primarily by amateur radio operators to transmit and receive static images via radio. This implementation focuses on converting images into audio signals that can be transmitted over radio frequencies using the Scottie DX protocol. I'm doing this purely to practice my own skillset in applied scenarios, this is by no means "the correct way" to go about it I think.
The Sound class is the foundation of the audio generation system. It provides functionality to:
- Generate pure sine wave tones at specified frequencies
- Create FSK (Frequency Shift Keying) modulated signals
- Render audio data to buffers
- Play audio through the system's audio output
Two key classes handle SSTV encoding:
SSTVEncoder- Provides primitive SSTV encoding functionsSSTVImageEncoder- Implements a complete image-to-SSTV encoding system
For visual representation:
ImagePanel- Displays image data with customizable pixel sizePreviewPanel- Provides a scalable preview of images being processed
Custom color implementation with RGB components and conversion utilities.
Key Features:
- RGB color representation with bounds checking (0-255)
- Conversion to hexadecimal and decimal representations
- RGB to YCbCr color space conversion (important for SSTV encoding)
Methods:
getR(),getG(),getB()- Get individual color componentsgetHex()- Get color as hexadecimal stringgetDecimal()- Get color as decimal integertoYCbCr()- Convert to YCbCr color space
Core audio generation class for creating tones and signals.
Key Features:
- Static and variable frequency tone generation
- FSK (Frequency Shift Keying) signal generation
- Audio buffer management
- Direct audio output through system speakers
Methods:
playTone()- Play a sine wave toneplayFSK()- Play a frequency shift keyed signalplayScanLine()- Play a scan line with varying frequenciesrenderToBuffer()- Render a tone to a byte array bufferplayBuffer()- Play audio from a buffer
Constants:
SAMPLE_RATE- 44100 Hz (CD quality audio)
Utility class with basic SSTV encoding functions.
Methods:
playSyncPulse()- Play a sync pulse (1200 Hz)playPorch()- Play a porch signal (1500 Hz)playScanLine()- Play a scan line with specified frequenciesrgbToFrequency()- Convert RGB color component to corresponding SSTV frequency
Advanced encoder that converts image files to SSTV audio signals.
Key Features:
- Complete image-to-SSTV conversion
- Phase-continuous tone generation
- RGB color channel separation and encoding
- VIS (Vertical Interval Signaling) header generation
Methods:
encodeImage()- Convert an image file to SSTV audio and play itrenderLine()- Encode a single scan line from the imagerenderColor()- Encode a specific color component of a scan linerenderTone()- Generate a continuous tone with optional taperingrenderSweep()- Generate a frequency sweep for image datarenderFSK()- Generate FSK signals for control datarenderSilence()- Generate a silent period
UI component for displaying image data with customizable pixel size.
Key Features:
- Custom rendering of color matrix data
- Configurable pixel size for display
UI component for displaying image preview with scaling.
Key Features:
- Scalable image preview
- Individual pixel setting and rendering
- Access to underlying image data
Methods:
setPixel()- Set a specific pixel's colorresetImage()- Clear the image displaygetImage()- Get the underlying BufferedImage
- Sample Rate: 44100 Hz (CD quality)
- Bit Depth: 16-bit PCM
- Channels: Mono
- Encoding: Little-endian signed PCM
The encoder implements a typical SSTV protocol with:
- VIS header (8-bit code)
- Vertical sync pulses (1200 Hz)
- Horizontal sync pulses for each line
- Porch signals (1500 Hz)
- RGB color channel separation
- Frequency mapping: 1500-2300 Hz for brightness values
Phase continuity maintained across all tones Tapering (5ms windows) used to reduce audio artifacts Smooth transitions between frequencies during scan lines