Skip to main content

Hume AI Hume AI

The HumeTTSService provides emotion-aware voice generation creating deeply empathetic and expressive agent responses. Leveraging Hume's Octave models, it allows for natural-sounding speech guided by descriptive acting directions.

Installation

To use Hume AI, install the required dependencies:

pip install "piopiy-ai[hume]"

Prerequisites

  • A Hume AI account and API key (Get yours here).
  • Set your API key in your environment:
    export HUME_API_KEY="your_api_key_here"

Configuration

HumeTTSService Parameters

ParameterTypeDefaultDescription
api_keystrRequiredYour Hume API key.
voice_idstrRequiredThe ID of the voice to use.
sample_rateint48000Audio sample rate (Hume streams at 48kHz).
paramsInputParamsInputParams()Acting directions and speed settings.

InputParams

ParameterTypeDefaultDescription
descriptionstrNoneNatural-language acting directions.
speedfloatNoneSpeaking-rate multiplier (0.5 to 2.0).
trailing_silencefloatNoneSeconds of silence to append at the end.

Usage

Basic Setup

import os
from piopiy.services.hume.tts import HumeTTSService

tts = HumeTTSService(
api_key=os.getenv("HUME_API_KEY"),
voice_id="default"
)

With Acting Directions

from piopiy.services.hume.tts import HumeTTSService

tts = HumeTTSService(
voice_id="default",
params=HumeTTSService.InputParams(
description="Speak in a warm, comforting, and empathetic tone.",
speed=0.9
)
)

Notes

  • Empathic Voice: Hume's TTS is uniquely designed to convey emotional nuance; use the description parameter to fine-tune the agent's persona.
  • Word Timestamps: Supports millisecond-precision word-level timestamps for perfect audio-text synchronization.
  • Buffering: Piopiy automatically buffers audio chunks from Hume to ensure glitch-free streaming over telephony networks.