# madhesh666/voice_activation_systemm architecture

> Architecture diagram of the GitHub repository madhesh666/voice_activation_systemm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/madhesh666/voice_activation_systemm
- Repository: https://github.com/madhesh666/voice_activation_systemm

## Overview

This repository supports a keyword-activation model workflow: record positive examples, preprocess positive and negative audio, extract MFCC features, assemble labeled data, train a DS-CNN, then quantize and export it as a C array. The README gives no further product details, and no firmware or end-to-end inference implementation is shown in the sampled source; the graph therefore stops at model export and treats the audio/model test scripts as standalone utilities.

Main entry points: [`prepare_dataset.py`](https://github.com/madhesh666/voice_activation_systemm/blob/main/prepare_dataset.py) (Labeled dataset), [`train_dscnn.py`](https://github.com/madhesh666/voice_activation_systemm/blob/main/train_dscnn.py) (DS-CNN training), [`convert_int8.py`](https://github.com/madhesh666/voice_activation_systemm/blob/main/convert_int8.py) (INT8 conversion), [`X.npy`](https://github.com/madhesh666/voice_activation_systemm/blob/main/X.npy) (Features X)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Audio capture"]
  node_positive_capture["Positive capture"]
  node_positive_audio["Positive WAVs"]
  node_keyword_capture["Keyword recording<br/>[record_keyword.py]"]
  node_keyword_wav["Keyword WAV<br/>[keyword.wav]"]
end

subgraph group_features["Feature preparation"]
  node_positive_prep["Positive preprocessing"]
  node_negative_prep["Negative preprocessing"]
  node_positive_mfcc["Positive MFCCs<br/>[extract_mfcc.py]"]
  node_negative_mfcc["Negative MFCCs"]
  node_dataset["Labeled dataset<br/>[prepare_dataset.py]"]
  node_dataset_x["Features X<br/>[X.npy]"]
  node_dataset_y["Labels y<br/>[y.npy]"]
end

subgraph group_model["Model development"]
  node_training["DS-CNN training<br/>[train_dscnn.py]"]
  node_keras_model["Keras model<br/>[dscnn_model.keras]"]
end

subgraph group_export["Deployment export"]
  node_quantization["INT8 conversion<br/>[convert_int8.py]"]
  node_tflite_model["INT8 TFLite model"]
  node_c_array["C array export"]
  node_model_header["Embedded model header<br/>[dscnn_model_int8.h]"]
end

node_speaker(("Speaker"))
node_audio_test["Audio test utility<br/>[test_audio.py]"]
node_int8_test["INT8 test utility<br/>[test_int8_model.py]"]
node_mic_test["Microphone test<br/>[mic_test.py]"]

node_speaker -->|"speaks samples"| node_positive_capture
node_positive_capture -->|"writes WAVs"| node_positive_audio
node_speaker -->|"speaks keyword"| node_keyword_capture
node_keyword_capture -->|"writes WAV"| node_keyword_wav
node_positive_prep -->|"prepares input"| node_positive_mfcc
node_negative_prep -->|"prepares input"| node_negative_mfcc
node_positive_mfcc -->|"loads features"| node_dataset
node_negative_mfcc -->|"loads features"| node_dataset
node_dataset -->|"writes features"| node_dataset_x
node_dataset -->|"writes labels"| node_dataset_y
node_training -->|"loads features"| node_dataset_x
node_training -->|"loads labels"| node_dataset_y
node_training -->|"saves model"| node_keras_model
node_quantization -->|"loads model"| node_keras_model
node_quantization -->|"calibrates with"| node_dataset_x
node_quantization -->|"writes model"| node_tflite_model
node_c_array -->|"reads model"| node_tflite_model
node_c_array -->|"writes header"| node_model_header

click node_positive_capture "https://github.com/madhesh666/voice_activation_systemm/blob/main/collect_positive.py"
click node_keyword_capture "https://github.com/madhesh666/voice_activation_systemm/blob/main/record_keyword.py"
click node_keyword_wav "https://github.com/madhesh666/voice_activation_systemm/blob/main/keyword.wav"
click node_positive_prep "https://github.com/madhesh666/voice_activation_systemm/blob/main/preprocess_audio.py"
click node_negative_prep "https://github.com/madhesh666/voice_activation_systemm/blob/main/preprocess_negative.py"
click node_positive_mfcc "https://github.com/madhesh666/voice_activation_systemm/blob/main/extract_mfcc.py"
click node_negative_mfcc "https://github.com/madhesh666/voice_activation_systemm/blob/main/extract_mfcc_negative.py"
click node_dataset "https://github.com/madhesh666/voice_activation_systemm/blob/main/prepare_dataset.py"
click node_dataset_x "https://github.com/madhesh666/voice_activation_systemm/blob/main/X.npy"
click node_dataset_y "https://github.com/madhesh666/voice_activation_systemm/blob/main/y.npy"
click node_training "https://github.com/madhesh666/voice_activation_systemm/blob/main/train_dscnn.py"
click node_keras_model "https://github.com/madhesh666/voice_activation_systemm/blob/main/dscnn_model.keras"
click node_quantization "https://github.com/madhesh666/voice_activation_systemm/blob/main/convert_int8.py"
click node_tflite_model "https://github.com/madhesh666/voice_activation_systemm/blob/main/dscnn_model_int8.tflite"
click node_c_array "https://github.com/madhesh666/voice_activation_systemm/blob/main/model_to_c_array.py"
click node_model_header "https://github.com/madhesh666/voice_activation_systemm/blob/main/dscnn_model_int8.h"
click node_audio_test "https://github.com/madhesh666/voice_activation_systemm/blob/main/test_audio.py"
click node_int8_test "https://github.com/madhesh666/voice_activation_systemm/blob/main/test_int8_model.py"
click node_mic_test "https://github.com/madhesh666/voice_activation_systemm/blob/main/mic_test.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_positive_capture,node_positive_audio,node_keyword_capture,node_keyword_wav toneBlue
class node_positive_prep,node_negative_prep,node_positive_mfcc,node_negative_mfcc,node_dataset,node_dataset_x,node_dataset_y toneAmber
class node_training,node_keras_model toneMint
class node_quantization,node_tflite_model,node_c_array,node_model_header toneRose
class node_speaker toneIndigo
class node_audio_test,node_int8_test,node_mic_test toneTeal
```

## Components

### Audio capture

- [Positive capture](https://github.com/madhesh666/voice_activation_systemm/blob/main/collect_positive.py): `collect_positive.py`
- **Positive WAVs**
- [Keyword recording](https://github.com/madhesh666/voice_activation_systemm/blob/main/record_keyword.py): `record_keyword.py`
- [Keyword WAV](https://github.com/madhesh666/voice_activation_systemm/blob/main/keyword.wav): `keyword.wav`

### Feature preparation

- [Positive preprocessing](https://github.com/madhesh666/voice_activation_systemm/blob/main/preprocess_audio.py): `preprocess_audio.py`
- [Negative preprocessing](https://github.com/madhesh666/voice_activation_systemm/blob/main/preprocess_negative.py): `preprocess_negative.py`
- [Positive MFCCs](https://github.com/madhesh666/voice_activation_systemm/blob/main/extract_mfcc.py): `extract_mfcc.py`
- [Negative MFCCs](https://github.com/madhesh666/voice_activation_systemm/blob/main/extract_mfcc_negative.py): `extract_mfcc_negative.py`
- [Labeled dataset](https://github.com/madhesh666/voice_activation_systemm/blob/main/prepare_dataset.py): `prepare_dataset.py`
- [Features X](https://github.com/madhesh666/voice_activation_systemm/blob/main/X.npy): `X.npy`
- [Labels y](https://github.com/madhesh666/voice_activation_systemm/blob/main/y.npy): `y.npy`

### Model development

- [DS-CNN training](https://github.com/madhesh666/voice_activation_systemm/blob/main/train_dscnn.py): `train_dscnn.py`
- [Keras model](https://github.com/madhesh666/voice_activation_systemm/blob/main/dscnn_model.keras): `dscnn_model.keras`

### Deployment export

- [INT8 conversion](https://github.com/madhesh666/voice_activation_systemm/blob/main/convert_int8.py): `convert_int8.py`
- [INT8 TFLite model](https://github.com/madhesh666/voice_activation_systemm/blob/main/dscnn_model_int8.tflite): `dscnn_model_int8.tflite`
- [C array export](https://github.com/madhesh666/voice_activation_systemm/blob/main/model_to_c_array.py): `model_to_c_array.py`
- [Embedded model header](https://github.com/madhesh666/voice_activation_systemm/blob/main/dscnn_model_int8.h): `dscnn_model_int8.h`

### Other components

- **Speaker**
- [Audio test utility](https://github.com/madhesh666/voice_activation_systemm/blob/main/test_audio.py): `test_audio.py`
- [INT8 test utility](https://github.com/madhesh666/voice_activation_systemm/blob/main/test_int8_model.py): `test_int8_model.py`
- [Microphone test](https://github.com/madhesh666/voice_activation_systemm/blob/main/mic_test.py): `mic_test.py`

## Connections

- Speaker → Positive capture: speaks samples
- Positive capture → Positive WAVs: writes WAVs
- Speaker → Keyword recording: speaks keyword
- Keyword recording → Keyword WAV: writes WAV
- Positive preprocessing → Positive MFCCs: prepares input
- Negative preprocessing → Negative MFCCs: prepares input
- Positive MFCCs → Labeled dataset: loads features
- Negative MFCCs → Labeled dataset: loads features
- Labeled dataset → Features X: writes features
- Labeled dataset → Labels y: writes labels
- DS-CNN training → Features X: loads features
- DS-CNN training → Labels y: loads labels
- DS-CNN training → Keras model: saves model
- INT8 conversion → Keras model: loads model
- INT8 conversion → Features X: calibrates with
- INT8 conversion → INT8 TFLite model: writes model
- C array export → INT8 TFLite model: reads model
- C array export → Embedded model header: writes header
