# kali-zoidberg/mobile-microphone architecture

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

- Interactive diagram: https://gitdiagram.com/kali-zoidberg/mobile-microphone
- Repository: https://github.com/kali-zoidberg/mobile-microphone

## Overview

##### Main Components

a) Client-Side Components (Mobile):
- Audio Capture System
- RTP Client Implementation
- Network Communication Layer
- Mobile GUI Interface

b) Server-Side Components (Windows):
- Audio Playback System
- RTP Server Implementation
- Jitter Management
- Audio Processing Pipeline

##### Detailed Architecture Breakdown

A. Device Layer:
- Both Mobile (Android/iOS) and Windows components
- Cross-platform compatibility
- Planned two-way audio streaming capability

B. Network Layer:
- RTP Protocol Implementation
- Packet Organization System
- Network Communication Handlers

C. Audio Processing Layer:
- Audio Buffer Management
- Jitter Control
- Audio Format Handling

##### Key Components to Emphasize

**[Audio Processing]**
- AudioBuffer
- AudioFunctions
- AudioPlayThread
- AudioWriter

**[Network Stack]**
- RtpConnection
- RtpPacket
- Client/Server Classes
- PacketOrganizer

**[Quality Control]**
- JitterBuffer
- SimpleJitterBuffer
- Interpolation

**[Support Systems]**
- Helper Functions
- Byte Operations
- Resource Management

##### Connection Flow

- Mobile Device → RTP Client → Network → RTP Server → Audio Output
- Planned reverse flow for two-way communication

##### Technical Details

- RTP protocol specifications
- Audio format specifications
- Buffer sizes and jitter management parameters
- Thread management structure
- GUI component integration points

##### Implementation Status

Use different shading or patterns to indicate:
- Completed components (90% Android backend)
- In-progress components (70% Windows backend)
- Planned components (iOS implementation)
- Future features (two-way streaming)

This system design should effectively communicate both the current state and future vision of the Mobile Microphone project while maintaining technical accuracy and implementation details.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Device Layer"
        direction TB
        Mobile["Mobile Device"]
        Windows["Windows Host"]
        
        subgraph "Mobile Components"
            direction TB
            GUI["Mobile GUI Interface"]:::gui
            AudioCapture["Audio Capture System"]:::audio
            ClientImpl["Client Implementation"]:::client
        end
        
        subgraph "Windows Components"
            direction TB
            AudioPlay["Audio Playback System"]:::audio
            ServerImpl["Server Implementation"]:::server
        end
    end
    
    subgraph "Network Layer"
        direction TB
        RTPProto["RTP Protocol Implementation"]:::network
        PacketOrg["Packet Organization System"]:::network
        NetComm["Network Communication Layer"]:::network
    end
    
    subgraph "Audio Processing Layer"
        direction TB
        AudioProc["Audio Processing System"]:::audio
        AudioBuf["Audio Buffer Management"]:::buffer
        JitterMgmt["Jitter Management"]:::buffer
        Interp["Interpolation System"]:::processing
    end
    
    subgraph "Support Layer"
        direction TB
        Helper["Helper Utilities"]:::utility
    end
    
    Mobile --> GUI
    GUI --> AudioCapture
    AudioCapture --> ClientImpl
    ClientImpl --> RTPProto
    RTPProto --> NetComm
    NetComm --> PacketOrg
    PacketOrg --> ServerImpl
    ServerImpl --> AudioBuf
    AudioBuf --> JitterMgmt
    JitterMgmt --> AudioProc
    AudioProc --> AudioPlay
    AudioPlay --> Windows
    
    Helper -.-> AudioProc
    Helper -.-> PacketOrg
    Interp -.-> AudioProc
    
    %% Click Events
    click GUI "https://github.com/Kali-Zoidberg/Mobile-Microphone/blob/master/src/main/java/threads/MobileMicGUI.java"
    click AudioCapture "https://github.com/Kali-Zoidberg/Mobile-Microphone/blob/master/src/main/java/threads/AudioWriter.java"
    click ClientImpl "https://github.com/Kali-Zoidberg/Mobile-Microphone/blob/master/src/main/java/RTPClient.java"
    click ServerImpl "https://github.com/Kali-Zoidberg/Mobile-Microphone/blob/master/src/main/java/RTPServer.java"
    click RTPProto "https://github.com/Kali-Zoidberg/Mobile-Microphone/tree/master/src/main/java/rtp"
    click PacketOrg "https://github.com/Kali-Zoidberg/Mobile-Microphone/blob/master/src/main/java/Network/PacketOrganizer.java"
    click NetComm "https://github.com/Kali-Zoidberg/Mobile-Microphone/tree/master/src/main/java/Network"
    click AudioProc "https://github.com/Kali-Zoidberg/Mobile-Microphone/blob/master/src/main/java/audio/AudioFunctions.java"
    click AudioBuf "https://github.com/Kali-Zoidberg/Mobile-Microphone/blob/master/src/main/java/audio/AudioBuffer.java"
    click JitterMgmt "https://github.com/Kali-Zoidberg/Mobile-Microphone/tree/master/src/main/java/jitter"
    click AudioPlay "https://github.com/Kali-Zoidberg/Mobile-Microphone/blob/master/src/main/java/threads/AudioPlayThread.java"
    click Interp "https://github.com/Kali-Zoidberg/Mobile-Microphone/blob/master/src/main/java/Interpolation/Interpolation.java"
    click Helper "https://github.com/Kali-Zoidberg/Mobile-Microphone/tree/master/src/main/java/helper"
    
    %% Styling
    classDef network fill:#9999ff,stroke:#333,stroke-width:2px
    classDef audio fill:#90EE90,stroke:#333,stroke-width:2px
    classDef buffer fill:#ffff99,stroke:#333,stroke-width:2px
    classDef utility fill:#cccccc,stroke:#333,stroke-width:2px
    classDef processing fill:#ff9999,stroke:#333,stroke-width:2px
    classDef gui fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef client fill:#98FB98,stroke:#333,stroke-width:2px
    classDef server fill:#87CEEB,stroke:#333,stroke-width:2px
```
