Skip to main content

Multimodal emotion recognition engine (audio + text + fusion)

Project description

Multimodal Emotion Recognition Engine combining audio, speech-to-text (ASR), and text-based emotion classification, with a simple CLI and Python API.

This project is designed as a modular engine that can: - ๐ŸŽ™๏ธ Listen from microphone - ๐Ÿ“‚ Analyze audio files - ๐Ÿง  Fuse audio + text emotion signals - โšก Run locally with pretrained models

โ€”

Features

  • Audio emotion recognition - MFCC + pitch based model

  • Speech-to-text (ASR) - Powered by faster-whisper

  • Text emotion classification - DistilRoBERTa emotion model

  • CLI interface - emotion-engine listen - emotion-engine analyze <file>

  • Python API

  • PyScaffold-based project structure

  • Tested with pytest

โ€”

Project Structure

multimodal_emotion_engine/
โ”œโ”€โ”€ src/multimodal_emotion_engine/
โ”‚   โ”œโ”€โ”€ audio/
โ”‚   โ”‚   โ”œโ”€โ”€ emotion_model.py
โ”‚   โ”‚   โ”œโ”€โ”€ features.py
โ”‚   โ”‚   โ””โ”€โ”€ mic.py
โ”‚   โ”œโ”€โ”€ text/
โ”‚   โ”‚   โ””โ”€โ”€ asr.py
โ”‚   โ”œโ”€โ”€ engine.py
โ”‚   โ”œโ”€โ”€ cli.py
โ”‚   โ””โ”€โ”€ config.py
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ emotion_model.pt
โ”œโ”€โ”€ tests/
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ setup.cfg

โ€”

Installation

### 1. Clone the repository

git clone https://github.com/satsin06/multimodal_emotion_engine.git
cd multimodal_emotion_engine

โ€”

### 2. Create and activate a virtual environment (recommended)

python -m venv venv
source venv/bin/activate   # macOS / Linux
venv\Scripts\activate      # Windows

โ€”

### 3. Install the package

#### Minimal install

pip install -e .

#### With audio support

pip install -e ".[audio]"

#### With ASR support

pip install -e ".[asr]"

#### Full installation (recommended)

pip install -e ".[full]"

โ€”

CLI Usage

After installation, the CLI command is available as:

emotion-engine --help

### ๐ŸŽ™๏ธ Listen from microphone

emotion-engine listen

This will: - Record audio from your microphone - Run emotion recognition - Print emotion probabilities

Press Ctrl+C to stop recording (microphone is safely closed).

โ€”

### ๐Ÿ“‚ Analyze an audio file

emotion-engine analyze path/to/audio.wav

โ€”

Python API Usage

You can also use the engine programmatically:

from multimodal_emotion_engine.engine import EmotionEngine

engine = EmotionEngine()
result = engine.analyze_file("sample.wav")

print(result)

Example output:

{
    "neutral": 0.38,
    "happy": 0.10,
    "sad": 0.11,
    "angry": 0.05
}

โ€”

Models

  • Audio emotion model - Stored in: models/emotion_model.pt

  • Text emotion model - j-hartmann/emotion-english-distilroberta-base (downloaded automatically)

  • ASR model - Faster-Whisper (downloaded on first use)

Models are cached under:

~/.cache/emotion-engine/

โ€”

Running Tests

Install test dependencies:

pip install -e ".[dev]"

Run tests:

pytest

โ€”

Development Notes

  • Python โ‰ฅ 3.9

  • PyScaffold 4.6

  • Type hints enabled (Pylance / MyPy friendly)

  • Modular design for future multimodal fusion

โ€”

Roadmap

  • [ ] Real-time streaming emotion detection

  • [ ] Multilingual ASR

  • [ ] Emotion fusion weighting

  • [ ] REST API

  • [ ] Model retraining pipeline

โ€”

License

MIT License. See LICENSE.txt for details.

โ€”

Author

Satyam Sinha

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multimodal_emotion_engine-0.2.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multimodal_emotion_engine-0.2.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file multimodal_emotion_engine-0.2.0.tar.gz.

File metadata

File hashes

Hashes for multimodal_emotion_engine-0.2.0.tar.gz
Algorithm Hash digest
SHA256 02f95ca8f3d875c6cefd4189454ac02f8ea5bf55c1ec529bdafb760ffc5d2384
MD5 f8722c87ad23ee0f05febb8a880dd769
BLAKE2b-256 26813cf0889e5db100f023d9d41bb05df5e28dd494a3babd70618a99062a863d

See more details on using hashes here.

File details

Details for the file multimodal_emotion_engine-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for multimodal_emotion_engine-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e450109743e687d7675b3b6d0fd379f5a2178d834ddb2b3d3a0e42b94ef25a4
MD5 21a3d455530311169bbaaf201eb89bbf
BLAKE2b-256 b50510526dae99593730527fdd6a19f4f004219d061980d547cb3e733ee49e0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page