Documentation
¶
Overview ¶
Package voice provides analog voice-privacy descramblers — the keyless / weak-key spectral schemes still found on RF voice channels. The core operation is full-band spectral inversion (the classic "frequency inverter" scrambler), which is its own inverse, so the same call both scrambles and descrambles.
Index ¶
- func BandEnergy(samples []float64, loFrac, hiFrac float64) float64
- func BandInvert(samples []float64, loFrac, hiFrac float64) []float64
- func DetectInversion(samples []float64, frameLen int) []bool
- func RollingAuto(samples []float64, frameLen int) ([]float64, []bool)
- func RollingInvert(samples []float64, frameLen int, splits []float64) []float64
- func SpectralInvert(samples []float64) []float64
- func SpectralInvertInt16(samples []int16) []int16
- func SplitBandInvert(samples []float64, split float64) []float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BandEnergy ¶
BandEnergy returns the energy of a real signal in the normalized frequency band [loFrac, hiFrac] of Nyquist (each in 0..1), via a direct DFT-bin sum. Useful for confirming an inversion moved energy from the low band to the high band (and for tests).
func BandInvert ¶
BandInvert spectrally inverts a single normalized band [loFrac,hiFrac] of Nyquist. BandInvert(s,0,1) is full-band inversion (cf. SpectralInvert).
func DetectInversion ¶
DetectInversion is a best-effort per-frame inversion detector for full-band rolling inverters: voiced speech concentrates energy in the lower half of the band, so a frame with more high-band than low-band energy is flagged as inverted. It is a heuristic sync aid, not exact recovery.
func RollingAuto ¶
RollingAuto detects full-band-inverted frames and undoes them, returning the descrambled signal and the per-frame flags it acted on.
func RollingInvert ¶
RollingInvert applies a per-frame split-band inversion: frame i is inverted with splits[i % len(splits)]. Re-applying the same schedule descrambles a rolling/hopping inverter whose schedule is known. A split of 1.0 is a full-band inversion of that frame.
func SpectralInvert ¶
SpectralInvert inverts the spectrum of a real signal by multiplying every other sample by -1 (mixing with a Nyquist-rate carrier). This maps frequency f to fs/2 − f, which is exactly the full-band "frequency inverter" analog scramble. Applying it twice returns the original signal.
func SpectralInvertInt16 ¶
SpectralInvertInt16 is SpectralInvert over 16-bit PCM, clamping on the rare overflow at full scale.
func SplitBandInvert ¶
SplitBandInvert inverts the low sub-band [0,split] and the high sub-band [split,1] independently — the classic split-band (variable-split) inverter. The two sub-bands are disjoint by construction, so it is its own inverse.
Types ¶
This section is empty.