Skip to main content

One-command voice STT + TTS for any app

Project description

VoicePipe

One-command voice integration for any app

PyPI version Python versions License


Overview

VoicePipe provides one-command STT (Speech-to-Text) + TTS (Text-to-Speech) for any application.

  • STT: whisper.cpp - fastest local speech recognition
  • TTS: KittenTTS - smallest neural TTS (15-80MB)

Installation

pip install voicepipe

Quick Start

from voicepipe import VoicePipeline

# Initialize (auto-downloads models)
voice = VoicePipeline()

# Speech to Text
text = voice.speech_to_text("audio.wav")
print(f"You said: {text}")

# Text to Speech
audio = voice.text_to_speech("Hello, world!")

Requirements

  • Python 3.8+
  • FFmpeg (for audio processing)

Install FFmpeg

macOS:

brew install ffmpeg

Linux:

sudo apt install ffmpeg

Windows:

choco install ffmpeg

Configuration

voice = VoicePipeline(
    stt_model="tiny",        # tiny, base, small
    tts_model="nano",        # nano, micro, mini
    tts_voice="Bella",       # 8 voices available
    tts_speed=1.0,          # 0.5 - 2.0
    language="en",           # or "auto"
    cache_dir="~/.voicepipe" # model cache
)

Available Voices

  • Bella, Jasper, Luna, Bruno, Rosie, Hugo, Kiki, Leo

Models

STT (whisper.cpp)

Model Size RAM Speed
tiny 75MB ~500MB 10x realtime
base 142MB ~1GB 5x realtime
small 466MB ~2GB 2x realtime

TTS (KittenTTS)

Model Size Quality
nano 15MB Good
micro 40MB Better
mini 80MB Best

Use Cases

Chatbot with Voice

@app.post("/voice/chat")
async def voice_chat(audio: bytes):
    # Convert speech to text
    text = voice.speech_to_text_bytes(audio)
    
    # Get chatbot response
    response = await chatbot.chat(text)
    
    # Convert response to speech
    audio_response = voice.text_to_speech(response)
    
    return {"audio": audio_response}

Voice Assistant

async def run_assistant():
    while True:
        # Continuously listen and respond
        text = await voice.speech_to_text_async(microphone_stream)
        response = await assistant.respond(text)
        voice.text_to_speech(response, play=True)

API Reference

VoicePipeline

Method Description
speech_to_text(audio_path) Convert audio file to text
speech_to_text_bytes(audio_data) Convert raw audio to text
text_to_speech(text) Convert text to audio bytes
text_to_speech_file(text, path) Convert text to audio file
list_voices() Get available TTS voices
get_status() Get pipeline status

Development

# Clone repository
git clone https://github.com/danlab-ai/voicepipe.git
cd voicepipe

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/voicepipe
ruff check src/voicepipe

License

MIT License - see LICENSE


Built by DanLab

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

voicepipe-1.0.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

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

voicepipe-1.0.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file voicepipe-1.0.0.tar.gz.

File metadata

  • Download URL: voicepipe-1.0.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for voicepipe-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dc8f6a0b5f1f078a8e1c19c9691469674656753e2a373249be4e564d632ab4ca
MD5 38fc12f6cdec0c0240e26ae8a8372ebe
BLAKE2b-256 b6ded4148673343c786562ebe4aad5bffdd722efcbfcce6177c469ad9b16d784

See more details on using hashes here.

File details

Details for the file voicepipe-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: voicepipe-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for voicepipe-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e126424bb15af5d64b9b74b7bf664b835979f1e28b4d5257dbaabb6d386e9902
MD5 1b2eed271b53a12a59909f933f83edb1
BLAKE2b-256 83144a6275b41666646089bb2e0ff294e72d84485d13d55704d8bb1de61b873c

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