Morse Code Recognition
Initial implementation. 5-neuron canonical circuit based on the Münster model.
- 5-neuron circuit (AN1, LN2, LN3, LN5, ON1)
- Basic Morse code encoding/decoding
- Criterion benchmarks (0.175 µs/step)
- 0 false positives during silence
Ultra-low-memory neuromorphic signal core for narrow-band, frequency-stable event triage. Hardwired core + optional STDP plasticity. Inspired by 200 million years of cricket evolution. Not a general-purpose AI classifier — targets the earlier layer in the measurement chain, before expensive analysers are dispatched.
Watch the 5-neuron Münster circuit process signals in real-time. ON1 fires only when it detects sustained 4500 Hz via delay-line coincidence detection.
Five neurons connected by six delay synapses. Inhibitory paths (red) suppress noise, the excitatory path (green) drives the output.
The hardwired core is built on four equations. Optional STDP plasticity enables online weight adaptation.
Frequency selectivity. w = 0.1 gives ±10% bandwidth. At 20% deviation, match < 0.02.
When resonating: amplitude grows proportionally to match strength, capped at 1.0.
Exponential moving average locks the neuron's phase to the input signal.
Output fires only when BOTH current and delayed amplitude exceed threshold. Prevents false positives.
CricketBrain is not a general-purpose AI classifier — it's an ultra-low-memory neuromorphic signal core for narrow-band, frequency-stable event detection. Numbers against classical DSP, TinyML (TensorFlow Lite Micro, Edge Impulse) and full deep learning, all from vendor docs or peer-reviewed papers. Not the same task across rows — read this as an operating-envelope comparison (RAM, power, latency, training-data requirement), not a shared-accuracy comparison.
| Property | CricketBrain | Classical DSP | TinyML (TFLite Micro / Edge Impulse) | Deep Learning (GPU / Jetson) |
|---|---|---|---|---|
| RAM | ~1 KB | < 5 KB | 10–100 KB | > 100 MB |
| Model / flash | ~20 KB | < 10 KB | 22–500 KB | 10 MB – 100 GB |
| Latency | 0.175 µs/step | 1–10 ms | 54–225 ms | 1–3000 ms |
| Active power | ~15 mW (STM32F0) | ~50 mW (M4) | 50–100 mW (M4F/M7) | 5–200 W |
| Average power @ 1 Hz decisions | < 1 µW compute | ~500 µW | 5–30 mW | ~500 mW – 200 W |
| Training data | Zero | Zero | 100–10 000 clips | 10 000 h – millions of samples |
| Runs on $2 STM32F0 | Yes | Yes | Tight | No |
| Runs on < 1 mW solar buoy | Yes | Yes | No | No |
| Complex spectrogram / multi-class (> 10) | No | No | Yes | Yes |
| Deterministic / explainable | Yes | Yes | Partial | No |
| Sources | this repo | DSP textbook | Edge Impulse docs · TFLite Micro | Hannun 2019 · Hakim 2023 |
Initial implementation. 5-neuron canonical circuit based on the Münster model.
Multi-frequency token vocabulary and parallel resonator banks.
Temporal pattern matching with confidence scoring and privacy mode.
Full workspace with cross-platform bindings, STDP plasticity, and research-grade benchmarks.
#![deny(unsafe_code)]Research prototypes built on CricketBrain. Each case includes benchmarks, source code, honest limitations and a validation-status badge. UC01 ships AAMI EC57:2012 inter-patient evaluation on the full MIT-BIH DS2 split (v0.6, 22 patients) with clinician rhythm-annotation ground truth: 78.4 % pooled accuracy, on par with a hand-coded band-gate rule. Other UCs remain synthetic-only.
Beat-rate regime flags only (bradycardic / normal / tachycardic / irregular). Triage, not diagnosis — not a substitute for clinical ECG.
4-channel ResonatorBank flags which BPFO / BPFI / BSF defect frequency is dominant. Triage, not metrology — not a substitute for SKF IMx. Real CWRU validation pending.
Flags frequency-stable events — fin-whale pulses, blue-whale A-calls, ship cavitation, humpback tonals. Triage, not species ID — not a substitute for PAMGuard. Real MARS validation pending.
Flags which harmonic-frequency band is dominant on PMU streams (50 / 100 / 150 / 200 Hz + Outage). Triage, not metrology — not a substitute for Class-A PQ analysers or PMUs. Real EPFL validation pending.
DDoS and C2 beaconing detection at line rate.
Pest detection via acoustic monitoring on coin-cell sensors.
All results measured in real-time on this codebase using internationally recognised methodologies. Fully reproducible with deterministic seeding.
CricketBrain vs Matched Filter, Goertzel (FFT), and IIR Bandpass under identical noise conditions. Source: examples/baselines.rs
| SNR (dB) | CricketBrain TPR | CricketBrain FPR | Matched Filter TPR | Goertzel TPR | IIR Bandpass FPR |
|---|---|---|---|---|---|
| −10 | 1.000 | 0.000 | 0.000 | 0.000 | 0.992 |
| −5 | 1.000 | 0.000 | 0.000 | 0.000 | 0.867 |
| 0 | 1.000 | 0.000 | 0.000 | 0.017 | 0.558 |
| +5 | 1.000 | 0.000 | 0.008 | 0.025 | 0.325 |
| +10 | 1.000 | 0.000 | 0.992 | 0.942 | 0.150 |
| +20 | 1.000 | 0.000 | 1.000 | 1.000 | 0.125 |
| +30 | 1.000 | 0.000 | 1.000 | 1.000 | 0.108 |
CricketBrain achieves TPR=1.0 / FPR=0.0 across all SNR levels. Matched Filter and Goertzel fail below +10 dB. IIR Bandpass has persistent false positives (FPR up to 99%).
Sensitivity index (Green & Swets, 1966). Target vs Silence: AUC = 1.000. Rating: EXCELLENT (near ceiling). 500+500 trials at 100 ms.
Minimum detectable gap (Plomp, 1964; Fitzgibbons & Wightman, 1982). Human MDG at 4 kHz: 2–3 ms. Cricket biology: ~5 ms.
Coefficient of variation over 1000 trials (Gerstner & Kistler, 2002). Deterministic: zero jitter. With noise (0.02): CV = 0.097, matching biological range.
Just Noticeable Difference (Levitt, 1971 staircase). Weber fraction: 1.96% (narrow-band). Human at 4 kHz: ~9 Hz (0.2%). Bandwidth-tunable.
Standard neuromorphic computing metric. CricketBrain runs on a general-purpose CPU — dedicated silicon (ASIC/FPGA) would yield dramatically higher SynOPS/W.
| System | SynOPS | Power | SynOPS/W | Bytes/Neuron |
|---|---|---|---|---|
| CricketBrain (5N) | 6.43e7 | ~15 W | 4.29e6 | 186 |
| CricketBrain (40kN) | 2.99e8 | ~15 W | 1.99e7 | 364 |
| TrueNorth (IBM) | 4.60e10 | 0.07 W | 6.58e11 | ~256 |
| Loihi (Intel) | 3.00e10 | 0.10 W | 3.00e11 | ~140 |
| SpiNNaker | 6.00e9 | 1.0 W | 6.00e9 | ~800 |
| GPU A100 | 3.12e14 | 400 W | 7.80e11 | ~4 |
Timesteps from signal onset to first ON1 spike at 4500 Hz. Wall-clock: 3.1 µs. Real-time factor: 2897x faster than real-time.
Steps per second (5-neuron canonical circuit). 0.175 µs per step on a single CPU thread. No GPU, no SIMD required.
Total RAM for 5-neuron circuit (186 bytes/neuron). Fits in L1 cache. 40k-neuron scale: 14.2 MB (364 bytes/neuron).
Inter-spike interval pattern on sustained 4500 Hz: ISI = 1.00 ms, CV = 0.000. Classification: CLOCK-LIKE (CV < 0.01).
Systematically disabling circuit components to measure individual contributions. Source: examples/ablation_study.rs
| Configuration | SNR 0 dB TPR | SNR 0 dB FPR | SNR +10 dB TPR | SNR +20 dB TPR |
|---|---|---|---|---|
| Full circuit (baseline) | 1.000 | 0.000 | 1.000 | 1.000 |
| Without LN2 (inh, 3 ms) | 1.000 | 0.000 | 1.000 | 1.000 |
| Without LN3 (exc, 2 ms) | 0.440 | 0.000 | 0.010 | 0.005 |
| Without LN5 (inh, 5 ms) | 1.000 | 0.000 | 1.000 | 1.000 |
| Without coincidence gate | 1.000 | 0.000 | 1.000 | 1.000 |
| Without delay lines (d=1) | 1.000 | 0.000 | 1.000 | 1.000 |
LN3 (excitatory path) is critical — removing it drops TPR to 44% at SNR 0 dB and near-zero at higher SNR. All other components show redundancy at these SNR levels but contribute at extreme conditions.
cargo run --release --example bench_sdt # Signal Detection Theory
cargo run --release --example bench_synops # SynOPS Efficiency
cargo run --release --example bench_jnd # Just Noticeable Difference
cargo run --release --example bench_gap # Gap Detection
cargo run --release --example bench_latency # Spike Latency & Precision
cargo run --release --example bench_patterns # Pattern Separation
cargo run --release --example baselines # vs Classical Detectors
cargo run --release --example ablation_study # Component Analysis
cargo run --release --example bench_stress # Adversarial Stress Test
Independent seeds, colored noise, in-band interferers, extended silence, and a simple-threshold baseline. Where does CricketBrain actually break? Source: benchmarks/stress_test_benchmark.rs
| Test | Conditions | TPR | FPR | Verdict |
|---|---|---|---|---|
| 10 independent RNG seeds | 5000+5000 trials, SNR 0 dB | 1.000 | 0.000 | Confirmed |
| AWGN (Gaussian jitter) | 500 trials, SNR −10 to +20 dB | 1.000 | 0.000 | Confirmed |
| Pink noise (1/f) | 500 trials, SNR 0 dB | 1.000 | 0.002 | 1 false positive |
| Extended silence (1000 steps) | 2000 trials | — | 0.000 | Zero false alarms |
| In-band 4400 Hz (−2.2%) | 500 noise-only trials | — | 0.790 | FAILS — 79% FPR |
| In-band 4300 Hz (−4.4%) | 500 noise-only trials | — | 0.586 | FAILS — 59% FPR |
| In-band 4050 Hz (−10%) | 500 noise-only trials | — | 0.044 | 4.4% FPR (boundary) |
| Simple threshold detector | SNR −10 dB | 1.000 | 1.000 | Trivially useless |
Honest disclosure: CricketBrain's Gaussian tuning (w=0.1, ±10% bandwidth) makes it excellent at rejecting off-frequency noise but vulnerable to sustained in-band interferers within ±5% of the eigenfrequency. This is consistent with biological cricket hearing — the circuit is tuned for a specific calling song, not general-purpose signal classification. The simple threshold detector proves the problem is NOT trivial — frequency selectivity is genuine and necessary.
All benchmarks are deterministic (seeded RNG), fully reproducible, and generate identical results across Linux, macOS, and Windows. References: Green & Swets (1966), Levitt (1971), Plomp (1964), Merolla (2014), Davies (2018), Gerstner & Kistler (2002), Yassa & Stark (2011).
# Clone and run
git clone https://github.com/BEKO2210/cricket-brain.git
cd cricket-brain
cargo run
# Full roundtrip demo
cargo run --example live_demo -- "HELLO WORLD"
# Sequence prediction
cargo run --example sequence_predict
# 40k neuron benchmark
cargo run --release --example scale_test
# Run all 122 tests
cargo test --workspace