
For amateur radio operators and CW (Continuous Wave) enthusiasts, the bridge between modern software-defined radio (SDR) and traditional Morse code analysis has often been clumsy. Traditional decoders frequently rely on microphone input, introducing room reverb and background noise into the signal path. CW Companion is a specialized macOS utility designed to solve this by capturing pure digital audio directly from specific active windows using the internal screen capture engine.
This post explores the functional overview and the robust technical architecture behind CW Companion.
The application operates in two distinct primary modes: Receive (Rx) and Transmit (Tx).
The core objective of the Receive mode is to decode Morse code from external software sources, such as an SDR application or a web browser running a YouTube video, without external hardware.
.wav files. The application scans the file, estimates the sender’s speed (WPM), and provides a full text decode.CW Companion also functions as a broadcast-quality generator for training or content creation.
.wav file, making it suitable for video production or over-the-air transmission.The technical power of CW Companion relies on a strict linear DSP (Digital Signal Processing) pipeline built on Swift 5 and modern macOS frameworks.
Unlike legacy applications that tap into the microphone, CW Companion utilizes the ScreenCaptureKit framework (available on macOS 12.3+). The AudioCaptureManager requests an audio-only stream targeting a specific SCWindowID. This taps into the system audio buffer before it reaches the speakers, guaranteeing zero background noise such as typing sounds or room reverb.
Once the raw audio is captured, it passes through a custom processing chain defined in AudioProcessing.swift:
The boolean stream is fed into a streaming decoder that tracks state duration. It utilizes standard timing logic where a Dot is 1 unit, a Dash is 3 units, and a Word Space is 7 units. Crucially, the decoder features Adaptive WPM, allowing it to adjust its internal timing reference dynamically based on the speed of the incoming signal.
For transmission, the application generates a standard 600Hz sine wave. To prevent “Key Clicks” (harsh spectral splatter caused by instant on/off switching), the engine applies Envelope Shaping. A 5ms linear ramp is applied to the attack and release of every tone, resulting in a pleasing, bell-like quality.
AVAudioPCMBuffer) and ScreenCaptureKit.