# sooham/robotouille architecture

> Architecture diagram of the GitHub repository sooham/robotouille, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sooham/robotouille
- Repository: https://github.com/sooham/robotouille

## Overview

##### Main Components

A. Frontend Layer:
- Web Interface (website/templates)
- Static Assets
- JavaScript Controllers (speechController.js, recipeScroller.js)
- CSS Styles
- Audio Feedback Files (wav directory)

B. Backend Layer:
- Python Server (website/server.py)
- Utility Functions (website/utils.py)

C. Speech Processing Components:
- Speech-to-Text Module (SpeechToText directory)
- Audio Recording System (record.py)
- Speech Recognition Processing (stt.py)

##### Component Relationships

a. User Interface → Speech Processing:
- Bidirectional communication between the frontend and speech recognition
- Audio input flow and text output flow

b. Speech Processing → Backend:
- How the speech recognition results are processed by the server
- Flow of recipe data and commands

c. Backend → Frontend:
- How recipe data and navigation commands flow back to the UI
- Audio feedback pathway

##### Technical Stack Representation

Technologies:
- Frontend: HTML5, JavaScript, CSS
- Backend: Python (Flask implied by structure)
- Speech Processing: Custom TypeScript-based Speech SDK
- WebSocket connections for real-time communication

##### Specific Design Elements

Use these visual elements:
- Blue components for frontend elements
- Green components for backend services
- Purple components for speech processing
- Yellow components for storage/static assets
- Red lines for real-time communication paths
- Black lines for standard HTTP requests

##### Architectural Patterns to Highlight

a. Client-Server Architecture:
- Clear separation between frontend and backend
- RESTful communication paths

b. Event-Driven Architecture:
- WebSocket connections for real-time updates
- Speech event handling flow

c. Modular Component Structure:
- Separate speech processing module
- Distinct frontend controllers

##### Implementation Details

a. Speech Processing Pipeline:
- Audio Input → Speech Recognition → Text Output
- Audio Feedback System
- WebSocket-based real-time communication

b. User Interface Components:
- Recipe View
- Speech Control Interface
- Navigation Controls

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI["Web Interface"]
        SC["Speech Controller"]
        RS["Recipe Scroller"]
        CSS["Styling"]
        AF["Audio Feedback"]
    end

    subgraph Backend
        BS["Backend Server"]
        UF["Utility Functions"]
    end

    subgraph "Speech Processing"
        STT["Speech-to-Text Core"]
        AR["Audio Recording"]
        SR["Speech Recognition"]
        
        subgraph "WebSocket Layer"
            WS["WebSocket Connection"]
            WMA["WebSocket Message Adapter"]
        end
        
        subgraph "Audio Processing"
            MAS["Mic Audio Source"]
            PCMR["PCM Recorder"]
        end
        
        subgraph "Recognition Components"
            REC["Recognizer"]
            RECC["Recognizer Config"]
        end
    end

    UI --> SC
    UI --> RS
    UI --> CSS
    SC --> AF
    
    SC <--> WS
    WS <--> WMA
    WMA <--> STT
    
    MAS --> PCMR
    PCMR --> REC
    REC --> RECC
    
    STT --> SR
    SR --> AR
    
    WS <--> BS
    BS --> UF
    BS --> UI

    classDef frontend fill:#a8d1ff
    classDef backend fill:#90EE90
    classDef speech fill:#DDA0DD
    classDef websocket fill:#FFB6C1
    classDef audio fill:#FFD700

    class UI,SC,RS,CSS,AF frontend
    class BS,UF backend
    class STT,AR,SR,REC,RECC speech
    class WS,WMA websocket
    class MAS,PCMR audio

    click UI "https://github.com/sooham/robotouille/blob/master/website/templates/index.html"
    click SC "https://github.com/sooham/robotouille/blob/master/website/static/js/speechController.js"
    click RS "https://github.com/sooham/robotouille/blob/master/website/static/js/recipeScroller.js"
    click CSS "https://github.com/sooham/robotouille/blob/master/website/static/css/index.css"
    click AF "https://github.com/sooham/robotouille/tree/master/website/static/wav/misc"
    click BS "https://github.com/sooham/robotouille/blob/master/website/server.py"
    click UF "https://github.com/sooham/robotouille/blob/master/website/utils.py"
    click STT "https://github.com/sooham/robotouille/tree/master/SpeechToText/src/sdk/speech"
    click REC "https://github.com/sooham/robotouille/blob/master/SpeechToText/src/sdk/speech/Recognizer.ts"
    click RECC "https://github.com/sooham/robotouille/blob/master/SpeechToText/src/sdk/speech/RecognizerConfig.ts"
    click WS "https://github.com/sooham/robotouille/blob/master/SpeechToText/src/common.browser/WebsocketConnection.ts"
    click WMA "https://github.com/sooham/robotouille/blob/master/SpeechToText/src/common.browser/WebsocketMessageAdapter.ts"
    click MAS "https://github.com/sooham/robotouille/blob/master/SpeechToText/src/common.browser/MicAudioSource.ts"
    click PCMR "https://github.com/sooham/robotouille/blob/master/SpeechToText/src/common.browser/PCMRecorder.ts"
```
