How pranav6670/detection-classification-of-tabla-taals works
This repository is a Python-based audio ML system for detecting and classifying Indian tabla talas from recorded music. The architecture is centered on an offline training pipeline plus a separate real-time inference/visualization app.
1. Core problem domain
The system classifies tabla rhythm patterns into tala classes. The README indicates 10 tala classes, with the dataset stored as many .wav recordings under wavfiles/ and a larger preprocessed corpus under clean/.
2. Data layer
Raw audio lives in wavfiles/; derived/cleaned audio is kept in clean/. These folders are not just assets but part of the pipeline: the project expects preprocessing to transform source recordings into normalized, denoised clips before training or prediction.
3. Preprocessing subsystem
dataops.py is the main data preparation step. The README says it performs downsampling from 44.1 kHz to 16 kHz and applies noise-threshold cleaning using envelope detection. This is the boundary between raw recordings and feature/model inputs.
4. Feature extraction and signal processing
Several modules support audio analysis: hprss.py for harmonic-percussive source separation, Vocalseparation.py for vocal separation, spectograms.py for spectrogram generation, and cfg.py for MFCC-related configuration. These scripts are the signal-processing layer feeding the ML models.
5. Training subsystem
model.py is the main training entry point. It builds the model, creates pickles for faster reuse, and trains either a CNN or an LSTM depending on config.mode. The README mentions myCNN.py as the CNN implementation, so model definitions are split from orchestration.
6. Model artifacts
Trained models are written outside the source tree into models/ (for example conv.model and rec.model), while precomputed dataset artifacts are saved into pickles/. This creates a clear separation between code, training data, and generated artifacts.
7. Inference subsystem
predict.py loads a trained model and runs classification on a sample or CSV-driven input. test.csv and predict.csv appear to be sample input/output files used during evaluation or batch prediction.
8. Real-time application
main.py is the runtime app for live classification and visualization. It ties together audio capture, FFT/time-domain displays, spectrograms, and prediction, so it is the main interactive boundary with the user.
9. Audio capture and live backend
PNstreamsetup.py provides the audio backend for live audio and FFT, while audioBackend.py and recordAudio.py support audio streaming/recording. These modules are the ingestion path for microphone or live input into the runtime app.
10. GUI layer
The UI is built with PyQt5. GUI.py is generated from Qt Designer, with main_1.ui and test.qrc as design/resource sources. mainui.py, guiGO.py, and auvdiovis_Qt.py appear to be glue or experiment files around the GUI/runtime integration.
11. Visualization subsystem
liveSpectogram.py, audiovis_test1.py, and related modules implement plots for raw waveform, FFT, spectrogram, and HPSS-based views. The README explicitly shows these as part of the user-facing live analysis experience.
12. End-to-end data flow
The typical flow is: raw .wav data in wavfiles/ → preprocessing/cleaning in dataops.py → feature extraction/configuration via cfg.py and signal-processing helpers → pickled training data and trained models in pickles/ and models/ → offline prediction via predict.py or live classification via main.py with the PyQt GUI and audio backend.
13. Repo structure implication
This is not a service-oriented or web architecture; it is a desktop/audio-ML application with a strong offline training pipeline and a separate real-time visualization/classification path. The main diagram boundaries should be drawn around data preparation, model training, inference, and live UI/audio capture.
Main entry points: main.py Live app · model.py Train loop · predict.py Predict · clean Clean audio
Components 21
Data
Raw and cleaned audio corpora used by the pipeline
- Raw audio · Source tabla recordings used for preprocessing and training
wavfiles - Clean audio · Preprocessed audio corpus consumed by training and prediction
clean
Features
Signal processing and feature preparation
- Preprocess · Downsampling and envelope-based cleaning from raw recordings
dataops.py - HPSS · Harmonic-percussive source separation helper
hprss.py - Vocal sep · Vocal separation helper used in audio analysis
Vocalseparation.py - Spectrograms · Spectrogram generation for analysis and model input support
spectograms.py - MFCC config · Feature and MFCC-related configuration
cfg.py
Training
Offline model building and artifact creation
- Train loop · Main offline training entry point for CNN or LSTM modes
model.py - CNN model · Convolutional model implementation
myCNN.py - Pickles · Serialized dataset artifacts for reuse
- Models · Trained model files such as conv.model and rec.model
Inference
Batch prediction and evaluation inputs
- Predict · Loads a trained model and classifies input samples
predict.py - Test CSV · Sample evaluation or batch-prediction input
test.csv - Predict CSV · Batch prediction output or intermediate file
predict.csv
Live App
Real-time capture, UI, and visualization
- Live app · Real-time classification and visualization entry point
main.py - Audio backend · Live audio and FFT stream setup
PNstreamsetup.py - Capture backend · Audio streaming and backend support
audioBackend.py - Recorder · Recording support for live input collection
recordAudio.py - Qt GUI · Generated user interface layer
GUI.py - UI glue · Application-specific UI wiring
mainui.py - Live plots · Waveform, FFT, and spectrogram visualizations
liveSpectogram.py
Connections 22
- Raw audio → Preprocess: source audio · Raw recordings are cleaned and normalized
- Preprocess → Clean audio: writes · Preprocessing produces the cleaned audio corpus
- Clean audio → Train loop: training data · Training consumes cleaned recordings
- MFCC config → Train loop: feature settings · MFCC and feature settings steer training
- HPSS → Spectrograms: analysis · Separation helpers support signal analysis
- Vocal sep → Spectrograms: analysis · Separation helpers support signal analysis
- Spectrograms → Train loop: features · Feature generation feeds model training
- Train loop → CNN model: builds · Training orchestrator uses the CNN implementation
- Train loop → Pickles: serializes · Precomputed artifacts are stored for reuse
- Train loop → Models: exports · Trained weights are written as model files
- Models → Predict: loads · Inference reads trained models
- Test CSV → Predict: input · Batch inputs can be driven from CSV
- Predict → Predict CSV: outputs · Predictions can be written for later use
- Clean audio → Predict: sample audio · Prediction can run on cleaned clips
- Live app → Audio backend: stream audio · Live app relies on the stream backend
- Live app → Capture backend: capture · Runtime app uses audio I/O helpers
- Live app → Recorder: record · Live app can record input for analysis
- Live app → Qt GUI: ui · The interactive app is presented through the Qt UI
- UI glue → Qt GUI: wires · Glue code connects generated UI to the app
- Live app → Live plots: visualize · Live classification includes waveform and spectrum views
- Live app → Predict: classify · Live app invokes prediction on incoming audio
- Live app → Clean audio: reuses corpus · The runtime shares the same cleaned audio conventions