# alshell7/vokaturi-android architecture

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

- Interactive diagram: https://gitdiagram.com/alshell7/vokaturi-android
- Repository: https://github.com/alshell7/vokaturi-android

## Overview

##### Main Components

a) Application Layer
- Android App Component (Demo Application)
- UI Elements (PlayPauseButton, MainActivity)
- Resource Files (layouts, drawables)

b) Library Layer (VokaturiAndroid)
- Java Interface Layer
- Native Layer (JNI Bridge)
- Vokaturi Core Engine

c) External Systems
- Android Audio System
- File System (WAV files)

##### Component Relationships

**┌─ Android Application Layer ─────────────────────┐**
- ┌─ UI Components ─┐    ┌─ Audio Recording ─┐  │
- MainActivity    │    │ WavAudioRecorder  │  │
- PlayPauseButton│    └──────────┬────────┘  │
- ┬────────┘               │           │

- ┼────────────────────────┼───────────┤

- ┌─ Vokaturi Library Layer ──────┼───────┐   │

- ┌────┴─────────────────────┐ │       │   │
- Java Interface Layer  │ │       │   │
- Vokaturi.java         │◄┘       │   │
- EmotionProbabilities  │         │   │
- VokaturiException     │         │   │
- ┬──────────────┘         │   │

- ┌──────────┴──────────────┐        │   │
- JNI Bridge Layer    │        │   │
- vokaturi-lib.cpp     │        │   │
- ┬──────────────┘        │   │

- ┌──────────┴──────────────┐        │   │
- Vokaturi Core Engine   │        │   │
- Emotion Analysis     │        │   │
- Speech Processing    │        │   │
- ┘         │   │
- ┘   │
- ┘

##### Data Flow Indicators

- Audio input flow from device to library
- Control flow from UI to library
- Emotion analysis results flow back to UI
- File system interactions for WAV files

##### Important Elements to Highlight

a) Key Processes:
- Voice Recording Flow
- Emotion Analysis Pipeline
- Async Processing Path

b) Core Components:
- Emotion Recognition Engine
- WAV File Processing
- Real-time Analysis

##### Technical Details

- Supported Android API levels (15+)
- File format support (WAV only)
- Core emotion types (Neutral, Happy, Sad, Angry, Feared)
- Permission requirements (RECORD_AUDIO, WRITE_EXTERNAL_STORAGE)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef android fill:#4285F4,color:white
    classDef java fill:#43A047,color:white
    classDef jni fill:#FB8C00,color:white
    classDef core fill:#E53935,color:white
    classDef external fill:#757575,color:white

    %% Android Application Layer
    subgraph AppLayer["Android Application Layer"]
        UI["UI Components"]
        MainActivity["MainActivity"]:::android
        PlayPauseButton["PlayPauseButton"]:::android
        Layout["UI Layout"]:::android
        AudioRec["WavAudioRecorder"]:::android
    end

    %% Vokaturi Library Layer
    subgraph LibLayer["Vokaturi Library Layer"]
        subgraph JavaInterface["Java Interface Layer"]
            VokaturiJava["Vokaturi.java"]:::java
            EmotionProb["EmotionProbabilities"]:::java
            VokaturiExcept["VokaturiException"]:::java
            AsyncResult["VokaturiAsyncResult"]:::java
        end

        subgraph JNIBridge["JNI Bridge Layer"]
            VokaturiLib["vokaturi-lib.cpp"]:::jni
        end

        subgraph CoreEngine["Vokaturi Core Engine"]
            VokaturiCore["Vokaturi9.c"]:::core
            EmotionsH["Emotions.h"]:::core
            SoundH["Sound.h"]:::core
            SpectrumH["Spectrum.h"]:::core
            FFTH["fft_c.h"]:::core
            WavFileH["WavFile.h"]:::core
        end
    end

    %% External Systems
    AndroidAudio["Android Audio System"]:::external
    FileSystem["File System (WAV)"]:::external

    %% Relationships
    MainActivity --> PlayPauseButton
    MainActivity --> AudioRec
    AudioRec --> VokaturiJava
    VokaturiJava --> EmotionProb
    VokaturiJava --> VokaturiExcept
    VokaturiJava --> AsyncResult
    VokaturiJava --> VokaturiLib
    VokaturiLib --> VokaturiCore
    VokaturiCore --> EmotionsH
    VokaturiCore --> SoundH
    VokaturiCore --> SpectrumH
    SpectrumH --> FFTH
    SoundH --> WavFileH
    AudioRec --> AndroidAudio
    AudioRec --> FileSystem

    %% Click Events
    click MainActivity "https://github.com/alshell7/vokaturi-android/blob/master/app/src/main/java/com/projects/alshell/vokaturiandroid/MainActivity.java"
    click PlayPauseButton "https://github.com/alshell7/vokaturi-android/blob/master/app/src/main/java/com/projects/alshell/vokaturiandroid/PlayPauseButton.java"
    click Layout "https://github.com/alshell7/vokaturi-android/blob/master/app/src/main/res/layout/activity_main.xml"
    click VokaturiJava "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/java/com/projects/alshell/vokaturi/Vokaturi.java"
    click EmotionProb "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/java/com/projects/alshell/vokaturi/EmotionProbabilities.java"
    click VokaturiExcept "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/java/com/projects/alshell/vokaturi/VokaturiException.java"
    click AsyncResult "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/java/com/projects/alshell/vokaturi/VokaturiAsyncResult.java"
    click VokaturiLib "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/cpp/vokaturi-lib.cpp"
    click VokaturiCore "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/cpp/Vokaturi9.c"
    click EmotionsH "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/cpp/Emotions.h"
    click SoundH "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/cpp/Sound.h"
    click SpectrumH "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/cpp/Spectrum.h"
    click FFTH "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/cpp/fft_c.h"
    click WavFileH "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/cpp/WavFile.h"
    click AudioRec "https://github.com/alshell7/vokaturi-android/blob/master/vokaturi/src/main/java/com/projects/alshell/vokaturi/WavAudioRecorder.java"
```
