# sevask/ecoute architecture

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

- Interactive diagram: https://gitdiagram.com/sevask/ecoute
- Repository: https://github.com/sevask/ecoute

## Overview

##### Main Components Identification

a) Input/Output Layer:
- Microphone Input Handler
- Speaker Output Handler
- User Interface (Textbox Display)

b) Processing Layer:
- Audio Recording System (AudioRecorder.py)
- Transcription System (AudioTranscriber.py)
- GPT Response Generation (GPTResponder.py)

c) External Services:
- OpenAI GPT-3.5 API
- OpenAI Whisper API (optional)

##### Component Relationships

a) Primary Flow:
##### GPTResponder → Response Display

b) API Interactions:
- AudioTranscriber ↔ Whisper API (when --api flag is used)
- GPTResponder ↔ OpenAI GPT-3.5 API

##### Default Path
- Local Whisper model (tiny.en.pt)
- English-only processing

##### API Path (--api flag)
- Connection to Whisper API
- Multi-language support

##### Technical Details

Annotations for:
- Python >=3.8.0 requirement
- FFmpeg dependency
- Windows OS compatibility
- Real-time processing indicators
- Default audio device dependencies

##### Additional Notes

A notes section highlighting:
- Real-time nature of the system
- Warm-up period requirement
- Language limitations
- Default device dependencies
- API credit usage considerations

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph IO["Input/Output Layer"]
        MI[Microphone Input]:::io
        SO[Speaker Output]:::io
        TD[Text Display]:::io
        RD[Response Display]:::io
    end

    subgraph Processing["Processing Layer"]
        AR[Audio Recording System]:::process
        AT[Transcription System]:::process
        GPTR[GPT Response Generation]:::process
        TM[Transcription Model Management]:::process
        SRC[Speech Recognition Core]:::process
        WI[Whisper Integration]:::process
        APU[Audio Processing Utilities]:::process
        SRE[Speech Recognition Exceptions]:::process
        PT[GPT Prompt Templates]:::process
        MAC[Main Application Controller]:::process
    end

    subgraph Models["Model Storage"]
        LWM[Local Whisper Model]:::storage
        SRM[Speech Recognition Models]:::storage
    end

    subgraph External["External Services"]
        WAPI[OpenAI Whisper API]:::external
        GAPI[OpenAI GPT-3.5 API]:::external
    end

    MI --> AR
    AR --> AT
    AT --> TD
    TD --> GPTR
    GPTR --> RD

    AT --> WI
    WI --> WAPI
    WI --> LWM
    AT --> TM
    TM --> SRM
    AR --> SRC
    SRC --> APU
    APU --> SRE
    GPTR --> PT
    MAC --> AR
    MAC --> AT
    MAC --> GPTR
    GPTR --> GAPI

    %% Click events for component mapping
    click AR "https://github.com/SevaSk/ecoute/blob/main/AudioRecorder.py"
    click AT "https://github.com/SevaSk/ecoute/blob/main/AudioTranscriber.py"
    click GPTR "https://github.com/SevaSk/ecoute/blob/main/GPTResponder.py"
    click WI "https://github.com/SevaSk/ecoute/blob/main/custom_speech_recognition/recognizers/whisper.py"
    click LWM "https://github.com/SevaSk/ecoute/blob/main/tiny.en.pt"
    click SRC "https://github.com/SevaSk/ecoute/blob/main/custom_speech_recognition/audio.py"
    click TM "https://github.com/SevaSk/ecoute/blob/main/TranscriberModels.py"
    click MAC "https://github.com/SevaSk/ecoute/blob/main/main.py"
    click PT "https://github.com/SevaSk/ecoute/blob/main/prompts.py"
    click SRM "https://github.com/SevaSk/ecoute/tree/main/custom_speech_recognition/pocketsphinx-data/"
    click APU "https://github.com/SevaSk/ecoute/blob/main/custom_speech_recognition/__init__.py"
    click SRE "https://github.com/SevaSk/ecoute/blob/main/custom_speech_recognition/exceptions.py"

    %% Styling
    classDef io fill:#3498db,stroke:#2980b9,color:white
    classDef process fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        L1[Input/Output]:::io
        L2[Processing]:::process
        L3[Storage]:::storage
        L4[External Services]:::external
    end
```
