Skip to main content

AI-powered body sound analysis platform for heart, lung, and bowel sound detection.

Project description

🩺 AI Body Sound Analyzer

An end-to-end medical diagnostics platform using Deep Learning, Digital Signal Processing (DSP), and Agentic AI to analyze biological sounds (Heart, Lung, and Bowel).

Python Version License: MIT


🚀 Key Features

1. ❤️ Heart Sound Analysis

  • Deep Learning: Uses a trained LSTM (Long Short-Term Memory) model to classify heart sounds into Normal, Murmur, or Artifact.
  • Signal Processing: Extracts S1/S2 heartbeats using energy envelope detection and 20-500Hz bandpass filtering.
  • Heart Rate Variability (HRV): Detailed timing analysis of heart rate patterns.

2. 🫁 Lung Sound Analysis

  • Classification: Powered by a GRU (Gated Recurrent Unit) model to detect Normal, Wheeze, or Crackle sounds.
  • Breath Cycle Detection: Sophisticated prominence-based detection of inspiration and expiration phases.

3. 🩺 Bowel Sound Analysis

  • Event Detection: High-resolution detection of bowel sounds using CRNN (Convolutional Recurrent Neural Networks).
  • Metric Extraction: Analysis of event frequency and rhythmic patterns.

4. 💬 Specialized AI Agents

  • Integrated with LangGraph and Groq (Llama-3) for rapid medical insight.
  • Context-Aware: Agents receive patient information (age, gender, name) to provide personalized explanations.
  • RAG Powered: Uses semantic search over analysis reports to answer technical questions about detected anomalies.

📦 Installation

Install the package directly from PyPI or locally in editable mode:

From PyPI

pip install body-sound-detection

Locally (for development)

pip install -e .

[!IMPORTANT] Ensure you have FFmpeg installed on your system for audio processing (required by librosa).


🏃 Usage

Programmatic Usage

You can use the package as a library in your own Python projects:

from body_sound_detection import HeartbeatAnalyzer, load_model

# Run Signal Processing
analyzer = HeartbeatAnalyzer("heartbeat_sample.wav")
results = analyzer.analyze()
print(f"Detected Heart Rate: {results['heart_rate_bpm']} BPM")

⚙️ Configuration

The AI Agents require the following environment variables (or a .env file):

  • GROQ_API_KEY: For LLM generation.
  • HF_TOKEN: For downloading models from HuggingFace.

📂 Project Structure

├── body_sound_detection/ 
│   ├── agent/             # LangGraph AI logic
│   ├── classification/    # Deep Learning (H5 Models)
│   ├── signal_processing/ # Audio DSP routines
│   ├── report_generator/  # PDF/JSON report logic
│   └── cli.py             # App entry point
├── main.py                # Main Streamlit dashboard
├── pyproject.toml         # Packaging metadata
└── README.md              # You are here!

📄 License

Distributed under the MIT License. See LICENSE for more information.

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

body_sound_detection-0.4.5.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

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

body_sound_detection-0.4.5-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

Details for the file body_sound_detection-0.4.5.tar.gz.

File metadata

  • Download URL: body_sound_detection-0.4.5.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for body_sound_detection-0.4.5.tar.gz
Algorithm Hash digest
SHA256 619af0ff495ae8f5f83202ae20f1063243b4bea5c640cfdceaa20c468b7e9299
MD5 1ac87e2e0905968c5ee07a18d9ef496f
BLAKE2b-256 4a1ada037c2ef632e2d18b12c0b4ea62e4bc7011c8b60cb8b2312958ef7ff1b8

See more details on using hashes here.

File details

Details for the file body_sound_detection-0.4.5-py3-none-any.whl.

File metadata

File hashes

Hashes for body_sound_detection-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 42227903c732f00e011cf3de54ba4bfd95823fca83bbc04312421491004f05de
MD5 5e99783e62cebd285903eb158fed824f
BLAKE2b-256 2fccf05bd9268fe20e5fe89bad9115fb24afc2bf4d2f80f59197a25465c3b457

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