# ezaldinwaez/audio-classifier architecture

> Architecture diagram of the GitHub repository ezaldinwaez/audio-classifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ezaldinwaez/audio-classifier
- Repository: https://github.com/ezaldinwaez/audio-classifier

## Overview

##### Project type and purpose
- This is a standalone desktop-based machine-learning application with two main flows:
- A training pipeline that extracts features from audio and trains an SVM model
- A GUI-based inference app (Tkinter+ttkbootstrap) for real-time letter classification
- Purpose: classify spoken Arabic letters from WAV recordings, either via file upload or live microphone input.

##### File structure
- Top-level scripts:
- predict_gui.py – launch the GUI, handle user actions (browse, record, play, predict)
- requirements.txt, .gitignore, README.md
- src/ directory:
- feature_extraction.py – load WAV files, record via sounddevice, extract MFCCs & spectral features (librosa)
- train_model.py – load extracted features, train an SVM (scikit-learn), serialize the model with joblib
- No separate “data” folder—assume raw audio lives externally or is captured at runtime.
- No server components, databases, or microservices: this is an all-in-one desktop app.

##### README for additional insights
- Training steps: run feature_extraction.py, then train_model.py
- Inference steps: launch predict_gui.py
- Dependencies hint at audio I/O (sounddevice, soundfile, pygame), feature extraction (librosa), ML (scikit-learn, numpy), UI (ttkbootstrap/Tkinter).
- No external APIs or cloud services involved.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Training Phase
    subgraph "Training Phase"
        A1["Raw Audio Input\n(WAV files)"]:::data
        A2["Feature Extraction Module"]:::computation
        A3["Model Training Pipeline"]:::computation
        A4["Model Artifact\n(SVM.joblib)"]:::storage
    end

    %% Inference Phase
    subgraph "Inference Phase"
        B1["GUI Application"]:::ui
        B2["Raw Audio Input\n(File/Browse or Mic)"]:::data
        B3["Feature Extraction Module"]:::computation
        B4["Inference Engine"]:::computation
        B5["Visualization & Playback"]:::ui
    end

    %% Connections - Training Flow
    A1 -->|"extract_features()"| A2
    A2 -->|"train()"| A3
    A3 -->|"serialize_model()"| A4

    %% Connections - Inference Flow
    B1 -->|"browse/record"| B2
    B2 -->|"extract_features()"| B3
    B3 -->|"load_model() & predict()"| B4
    B4 -->|"predicted_label & confidence"| B1
    B1 -->|"play()"| B5

    %% Click Events
    click A1 "https://github.com/ezaldinwaez/audio-classifier/blob/main/src/feature_extraction.py"
    click A2 "https://github.com/ezaldinwaez/audio-classifier/blob/main/src/feature_extraction.py"
    click A3 "https://github.com/ezaldinwaez/audio-classifier/blob/main/src/train_model.py"
    click B1 "https://github.com/ezaldinwaez/audio-classifier/blob/main/predict_gui.py"
    click B3 "https://github.com/ezaldinwaez/audio-classifier/blob/main/src/feature_extraction.py"
    click B4 "https://github.com/ezaldinwaez/audio-classifier/blob/main/predict_gui.py"
    click B5 "https://github.com/ezaldinwaez/audio-classifier/blob/main/predict_gui.py"

    %% Styles
    classDef data fill:#D0E7FF,stroke:#333,stroke-width:1px
    classDef computation fill:#DFFFD0,stroke:#333,stroke-width:1px
    classDef ui fill:#FFE7B5,stroke:#333,stroke-width:1px
    classDef storage fill:#E7D0FF,stroke:#333,stroke-width:1px
```
