CW Companion is a macOS application designed for Morse Code (CW) enthusiasts. It provides tools for both receiving (decoding) and transmitting (encoding) Morse code, featuring real-time system audio capture and advanced signal processing.
- Live Audio Capture: Utilizes ScreenCaptureKit to capture high-quality audio directly from specific active windows on your Mac. This allows you to decode CW from SDR software, web-based radios, or videos without using a microphone.
- Signal Processing Pipeline:
- Bandpass Filter: Implements a custom Digital Biquad Filter centered at 600Hz (Q=5.0). This pre-processing step attenuates background noise and isolates the CW signal for cleaner detection.
- Envelope Follower: Converts the filtered AC audio signal into a DC amplitude envelope with fast attack and calculated decay, enabling robust signal detection even with varying amplitudes.
- Adaptive Thresholding: Dynamically detects Signal ON/OFF states based on audio levels.
- Algorithmic Decoding:
- Uses a time-based state machine to interpret signal duration.
- Automatically distinguishes between Dots, Dashes, Intra-character gaps, Inter-character gaps, and Word spaces.
- Adaptive WPM: Capable of estimating the sender's speed (Words Per Minute) to adjust timing tolerances.
- File Input: Supports loading and decoding existing
.wavaudio files.
- Text-to-CW: Converts typed text into standard International Morse Code timing.
- Audio Synthesis: Generates clean 600Hz sine wave audio.
- Envelope Shaping: Applies a 5ms linear rise and fall time (ramp) to every key-down event. This essentially eliminates "key clicks" (spectral splatter) common in simple square-wave generators.
- WAV Export: Saves the generated Morse code audio to a broadcast-quality
.wavfile for sharing or practice.
-
Public SDR Integration: Connects to public KiwiSDR receivers (e.g., KPH San Francisco) to monitor radio bands without local hardware.
-
Locally Generated Waterfall:
- Metal-Accelerated: Uses Accelerate (vDSP) for high-performance FFT and Metal for GPU rendering, creating a smooth 60fps spectrogram.
- Passband Zoom: Automatically focuses on the active 0-3kHz audio band.
- Calibrated Visualization: High-contrast color mapping for easy signal spotting.
-
FT8 Decoder:
- Live Decoding: Integrated C-based FT8 decoding engine processes 15-second transmission cycles in real-time.
- Grid Extraction: Automatically parses Maidenhead Grid Locators (e.g., "PL02") from decoded messages.
-
Global Map Plotter:
- Live Visualization: Plots decoded stations on an interactive Apple Map using the extracted grid squares.
- Split-View Dashboard: Professional monitoring layout with Map on the left and Waterfall/Data on the right.
- Platform: macOS 12.3+ (Required for
ScreenCaptureKit). - Language: Swift 5.
- UI Framework: SwiftUI.
- Audio Engine:
AVFoundationfor low-level audio buffer manipulation/playback andScreenCaptureKitfor system audio streams. - DSP Engine: Apple
Accelerate(vDSP) for FFT calculations. - Rendering: Apple
Metalfor high-performance waterfall visualization. - Concurrency:
- Uses Swift structured concurrency (
async/await) for managing live stream sessions. - Utilizes
DispatchQueueandCombinepipelines to offload heavy DSP tasks.
- Uses Swift structured concurrency (
- Go to the Receive tab.
- Switch the input mode to Live Window.
- Select the target application (e.g., your SDR program or web browser) from the list.
- The app will immediately start capturing audio, filtering for 600Hz tones, and streaming decoded text to the window.
- Go to the Transmit tab.
- Enter your text message.
- Adjust the WPM (Speed) and Frequency if desired.
- Press Play to preview or Save WAV to export the audio file.
- Go to the Cloud tab.
- Select a receiver from the dropdown (e.g., "KPH San Francisco").
- Click Connect. The waterfall will begin scrolling.
- Wait for the 15-second FT8 cycle.
- Decoded messages will appear in the list, and pins will drop on the map corresponding to the transmitter's location.
- AudioProcessing.swift: core logic for DSP, including the
BiquadFilter,AudioModelstate management, and theprocessLiveBufferloop. - AudioCaptureManager.swift: Handles the
ScreenCaptureKitstream lifecycle and permission handling. - MorseDecoder.swift: Logic for translating time intervals into characters.
- FT8Engine.swift: Wrapper around the C-based FT8 library (
ft8_lib). - WaterfallRenderer.swift: Metal-based renderer for the audio spectrogram.
- MaidenheadLocator.swift: Utility to convert Grid Squares to Lat/Long coordinates.
