A machine learning-powered audio analysis system designed to detect chirp signals in acoustic environments. ChirpApp combines mobile data collection with advanced signal processing and ML models to classify audio as containing chirp signals or not.
ChirpApp addresses the problem of detecting ultrasonic chirp signals in noisy environments. The project uses a data-driven approach to:
- Collect audio samples via a mobile app
- Process signals with bandpass filtering and feature extraction
- Train multiple ML models to classify chirp presence
- Evaluate performance across different chirp period durations (1s, 2s, 4s)
- Select optimal parameters based on model prediction accuracy
The system is designed to be robust, generalizable, and suitable for deployment in real-world acoustic monitoring applications.
Contains the Android mobile application for recording and collecting audio samples.
Key Components:
src/main/— Source code for the Android appMainActivity.kt— Main application activity and UIui/theme/— Custom Material Design theme configuration
AndroidManifest.xml— App permissions and configurationsbuild.gradle.kts— Gradle build configurationres/— Resource files (layouts, strings, drawables, icons)
Purpose: Records audio clips in natural environments and labels them as positive (contains chirp) or negative (no chirp) for training data collection.
Core data analysis and model training pipeline.
Key Files:
The comprehensive analysis script that:
-
Loads & Cleans Audio
- Bandpass filters signals (17.5 kHz - 20.5 kHz)
- Converts
.wavand.pcmfiles - Normalizes amplitude
-
Segments Signals
- Divides long audio into fixed-duration chunks based on chirp period T
- Tests three periods: T ∈ {1s, 2s, 4s}
- Each segment becomes one training/test sample
-
Extracts Features (4 modalities)
- Statistical Features: Mean, std, max, min, power, zero-crossing rate
- Wavelet Features: Discrete wavelet coefficients (db4, level 4)
- MFCC (Mel-Frequency Cepstral Coefficients): 40 coefficients, 64 frames
- Spectrograms: Mel-spectrogram and STFT (64×64 normalized images)
-
Trains Models
- Classical ML (on statistical/wavelet features):
- Support Vector Machine (SVM)
- Random Forest (100 estimators)
- k-Nearest Neighbors (k=5)
- Deep Learning (on spectral features):
- Simple 2D CNN with Conv2D → MaxPool → Dense layers
- Trained separately on mel-spec, MFCC, wavelet scalogram, STFT
- Classical ML (on statistical/wavelet features):
-
Evaluates Performance
- Cross-validation: 5-fold stratified K-fold (or fewer with small datasets)
- Train/Test Split: 80% train, 20% test (when sample size permits)
- Metrics Recorded:
- Accuracy, Precision, Recall, F1-score
- Mean ± std for all metrics
-
Saves Results
- Outputs
model_results.csvwith comprehensive results:- T value, model type, feature modality, evaluation type
- Full performance metrics for every model×modality×T combination
- Outputs
raw_data/— Positive samples (contain chirp signals)negative_data/— Negative samples (no chirp signals)analyzed_data/— Output folder for processed results
numpy, pandas, librosa, PyWavelets, opencv-python, scipy, scikit-learn, tensorflow
- Python 3.10+
- Virtual environment (recommended)
# Clone the repository
git clone https://github.com/DaveTron4/ChirpApp.git
cd ChirpApp/analysis
# Create and activate virtual environment
python -m venv .venv
.\.venv\Scripts\activate # Windows
source .venv/bin/activate # macOS/Linux
# Install dependencies
pip install numpy pandas librosa PyWavelets opencv-python scipy scikit-learn tensorflowpython audio-filter.pyOutput:
- Console logs showing progress for each T value
model_results.csv— Full results table with all metrics
The pipeline tests three chirp periods and evaluates each model across all feature modalities.
- Accuracy: Overall correctness
- Precision: True positive rate among predicted positives
- Recall: Detection rate of actual positives
- F1-Score: Harmonic mean of precision & recall
- T=1s: Best results (23 samples) — Models typically achieve 95-100% accuracy
- T=2s: Good results (11 samples) — Models typically achieve 90-100% accuracy
- T=4s: Limited by data (5 samples) — Less reliable; ~58% accuracy
Based on results in model_results.csv, T=1s is recommended for production because:
- Most training samples
- Highest and most stable accuracy
- Best generalization to test data
- Consistent performance across all model types
Edit audio-filter.py constants to customize the pipeline:
SAMPLE_RATE = 44100 # Audio sample rate (Hz)
LOWCUT = 17500.0 # Bandpass filter lower cutoff (Hz)
HIGHCUT = 20500.0 # Bandpass filter upper cutoff (Hz)
FILTER_ORDER = 6 # Butterworth filter order
T_VALUES = [1, 2, 4] # Chirp periods to test (seconds)
LOAD_POSITIVE = True # Include positive samples
LOAD_NEGATIVE = True # Include negative samplesRaw Features → StandardScaler → SVM/RF/kNN → Predictions
Uses 5-fold stratified cross-validation for robust evaluation.
Input (64×64×1 image)
→ Conv2D(16, 3×3) + ReLU
→ MaxPooling2D(2×2)
→ Conv2D(32, 3×3) + ReLU
→ MaxPooling2D(2×2)
→ Flatten
→ Dense(64) + ReLU + Dropout(0.4)
→ Dense(1) + Sigmoid
Simple, lightweight design to avoid overfitting on small datasets.
model_results.csv contains:
| Column | Description |
|---|---|
T |
Chirp period (1, 2, or 4 seconds) |
model |
Model type (SVM, RF, kNN, CNN) |
modality |
Feature type (stat, wavelet, mel_spec, mfcc, wavelet_scalo, stft) |
eval_type |
Evaluation method (cross_validation or 80_20_split) |
accuracy_mean |
Mean accuracy score |
accuracy_std |
Standard deviation of accuracy |
precision_mean |
Mean precision |
recall_mean |
Mean recall |
f1_mean |
Mean F1-score |
- Check that
raw_data/andnegative_data/folders contain.wavor.pcmfiles - Ensure files are not corrupted
- Occurs when dataset is too small (T=4s with <5 samples)
- kNN in particular struggles with minimal data
- Recommendation: Collect more audio samples
- "oneDNN custom operations" and "function retracing" warnings are informational
- They don't affect results; suppress with
TF_ENABLE_ONEDNN_OPTS=0
- Add data augmentation techniques (time-stretch, pitch-shift)
- Implement ensemble methods combining multiple modalities
- Deploy optimal model to mobile app
- Support real-time inference on device
- Add confusion matrices and ROC curves to analysis
This project is part of Georgia State University coursework.
David (DaveTron4)
Last Updated: December 9, 2025