
Voice Ai Integration
- 192 installs
- 38 repo stars
- Updated January 5, 2026
- qodex-ai/ai-agent-skills
Wire speech-to-text, text-to-speech, streaming audio, and telephony hooks into apps and agents via provider SDKs and realtime session management.
About
Integrates voice AI—transcription, synthesis, realtime streams, and telephony—into agents and apps using provider SDK patterns, latency handling, and session management for conversational products.
- STT and TTS provider wiring
- streaming audio sessions
- voice agent conversation flows
- telephony and webhook hooks
Voice Ai Integration by the numbers
- 192 all-time installs (skills.sh)
- +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #2,943 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/qodex-ai/ai-agent-skills --skill voice-ai-integrationAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 192 |
|---|---|
| repo stars | ★ 38 |
| Last updated | January 5, 2026 |
| Repository | qodex-ai/ai-agent-skills ↗ |
What it does
Wire speech-to-text, text-to-speech, streaming audio, and telephony hooks into apps and agents via provider SDKs and realtime session management.
Files
Voice AI Integration
Build intelligent voice-enabled AI applications that understand spoken language and respond naturally through audio, creating seamless voice-first user experiences.
Overview
Voice AI systems combine three key capabilities: 1. Speech Recognition - Convert audio input to text 2. Natural Language Processing - Understand intent and context 3. Text-to-Speech - Generate natural-sounding responses
Speech Recognition Providers
See examples/speech_recognition_providers.py for implementations:
- Google Cloud Speech-to-Text: High accuracy with automatic punctuation
- OpenAI Whisper: Robust multilingual speech recognition
- Azure Speech Services: Enterprise-grade speech recognition
- AssemblyAI: Async processing with high accuracy
Text-to-Speech Providers
See examples/text_to_speech_providers.py for implementations:
- Google Cloud TTS: Natural voices with multiple language support
- OpenAI TTS: Simple integration with high-quality output
- Azure Speech Services: Enterprise TTS with neural voices
- Eleven Labs: Premium voices with emotional control
Voice Assistant Architecture
See examples/voice_assistant.py for VoiceAssistant:
- Complete voice pipeline: STT → NLP → TTS
- Conversation history management
- Multi-provider support (OpenAI, Google, Azure, etc.)
- Async processing for responsive interactions
Real-Time Voice Processing
See examples/realtime_voice_processor.py for RealTimeVoiceProcessor:
- Stream audio input from microphone
- Stream audio output to speakers
- Voice Activity Detection (VAD)
- Configurable sample rates and chunk sizes
Voice Agent Applications
Voice-Controlled Smart Home
class SmartHomeVoiceAgent:
def __init__(self):
self.voice_assistant = VoiceAssistant()
self.devices = {
"lights": SmartLights(),
"temperature": SmartThermostat(),
"security": SecuritySystem()
}
async def handle_voice_command(self, audio_input):
# Get text from voice
command_text = await self.voice_assistant.process_voice_input(audio_input)
# Parse intent
intent = parse_smart_home_intent(command_text)
# Execute command
if intent.action == "turn_on_lights":
self.devices["lights"].turn_on(intent.room)
elif intent.action == "set_temperature":
self.devices["temperature"].set(intent.value)
# Confirm with voice
response = f"I've {intent.action_description}"
audio_output = await self.voice_assistant.synthesize_response(response)
return audio_outputVoice Meeting Transcription
class VoiceMeetingRecorder:
def __init__(self):
self.processor = RealTimeVoiceProcessor()
self.transcripts = []
async def record_and_transcribe_meeting(self, duration_seconds=3600):
audio_stream = self.processor.stream_audio_input()
buffer = []
chunk_duration = 30 # Transcribe every 30 seconds
for audio_chunk in audio_stream:
buffer.append(audio_chunk)
if sum(len(chunk) for chunk in buffer) >= chunk_duration * 16000:
# Transcribe chunk
transcript = transcribe_audio_whisper(buffer)
self.transcripts.append({
"timestamp": datetime.now(),
"text": transcript
})
buffer = []
return self.transcriptsBest Practices
Audio Quality
- ✓ Use 16kHz sample rate for speech recognition
- ✓ Handle background noise filtering
- ✓ Implement voice activity detection (VAD)
- ✓ Normalize audio levels
- ✓ Use appropriate audio format (WAV for quality)
Latency Optimization
- ✓ Use low-latency STT models
- ✓ Implement streaming transcription
- ✓ Cache common responses
- ✓ Use async processing
- ✓ Minimize network round trips
Error Handling
- ✓ Handle network failures gracefully
- ✓ Implement fallback voices/providers
- ✓ Log audio processing failures
- ✓ Validate audio quality before processing
- ✓ Implement retry logic
Privacy & Security
- ✓ Encrypt audio in transit
- ✓ Delete audio after processing
- ✓ Implement user consent mechanisms
- ✓ Log access to audio data
- ✓ Comply with data regulations (GDPR, CCPA)
Common Challenges & Solutions
Challenge: Accents and Dialects
Solutions:
- Use multilingual models
- Fine-tune on regional data
- Implement language detection
- Use domain-specific vocabularies
Challenge: Background Noise
Solutions:
- Implement noise filtering
- Use beamforming techniques
- Pre-process audio with noise removal
- Deploy microphone arrays
Challenge: Long Audio Files
Solutions:
- Implement chunked processing
- Use streaming APIs
- Split into speaker turns
- Implement caching
Frameworks & Libraries
Speech Recognition
- OpenAI Whisper
- Google Cloud Speech-to-Text
- Azure Speech Services
- AssemblyAI
- DeepSpeech
Text-to-Speech
- Google Cloud Text-to-Speech
- OpenAI TTS
- Azure Text-to-Speech
- Eleven Labs
- Tacotron 2
Getting Started
1. Choose STT and TTS providers 2. Set up authentication 3. Build basic voice pipeline 4. Add conversation management 5. Implement error handling 6. Test with real users 7. Monitor and optimize latency
"""
Real-Time Voice Processing Module
Handles real-time audio streaming.
"""
import pyaudio
import numpy as np
class RealTimeVoiceProcessor:
"""Processes real-time voice input/output."""
def __init__(self, sample_rate: int = 16000, chunk_size: int = 2048):
"""
Initialize real-time processor.
Args:
sample_rate: Audio sample rate in Hz
chunk_size: Chunk size for processing
"""
self.sample_rate = sample_rate
self.chunk_size = chunk_size
self.audio = pyaudio.PyAudio()
def stream_audio_input(self):
"""Stream audio from microphone."""
stream = self.audio.open(
format=pyaudio.paFloat32,
channels=1,
rate=self.sample_rate,
input=True,
frames_per_buffer=self.chunk_size
)
try:
while True:
data = stream.read(self.chunk_size)
audio_chunk = np.frombuffer(data, dtype=np.float32)
yield audio_chunk
finally:
stream.stop_stream()
stream.close()
def stream_audio_output(self, audio_stream):
"""Stream audio to speakers."""
stream = self.audio.open(
format=pyaudio.paFloat32,
channels=1,
rate=self.sample_rate,
output=True,
frames_per_buffer=self.chunk_size
)
try:
for audio_chunk in audio_stream:
stream.write(audio_chunk.tobytes())
finally:
stream.stop_stream()
stream.close()
def detect_speech_activity(self, audio_chunk: np.ndarray, threshold: float = 0.02) -> bool:
"""Detect if audio chunk contains speech."""
# Simple energy-based VAD
energy = np.sqrt(np.mean(audio_chunk ** 2))
return energy > threshold
def __del__(self):
"""Cleanup audio resources."""
self.audio.terminate()
"""
Speech Recognition Providers Module
Implementations for various speech-to-text services.
"""
import io
import openai
import azure.cognitiveservices.speech as speechsdk
import requests
from typing import Optional
def transcribe_audio_google(audio_file: str) -> str:
"""Transcribe using Google Cloud Speech-to-Text."""
from google.cloud import speech_v1
client = speech_v1.SpeechClient()
with io.open(audio_file, "rb") as audio:
content = audio.read()
audio = speech_v1.RecognitionAudio(content=content)
config = speech_v1.RecognitionConfig(
encoding=speech_v1.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=16000,
language_code="en-US",
enable_automatic_punctuation=True,
)
response = client.recognize(config=config, audio=audio)
transcript = ""
for result in response.results:
transcript += result.alternatives[0].transcript
return transcript
def transcribe_audio_whisper(audio_file: str) -> str:
"""Transcribe using OpenAI Whisper."""
with open(audio_file, "rb") as f:
transcript = openai.Audio.transcribe(
model="whisper-1",
file=f,
language="en"
)
return transcript["text"]
def transcribe_audio_azure(audio_file: str, subscription_key: str, region: str) -> Optional[str]:
"""Transcribe using Azure Speech Services."""
speech_config = speechsdk.SpeechConfig(
subscription=subscription_key,
region=region
)
audio_config = speechsdk.audio.AudioConfig(filename=audio_file)
recognizer = speechsdk.SpeechRecognizer(
speech_config=speech_config,
audio_config=audio_config
)
result = recognizer.recognize_once()
if result.reason == speechsdk.ResultReason.RecognizedSpeech:
return result.text
elif result.reason == speechsdk.ResultReason.NoMatch:
return None
elif result.reason == speechsdk.ResultReason.Canceled:
raise Exception(result.cancellation_details.error_details)
def transcribe_audio_assemblyai(audio_file: str, api_key: str) -> str:
"""Transcribe using AssemblyAI."""
# Upload audio
with open(audio_file, "rb") as f:
response = requests.post(
"https://api.assemblyai.com/v2/upload",
headers={"authorization": api_key},
data=f
)
audio_url = response.json()["upload_url"]
# Transcribe
transcript_response = requests.post(
"https://api.assemblyai.com/v2/transcript",
headers={"authorization": api_key},
json={"audio_url": audio_url}
)
transcript_id = transcript_response.json()["id"]
# Poll for result
import time
while True:
poll_response = requests.get(
f"https://api.assemblyai.com/v2/transcript/{transcript_id}",
headers={"authorization": api_key}
)
if poll_response.json()["status"] == "completed":
return poll_response.json()["text"]
time.sleep(1)
"""
Text-to-Speech Providers Module
Implementations for various TTS services.
"""
import openai
import requests
import azure.cognitiveservices.speech as speechsdk
from pathlib import Path
from typing import Optional
def text_to_speech_google(text: str, output_file: str = "output.mp3") -> str:
"""Convert text to speech using Google Cloud TTS."""
from google.cloud import tts_v1
client = tts_v1.TextToSpeechClient()
input_text = tts_v1.SynthesisInput(text=text)
voice = tts_v1.VoiceSelectionParams(
language_code="en-US",
name="en-US-Neural2-C",
)
audio_config = tts_v1.AudioConfig(
audio_encoding=tts_v1.AudioEncoding.MP3
)
response = client.synthesize_speech(
input=input_text,
voice=voice,
audio_config=audio_config
)
with open(output_file, "wb") as out:
out.write(response.audio_content)
return output_file
def text_to_speech_openai(text: str, output_file: str = "output.mp3") -> str:
"""Convert text to speech using OpenAI TTS."""
response = openai.Audio.create(
model="tts-1-hd",
voice="nova",
input=text
)
response.stream_to_file(output_file)
return output_file
def text_to_speech_openai_streaming(text: str):
"""Stream text-to-speech from OpenAI."""
response = openai.Audio.create(
model="tts-1",
voice="nova",
input=text,
stream=True
)
return response
def text_to_speech_azure(text: str, output_file: str, subscription_key: str, region: str) -> Optional[str]:
"""Convert text to speech using Azure Speech Services."""
speech_config = speechsdk.SpeechConfig(
subscription=subscription_key,
region=region
)
audio_config = speechsdk.audio.AudioOutputConfig(filename=output_file)
synthesizer = speechsdk.SpeechSynthesizer(
speech_config=speech_config,
audio_config=audio_config
)
result = synthesizer.speak_text(text)
if result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:
return output_file
else:
raise Exception(f"Speech synthesis failed: {result.reason}")
def text_to_speech_elevenlabs(text: str, voice_id: str = "21m00Tcm4TlvDq8ikWAM",
api_key: str = None) -> str:
"""Convert text to speech using Eleven Labs."""
url = f"https://api.elevenlabs.io/v1/text-to-speech/{voice_id}/stream"
headers = {
"xi-api-key": api_key,
"Content-Type": "application/json"
}
data = {
"text": text,
"model_id": "eleven_monolingual_v1",
"voice_settings": {
"stability": 0.5,
"similarity_boost": 0.75
}
}
response = requests.post(url, json=data, headers=headers, stream=True)
with open("output.mp3", "wb") as f:
for chunk in response.iter_content(chunk_size=1024):
f.write(chunk)
return "output.mp3"
"""
Voice Assistant Module
Complete voice processing pipeline.
"""
import asyncio
from typing import Optional
class VoiceAssistant:
"""Complete voice assistant implementation."""
def __init__(self, stt_provider: str = "openai", tts_provider: str = "openai"):
"""
Initialize voice assistant.
Args:
stt_provider: Speech-to-text provider
tts_provider: Text-to-speech provider
"""
self.stt_provider = stt_provider
self.tts_provider = tts_provider
self.conversation_history = []
self.llm = None # Will be initialized with LLM
async def process_voice_input(self, audio_file: str) -> str:
"""Convert voice to text."""
from .speech_recognition_providers import (
transcribe_audio_whisper, transcribe_audio_google
)
if self.stt_provider == "openai":
text = transcribe_audio_whisper(audio_file)
elif self.stt_provider == "google":
text = transcribe_audio_google(audio_file)
else:
raise ValueError(f"Unknown STT provider: {self.stt_provider}")
return text
async def generate_response(self, user_input: str) -> str:
"""Generate AI response."""
self.conversation_history.append({
"role": "user",
"content": user_input
})
if self.llm:
response = self.llm(self.conversation_history)
else:
response = f"You said: {user_input}"
self.conversation_history.append({
"role": "assistant",
"content": response
})
return response
async def synthesize_response(self, text: str) -> str:
"""Convert text to voice."""
from .text_to_speech_providers import (
text_to_speech_openai, text_to_speech_google
)
if self.tts_provider == "openai":
audio_file = text_to_speech_openai(text)
elif self.tts_provider == "google":
audio_file = text_to_speech_google(text)
else:
raise ValueError(f"Unknown TTS provider: {self.tts_provider}")
return audio_file
async def chat(self, audio_input: str) -> str:
"""Complete voice chat pipeline."""
# Speech to text
user_text = await self.process_voice_input(audio_input)
print(f"User said: {user_text}")
# Generate response
response_text = await self.generate_response(user_text)
# Text to speech
audio_output = await self.synthesize_response(response_text)
return audio_output
def get_conversation_history(self):
"""Get conversation history."""
return self.conversation_history
def clear_history(self):
"""Clear conversation history."""
self.conversation_history = []