π€ Real-Time Audio Intelligence | Live speaker identification, speech-to-text, and sentiment analysis pipeline with Whisper & Wav2Vec2. Perfect for meetings, support calls, and voice apps. β‘ Features: Multi-speaker diarization β’ Emotion detection β’ Low-latency processing β’ Python/FastAPI backend
9
stars
23
commits
Python
primary language
Aug 20, 2025
updated
A comprehensive FastAPI-based real-time audio processing system designed for live customer service call analysis. This system provides real-time speaker diarization, transcription, sentiment analysis, and emotion recognition with WebSocket streaming capabilities.
AudioPipelineTreatment/
βββ π capture/ # Audio capture and processing
β βββ audio_capture.py # Main audio capture logic
β βββ __init__.py
βββ π diarization/ # Speaker diarization
β βββ speaker_diarization.py # Speaker identification
β βββ test_diarization.py # Diarization tests
β βββ newdir.py
βββ π transcription/ # Speech-to-text
β βββ speech_to_text.py # Whisper-based transcription
βββ π sentiment/ # Sentiment analysis modules
β βββ SentimentFromTrans.py # Text-based sentiment
β βββ VoiceEmotionRecognizer.py # Voice emotion analysis
β βββ VoiceSentiment.py # Voice sentiment analysis
β βββ TranscriptSentiment.py # Transcript processing
βββ π tests/ # Comprehensive test suite
β βββ test_pipeline.py # Pipeline integration tests
β βββ test_realtime_sentiment.py
β βββ testdiarizatio.py
βββ π models/ # Pre-trained model storage
β βββ wav2vec2-lg-xlsr-en-speech-emotion-recognition/
β βββ faster-whisper-base.en/
βββ π logs/ # Application logs
βββ π tmp/ # Temporary processing files
βββ π main.py # FastAPI application entry
βββ π enhanced_web_realtime_pipeline.py # Core pipeline
βββ π RealTimePipelineMic.py # Microphone pipeline
βββ π RealTimeWavPipeline.py # WAV file pipeline
βββ π requirements.txt # Python dependencies
βββ π³ dockerfile # Docker configuration
βββ π PROCESS_FLOW_DOCUMENTATION.md # Detailed technical docs
git clone <repository-url>
cd AudioPipelineTreatment
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
Download Models (Automatic on first run)
Run the Application
uvicorn main:app --reload --host 0.0.0.0 --port 8000
| Method | Endpoint | Description |
|---|---|---|
GET | / | Root endpoint with welcome message |
GET | /health | System health and status check |
POST | /upload-audio | Upload audio file for batch processing |
WS | /ws | WebSocket for real-time audio streaming |
ws://localhost:8000/ws{
"type": "audio",
"data": "base64-encoded-audio-chunk",
"sampleRate": 16000,
"channels": 1
}
{
"timestamp": "2025-08-20T12:34:56",
"speaker": "SPEAKER_00",
"transcription": "Hello, how can I help you today?",
"sentiment": {
"text_sentiment": "POSITIVE",
"text_confidence": 0.92,
"voice_emotion": "HAPPY",
"voice_confidence": 0.87,
"combined_sentiment": "POSITIVE"
},
"voice_features": {
"pitch": 185.23,
"energy": 0.12,
"speaking_rate": 0.08,
"tone_stability": 0.76
},
"speaker_info": {
"speaker_id": "SPEAKER_00",
"speaker_type": "agent",
"confidence": 0.94
}
}
pytest tests/ -v
# Test real-time sentiment analysis
pytest tests/test_realtime_sentiment.py -v
# Test pipeline integration
pytest tests/test_pipeline.py -v
# Test speaker diarization
pytest tests/testdiarizatio.py -v
# Test audio capture directly
python AudioCaptureTester.py
# Test microphone pipeline
python RealTimePipelineMic.py
# Test WAV file processing
python RealTimeWavPipeline.py
π 12:01:23 | π€ SPEAKER_00 | "Hello, how can I help you today?"
π [12:01:23] SENTIMENT: POSITIVE (confidence=0.92)
π Text: POSITIVE | π΅ Voice: HAPPY
ποΈ Voice Features - Pitch: 185.23Hz, Energy: 0.12, Rate: 2.1 words/sec
π 12:01:28 | π€ SPEAKER_01 | "I'm having trouble with my account."
π [12:01:28] SENTIMENT: FRUSTRATED (confidence=0.78)
π Text: NEUTRAL | π΅ Voice: FRUSTRATED
ποΈ Voice Features - Pitch: 165.45Hz, Energy: 0.18, Rate: 1.8 words/sec
{
"session_id": "sess_1724150456",
"timestamp": "12:01:23",
"analysis": {
"speaker": {
"id": "SPEAKER_00",
"type": "agent",
"confidence": 0.94
},
"transcription": {
"text": "Hello, how can I help you today?",
"confidence": 0.96,
"language": "en"
},
"sentiment": {
"overall": "POSITIVE",
"text_based": "POSITIVE",
"voice_based": "HAPPY",
"confidence": 0.92
},
"emotions": {
"primary": "HAPPY",
"secondary": "CONFIDENT",
"arousal": 0.7,
"valence": 0.8
},
"voice_analytics": {
"pitch_hz": 185.23,
"energy_db": -12.4,
"speaking_rate_wps": 2.1,
"pause_ratio": 0.15,
"tone_stability": 0.76
}
}
}
# Model Configuration
WHISPER_MODEL_SIZE=base.en # tiny, base, small, medium, large
EMOTION_MODEL_PATH=./models/ # Custom emotion model path
ENABLE_GPU=true # Enable GPU acceleration
# Audio Settings
SAMPLE_RATE=16000 # Audio sample rate
BUFFER_SIZE=1024 # Audio buffer size
VAD_THRESHOLD=0.5 # Voice activity detection threshold
# API Settings
HOST=0.0.0.0 # API host
PORT=8000 # API port
DEBUG=false # Debug mode
BUFFER_SIZE based on your hardware# Build the container
docker build -t audio-pipeline .
# Run with GPU support
docker run --gpus all -p 8000:8000 audio-pipeline
# Run CPU-only
docker run -p 8000:8000 audio-pipeline
version: '3.8'
services:
audio-pipeline:
build: .
ports:
- "8000:8000"
environment:
- ENABLE_GPU=true
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
# Check microphone permissions
# Verify audio device in Device Manager
# Test with: python AudioCaptureTester.py
# Check internet connection
# Clear cache: rm -rf ~/.cache/huggingface/
# Manual download: huggingface-cli download Systran/faster-whisper-base.en
# Verify server is running: curl http://localhost:8000/health
# Check firewall settings
# Ensure port 8000 is available
# Reduce model size in config
# Enable GPU acceleration
# Adjust buffer sizes
# Close other applications
tiny or base Whisper modelsmedium or large Whisper models# Enable detailed logging
export DEBUG=true
python main.py
# View logs
tail -f pipeline.log
git checkout -b feature/amazing-featurepip install -r requirements-dev.txtpytestgit commit -m 'Add amazing feature'git push origin feature/amazing-featureThis project is licensed under the MIT License - see the LICENSE file for details.
π Ready to get started? Run uvicorn main:app --reload and visit http://localhost:8000/docs to explore the API!
π― Need real-time analysis? Connect to ws://localhost:8000/ws and start streaming audio data!
π Want to see it in action? Check out the Process Flow Documentation for detailed examples!
23 commits
Python
100.0%
π€ Real-Time Audio Intelligence | Live speaker identification, speech-to-text, and sentiment analysis pipeline with Whisper & Wav2Vec2. Perfect for meetings, support calls, and voice apps. β‘ Features: Multi-speaker diarization β’ Emotion detection β’ Low-latency processing β’ Python/FastAPI backend
9
stars
23
commits
Python
primary language
Aug 20, 2025
updated
A comprehensive FastAPI-based real-time audio processing system designed for live customer service call analysis. This system provides real-time speaker diarization, transcription, sentiment analysis, and emotion recognition with WebSocket streaming capabilities.
AudioPipelineTreatment/
βββ π capture/ # Audio capture and processing
β βββ audio_capture.py # Main audio capture logic
β βββ __init__.py
βββ π diarization/ # Speaker diarization
β βββ speaker_diarization.py # Speaker identification
β βββ test_diarization.py # Diarization tests
β βββ newdir.py
βββ π transcription/ # Speech-to-text
β βββ speech_to_text.py # Whisper-based transcription
βββ π sentiment/ # Sentiment analysis modules
β βββ SentimentFromTrans.py # Text-based sentiment
β βββ VoiceEmotionRecognizer.py # Voice emotion analysis
β βββ VoiceSentiment.py # Voice sentiment analysis
β βββ TranscriptSentiment.py # Transcript processing
βββ π tests/ # Comprehensive test suite
β βββ test_pipeline.py # Pipeline integration tests
β βββ test_realtime_sentiment.py
β βββ testdiarizatio.py
βββ π models/ # Pre-trained model storage
β βββ wav2vec2-lg-xlsr-en-speech-emotion-recognition/
β βββ faster-whisper-base.en/
βββ π logs/ # Application logs
βββ π tmp/ # Temporary processing files
βββ π main.py # FastAPI application entry
βββ π enhanced_web_realtime_pipeline.py # Core pipeline
βββ π RealTimePipelineMic.py # Microphone pipeline
βββ π RealTimeWavPipeline.py # WAV file pipeline
βββ π requirements.txt # Python dependencies
βββ π³ dockerfile # Docker configuration
βββ π PROCESS_FLOW_DOCUMENTATION.md # Detailed technical docs
git clone <repository-url>
cd AudioPipelineTreatment
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
Download Models (Automatic on first run)
Run the Application
uvicorn main:app --reload --host 0.0.0.0 --port 8000
| Method | Endpoint | Description |
|---|---|---|
GET | / | Root endpoint with welcome message |
GET | /health | System health and status check |
POST | /upload-audio | Upload audio file for batch processing |
WS | /ws | WebSocket for real-time audio streaming |
ws://localhost:8000/ws{
"type": "audio",
"data": "base64-encoded-audio-chunk",
"sampleRate": 16000,
"channels": 1
}
{
"timestamp": "2025-08-20T12:34:56",
"speaker": "SPEAKER_00",
"transcription": "Hello, how can I help you today?",
"sentiment": {
"text_sentiment": "POSITIVE",
"text_confidence": 0.92,
"voice_emotion": "HAPPY",
"voice_confidence": 0.87,
"combined_sentiment": "POSITIVE"
},
"voice_features": {
"pitch": 185.23,
"energy": 0.12,
"speaking_rate": 0.08,
"tone_stability": 0.76
},
"speaker_info": {
"speaker_id": "SPEAKER_00",
"speaker_type": "agent",
"confidence": 0.94
}
}
pytest tests/ -v
# Test real-time sentiment analysis
pytest tests/test_realtime_sentiment.py -v
# Test pipeline integration
pytest tests/test_pipeline.py -v
# Test speaker diarization
pytest tests/testdiarizatio.py -v
# Test audio capture directly
python AudioCaptureTester.py
# Test microphone pipeline
python RealTimePipelineMic.py
# Test WAV file processing
python RealTimeWavPipeline.py
π 12:01:23 | π€ SPEAKER_00 | "Hello, how can I help you today?"
π [12:01:23] SENTIMENT: POSITIVE (confidence=0.92)
π Text: POSITIVE | π΅ Voice: HAPPY
ποΈ Voice Features - Pitch: 185.23Hz, Energy: 0.12, Rate: 2.1 words/sec
π 12:01:28 | π€ SPEAKER_01 | "I'm having trouble with my account."
π [12:01:28] SENTIMENT: FRUSTRATED (confidence=0.78)
π Text: NEUTRAL | π΅ Voice: FRUSTRATED
ποΈ Voice Features - Pitch: 165.45Hz, Energy: 0.18, Rate: 1.8 words/sec
{
"session_id": "sess_1724150456",
"timestamp": "12:01:23",
"analysis": {
"speaker": {
"id": "SPEAKER_00",
"type": "agent",
"confidence": 0.94
},
"transcription": {
"text": "Hello, how can I help you today?",
"confidence": 0.96,
"language": "en"
},
"sentiment": {
"overall": "POSITIVE",
"text_based": "POSITIVE",
"voice_based": "HAPPY",
"confidence": 0.92
},
"emotions": {
"primary": "HAPPY",
"secondary": "CONFIDENT",
"arousal": 0.7,
"valence": 0.8
},
"voice_analytics": {
"pitch_hz": 185.23,
"energy_db": -12.4,
"speaking_rate_wps": 2.1,
"pause_ratio": 0.15,
"tone_stability": 0.76
}
}
}
# Model Configuration
WHISPER_MODEL_SIZE=base.en # tiny, base, small, medium, large
EMOTION_MODEL_PATH=./models/ # Custom emotion model path
ENABLE_GPU=true # Enable GPU acceleration
# Audio Settings
SAMPLE_RATE=16000 # Audio sample rate
BUFFER_SIZE=1024 # Audio buffer size
VAD_THRESHOLD=0.5 # Voice activity detection threshold
# API Settings
HOST=0.0.0.0 # API host
PORT=8000 # API port
DEBUG=false # Debug mode
BUFFER_SIZE based on your hardware# Build the container
docker build -t audio-pipeline .
# Run with GPU support
docker run --gpus all -p 8000:8000 audio-pipeline
# Run CPU-only
docker run -p 8000:8000 audio-pipeline
version: '3.8'
services:
audio-pipeline:
build: .
ports:
- "8000:8000"
environment:
- ENABLE_GPU=true
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
# Check microphone permissions
# Verify audio device in Device Manager
# Test with: python AudioCaptureTester.py
# Check internet connection
# Clear cache: rm -rf ~/.cache/huggingface/
# Manual download: huggingface-cli download Systran/faster-whisper-base.en
# Verify server is running: curl http://localhost:8000/health
# Check firewall settings
# Ensure port 8000 is available
# Reduce model size in config
# Enable GPU acceleration
# Adjust buffer sizes
# Close other applications
tiny or base Whisper modelsmedium or large Whisper models# Enable detailed logging
export DEBUG=true
python main.py
# View logs
tail -f pipeline.log
git checkout -b feature/amazing-featurepip install -r requirements-dev.txtpytestgit commit -m 'Add amazing feature'git push origin feature/amazing-featureThis project is licensed under the MIT License - see the LICENSE file for details.
π Ready to get started? Run uvicorn main:app --reload and visit http://localhost:8000/docs to explore the API!
π― Need real-time analysis? Connect to ws://localhost:8000/ws and start streaming audio data!
π Want to see it in action? Check out the Process Flow Documentation for detailed examples!
23 commits
Python
100.0%