A Python library for extracting scanner radio tones from scanner audio.
Project description
icad_tone_detection
Detect Two-Tone (Quick Call), long tones, hi-low warble tones, MDC1200 / FleetSync and DTMF in scanner-audio recordings.
The heavy DSP is performed by an included native binary (icad_decode) while the Python layer handles audio I/O and STFT-based frequency extraction.
Features
- Single call
tone_detect()or the CLIicad-tone-detect. - Tone types: Two-Tone / Quick Call, long, warble, MDC1200 / FleetSync, DTMF.
- Flexible inputs: local path, URL,
bytes,BytesIO, or apydub.AudioSegment. - Automatic resample to 16 kHz mono PCM via FFmpeg.
- Tweakable: every threshold & filter exposed as a keyword arg / CLI flag.
- Binaries included
- Linux
x86-64,arm64,armv7 - macOS Intel & Apple Silicon
- Windows
x86-64
- Linux
Installation
pip install icad_tone_detection
Requires Python 3.9 + and FFmpeg in
PATH.
Quick start (Python)
from icad_tone_detection import tone_detect
result = tone_detect("my_scanner_recording.wav")
print(result.two_tone_result)
Quick start (CLI)
An executable icad-tone-detect is added to your $PATH:
# show help
icad-tone-detect --help
# analyse a file with MDC disabled
icad-tone-detect my.wav --detect_mdc false --debug
Boolean flags accept true/false • yes/no • 1/0.
Full CLI example
icad-tone-detect my_scanner_recording.wav \
--detect_mdc false --detect_dtmf true \
--time_resolution_ms 25 --tone_a_min_length 0.7 \
--tone_b_min_length 2.7 --long_tone_min_length 3.8 \
--debug
Typical output with debug ⇣
D############################################################
ICAD Tone Detection: DEBUG - v2.7.0
------------------------------------------------------------
Decode binary path: /…/bin/linux_arm64/icad_decode
Analyzing audio at: my_scanner_recording.wav
Matching Threshold: 2.5%
Time Resolution (ms): 25
… (trimmed) …
############################################################
------------------------------------------------------------
DETECTION SUMMARY
------------------------------------------------------------
Two-Tone (Quick Call): 1
Long Tones: 0
Hi-Low Warble: 0
MDC1200/FleetSync: 0 (disabled)
DTMF: 3
------------------------------------------------------------
{
"two_tone": [
{
"tone_a_freq": 473.2,
"tone_b_freq": 810.0,
"start": 1.23,
"end": 4.07
}
],
"long_tone": [],
"hi_low": [],
"mdc": [],
"dtmf": [
{ "digit": "5", "start": 7.01, "end": 7.08 },
{ "digit": "5", "start": 7.18, "end": 7.25 },
{ "digit": "9", "start": 7.35, "end": 7.42 }
]
}
tone_detect() signature (API users)
result = tone_detect(
audio_path="my.wav", # path / URL / BytesIO / AudioSegment
matching_threshold=2.5, # % tolerance for grouping freqs
time_resolution_ms=50, # STFT hop size in ms
tone_a_min_length=0.85, # sec – min A-tone for Quick Call
tone_b_min_length=2.6, # sec – min B-tone for Quick Call
hi_low_interval=0.2, # sec – max gap between warble tones
hi_low_min_alternations=6, # min hi/low swaps
long_tone_min_length=3.8, # sec – min duration for long tone
detect_mdc=True, # toggle MDC1200 / FleetSync
mdc_high_pass=200, # Hz – high-pass for MDC
mdc_low_pass=4000, # Hz – low-pass for MDC
detect_dtmf=True, # toggle DTMF decoding
debug=False # print extra diagnostics
) # -> ToneDetectionResult
See the doc-string for parameter details.
Supported platforms & binaries
| OS | Architectures | Folder inside wheel |
|---|---|---|
| Linux | x86-64, arm64, armv7 | linux_x86_64, linux_arm64, linux_armv7 |
| macOS | x86-64, arm64 | macos_x86_64, macos_arm64 |
| Windows | x86-64 | windows_x86_64 |
The loader sets execute permissions automatically on Unix-like systems.
On other CPUs you can compile your own binary and point the library to it via ICAD_DECODE_PATH.
Example audio
Sample WAV files live in examples/example_audio/ for quick testing.
Contributing
Issues and pull-requests are welcome — visit the GitHub repo.
License
MIT © TheGreatCodeholio • version 2.7.0 • Python 3.9 +
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file icad_tone_detection-2.7.0.tar.gz.
File metadata
- Download URL: icad_tone_detection-2.7.0.tar.gz
- Upload date:
- Size: 2.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ba13287d8ee83eee3dbf2d430c0e5a86e8d504d255d2c5f2e4b550da914d45
|
|
| MD5 |
85a19e69f2e9028a549e1d734142f140
|
|
| BLAKE2b-256 |
8b3f78e3a3c8896b6fd7cf90f386e0b7dc011423f1030095317b9057d6c8c447
|
Provenance
The following attestation bundles were made for icad_tone_detection-2.7.0.tar.gz:
Publisher:
python-package.yml on TheGreatCodeholio/icad_tone_detection
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
icad_tone_detection-2.7.0.tar.gz -
Subject digest:
02ba13287d8ee83eee3dbf2d430c0e5a86e8d504d255d2c5f2e4b550da914d45 - Sigstore transparency entry: 331918509
- Sigstore integration time:
-
Permalink:
TheGreatCodeholio/icad_tone_detection@d53dc6c16ded2dfc50bede9b627421538dccc4d4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/TheGreatCodeholio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@d53dc6c16ded2dfc50bede9b627421538dccc4d4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file icad_tone_detection-2.7.0-py3-none-any.whl.
File metadata
- Download URL: icad_tone_detection-2.7.0-py3-none-any.whl
- Upload date:
- Size: 2.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9611e849a78f1382a3f7e85329dbd1ca1d1c4184ad76d0aae790d210422e5423
|
|
| MD5 |
a260586ac681efcdd05fa6494012527a
|
|
| BLAKE2b-256 |
a4a27cdad0ea4288776fb3912adadcf03a9cb19f33ac9b213d200fd80dcb9d5e
|
Provenance
The following attestation bundles were made for icad_tone_detection-2.7.0-py3-none-any.whl:
Publisher:
python-package.yml on TheGreatCodeholio/icad_tone_detection
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
icad_tone_detection-2.7.0-py3-none-any.whl -
Subject digest:
9611e849a78f1382a3f7e85329dbd1ca1d1c4184ad76d0aae790d210422e5423 - Sigstore transparency entry: 331918524
- Sigstore integration time:
-
Permalink:
TheGreatCodeholio/icad_tone_detection@d53dc6c16ded2dfc50bede9b627421538dccc4d4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/TheGreatCodeholio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@d53dc6c16ded2dfc50bede9b627421538dccc4d4 -
Trigger Event:
push
-
Statement type: