# pranav6670/detection-classification-of-tabla-taals architecture

> Architecture diagram of the GitHub repository pranav6670/detection-classification-of-tabla-taals, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pranav6670/detection-classification-of-tabla-taals
- Repository: https://github.com/pranav6670/detection-classification-of-tabla-taals

## Overview

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`](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/main.py) (Live app), [`model.py`](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/model.py) (Train loop), [`predict.py`](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/predict.py) (Predict), [`clean`](https://github.com/pranav6670/detection-classification-of-tabla-taals/tree/master/clean) (Clean audio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data"]
  node_wavfiles[("Raw audio<br/>dataset")]
  node_clean[("Clean audio<br/>dataset")]
end

subgraph group_features["Features"]
  node_dataops["Preprocess<br/>audio prep<br/>[dataops.py]"]
  node_hprss["HPSS<br/>separation<br/>[hprss.py]"]
  node_vocalsep["Vocal sep<br/>separation<br/>[Vocalseparation.py]"]
  node_spectrograms["Spectrograms<br/>feature viz<br/>[spectograms.py]"]
  node_cfg["MFCC config<br/>[cfg.py]"]
end

subgraph group_train["Training"]
  node_model["Train loop<br/>training orchestrator<br/>[model.py]"]
  node_mycnn["CNN model<br/>network definition<br/>[myCNN.py]"]
  node_pickles[("Pickles<br/>artifacts")]
  node_models[("Models<br/>artifacts")]
end

subgraph group_infer["Inference"]
  node_predict["Predict<br/>batch inference<br/>[predict.py]"]
  node_testcsv["Test CSV<br/>input data<br/>[test.csv]"]
  node_predictcsv["Predict CSV<br/>output data<br/>[predict.csv]"]
end

subgraph group_live["Live App"]
  node_mainapp["Live app<br/>runtime UI<br/>[main.py]"]
  node_pnstream["Audio backend<br/>streaming backend<br/>[PNstreamsetup.py]"]
  node_audiobackend["Capture backend<br/>audio IO<br/>[audioBackend.py]"]
  node_recordaudio["Recorder<br/>audio IO<br/>[recordAudio.py]"]
  node_gui["Qt GUI<br/>PyQt5 UI<br/>[GUI.py]"]
  node_mainui["UI glue<br/>integration<br/>[mainui.py]"]
  node_liveplot["Live plots<br/>visualization<br/>[liveSpectogram.py]"]
end

node_wavfiles -->|"source audio"| node_dataops
node_dataops -->|"writes"| node_clean
node_clean -->|"training data"| node_model
node_cfg -->|"feature settings"| node_model
node_hprss -->|"analysis"| node_spectrograms
node_vocalsep -->|"analysis"| node_spectrograms
node_spectrograms -->|"features"| node_model
node_model -->|"builds"| node_mycnn
node_model -->|"serializes"| node_pickles
node_model -->|"exports"| node_models
node_models -->|"loads"| node_predict
node_testcsv -->|"input"| node_predict
node_predict -->|"outputs"| node_predictcsv
node_clean -->|"sample audio"| node_predict
node_mainapp -->|"stream audio"| node_pnstream
node_mainapp -->|"capture"| node_audiobackend
node_mainapp -->|"record"| node_recordaudio
node_mainapp -->|"ui"| node_gui
node_mainui -->|"wires"| node_gui
node_mainapp -->|"visualize"| node_liveplot
node_mainapp -->|"classify"| node_predict
node_mainapp -.->|"reuses corpus"| node_clean

click node_wavfiles "https://github.com/pranav6670/detection-classification-of-tabla-taals/tree/master/wavfiles"
click node_clean "https://github.com/pranav6670/detection-classification-of-tabla-taals/tree/master/clean"
click node_dataops "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/dataops.py"
click node_hprss "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/hprss.py"
click node_vocalsep "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/Vocalseparation.py"
click node_spectrograms "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/spectograms.py"
click node_cfg "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/cfg.py"
click node_model "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/model.py"
click node_mycnn "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/myCNN.py"
click node_predict "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/predict.py"
click node_testcsv "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/test.csv"
click node_predictcsv "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/predict.csv"
click node_mainapp "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/main.py"
click node_pnstream "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/PNstreamsetup.py"
click node_audiobackend "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/audioBackend.py"
click node_recordaudio "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/recordAudio.py"
click node_gui "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/GUI.py"
click node_mainui "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/mainui.py"
click node_liveplot "https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/liveSpectogram.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wavfiles,node_clean toneBlue
class node_dataops,node_hprss,node_vocalsep,node_spectrograms,node_cfg toneAmber
class node_model,node_mycnn,node_pickles,node_models toneMint
class node_predict,node_testcsv,node_predictcsv toneRose
class node_mainapp,node_pnstream,node_audiobackend,node_recordaudio,node_gui,node_mainui,node_liveplot toneIndigo
```

## Components

### Data

Raw and cleaned audio corpora used by the pipeline

- [Raw audio](https://github.com/pranav6670/detection-classification-of-tabla-taals/tree/master/wavfiles): dataset · Source tabla recordings used for preprocessing and training · `wavfiles`
- [Clean audio](https://github.com/pranav6670/detection-classification-of-tabla-taals/tree/master/clean): dataset · Preprocessed audio corpus consumed by training and prediction · `clean`

### Features

Signal processing and feature preparation

- [Preprocess](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/dataops.py): audio prep · Downsampling and envelope-based cleaning from raw recordings · `dataops.py`
- [HPSS](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/hprss.py): separation · Harmonic-percussive source separation helper · `hprss.py`
- [Vocal sep](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/Vocalseparation.py): separation · Vocal separation helper used in audio analysis · `Vocalseparation.py`
- [Spectrograms](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/spectograms.py): feature viz · Spectrogram generation for analysis and model input support · `spectograms.py`
- [MFCC config](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/cfg.py): config · Feature and MFCC-related configuration · `cfg.py`

### Training

Offline model building and artifact creation

- [Train loop](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/model.py): training orchestrator · Main offline training entry point for CNN or LSTM modes · `model.py`
- [CNN model](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/myCNN.py): network definition · Convolutional model implementation · `myCNN.py`
- **Pickles**: artifacts · Serialized dataset artifacts for reuse
- **Models**: artifacts · Trained model files such as conv.model and rec.model

### Inference

Batch prediction and evaluation inputs

- [Predict](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/predict.py): batch inference · Loads a trained model and classifies input samples · `predict.py`
- [Test CSV](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/test.csv): input data · Sample evaluation or batch-prediction input · `test.csv`
- [Predict CSV](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/predict.csv): output data · Batch prediction output or intermediate file · `predict.csv`

### Live App

Real-time capture, UI, and visualization

- [Live app](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/main.py): runtime UI · Real-time classification and visualization entry point · `main.py`
- [Audio backend](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/PNstreamsetup.py): streaming backend · Live audio and FFT stream setup · `PNstreamsetup.py`
- [Capture backend](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/audioBackend.py): audio IO · Audio streaming and backend support · `audioBackend.py`
- [Recorder](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/recordAudio.py): audio IO · Recording support for live input collection · `recordAudio.py`
- [Qt GUI](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/GUI.py): PyQt5 UI · Generated user interface layer · `GUI.py`
- [UI glue](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/mainui.py): integration · Application-specific UI wiring · `mainui.py`
- [Live plots](https://github.com/pranav6670/detection-classification-of-tabla-taals/blob/master/liveSpectogram.py): visualization · Waveform, FFT, and spectrogram visualizations · `liveSpectogram.py`

## Connections

- 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
