# adityabala30/esp32-edgeai-sound-classifier architecture

> Architecture diagram of the GitHub repository adityabala30/esp32-edgeai-sound-classifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adityabala30/esp32-edgeai-sound-classifier
- Repository: https://github.com/adityabala30/esp32-edgeai-sound-classifier

## Overview

This repository contains three ESP32 sketches supporting a TinyML sound-classification workflow: microphone testing, WAV recording for model training, and on-device clap classification with serial and OLED output. The README documents the stages and their relationships, but no source excerpts were provided, so the graph reflects documented behavior rather than verified call structure.

Main entry points: [`sound_classifier/sound_classifier.ino`](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino) (Confidence threshold), [`ESP32_recorder/ESP32_recorder.ino`](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/ESP32_recorder/ESP32_recorder.ino) (WAV recorder), [`INMP441_test_ESP_I2S/INMP441_test_ESP_I2S.ino`](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/INMP441_test_ESP_I2S/INMP441_test_ESP_I2S.ino) (I2S microphone test)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Audio capture"]
  node_mic_test["I2S microphone test"]
  node_recorder["WAV recorder<br/>[ESP32_recorder.ino]"]
end

subgraph group_training["Model preparation"]
  node_wav["WAV recordings"]
  node_edge_impulse["Edge Impulse training"]
end

subgraph group_deployment["On-device classification"]
  node_exported_model["Exported model library"]
  node_classifier["Classifier sketch"]
  node_audio_window["Audio window"]
  node_inference["Model inference"]
  node_threshold["Confidence threshold"]
  node_serial["Serial results"]
  node_oled["OLED result display"]
end

node_mic(("INMP441 microphone"))

node_mic -->|"tests connection"| node_mic_test
node_mic -->|"captures audio"| node_recorder
node_recorder -->|"saves recordings"| node_wav
node_wav -->|"trains model"| node_edge_impulse
node_edge_impulse -->|"exports library"| node_exported_model
node_mic -->|"captures via I2S"| node_classifier
node_classifier -->|"collects"| node_audio_window
node_audio_window -->|"processes"| node_inference
node_exported_model -->|"provides model"| node_inference
node_inference -->|"scores classes"| node_threshold
node_threshold -->|"reports result"| node_serial
node_threshold -->|"selects display text"| node_oled

click node_mic_test "https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/INMP441_test_ESP_I2S/INMP441_test_ESP_I2S.ino"
click node_recorder "https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/ESP32_recorder/ESP32_recorder.ino"
click node_classifier "https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino"
click node_audio_window "https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino"
click node_inference "https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino"
click node_threshold "https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino"
click node_serial "https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino"
click node_oled "https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino"

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_mic_test,node_recorder toneBlue
class node_wav,node_edge_impulse toneAmber
class node_exported_model,node_classifier,node_audio_window,node_inference,node_threshold,node_serial,node_oled toneMint
class node_mic toneIndigo
```

## Components

### Audio capture

- [I2S microphone test](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/INMP441_test_ESP_I2S/INMP441_test_ESP_I2S.ino): `INMP441_test_ESP_I2S/INMP441_test_ESP_I2S.ino`
- [WAV recorder](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/ESP32_recorder/ESP32_recorder.ino): `ESP32_recorder/ESP32_recorder.ino`

### Model preparation

- **WAV recordings**
- **Edge Impulse training**

### On-device classification

- **Exported model library**
- [Classifier sketch](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino): `sound_classifier/sound_classifier.ino`
- [Audio window](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino): `sound_classifier/sound_classifier.ino`
- [Model inference](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino): `sound_classifier/sound_classifier.ino`
- [Confidence threshold](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino): `sound_classifier/sound_classifier.ino`
- [Serial results](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino): `sound_classifier/sound_classifier.ino`
- [OLED result display](https://github.com/adityabala30/esp32-edgeai-sound-classifier/blob/main/sound_classifier/sound_classifier.ino): `sound_classifier/sound_classifier.ino`

### Other components

- **INMP441 microphone**

## Connections

- INMP441 microphone → I2S microphone test: tests connection (evidence: `README.md`)
- INMP441 microphone → WAV recorder: captures audio (evidence: `README.md`)
- WAV recorder → WAV recordings: saves recordings (evidence: `README.md`)
- WAV recordings → Edge Impulse training: trains model (evidence: `README.md`)
- Edge Impulse training → Exported model library: exports library (evidence: `README.md`)
- INMP441 microphone → Classifier sketch: captures via I2S (evidence: `README.md`)
- Classifier sketch → Audio window: collects (evidence: `README.md`)
- Audio window → Model inference: processes (evidence: `README.md`)
- Exported model library → Model inference: provides model (evidence: `README.md`)
- Model inference → Confidence threshold: scores classes (evidence: `README.md`)
- Confidence threshold → Serial results: reports result (evidence: `README.md`)
- Confidence threshold → OLED result display: selects display text (evidence: `README.md`)
