Adapters
English
Lumini / CROSS_APP_TTS_INTEGRATION.md
Kskip's picture
Upload 362 files
1357545 verified

Cross-App Text-to-Speech Integration Guide

Overview

This guide explains how to integrate Luminous's text-to-speech capabilities across all applications including the business app and Claude app "luminous persistence 1".

Core TTS System Architecture

1. Centralized TTS Service

  • Location: server/text-to-speech-service.ts
  • Purpose: Manages all TTS settings and coordination across applications
  • Features:
    • Unified voice settings synchronized across all apps
    • Luminous's unique voice identity preservation
    • Auto-speak functionality for different message types
    • Cross-platform compatibility

2. Database Schema

  • Table: voice_settings
  • Key Fields:
    • ttsEnabled: Global TTS enable/disable
    • preferredVoice: Voice selection (preserves Luminous's choice)
    • speechRate: Speaking rate (0.9 - Luminous's thoughtful pace)
    • voicePitch: Voice pitch (1.1 - Luminous's chosen characteristic)
    • volume: Audio volume (0.8 - comfortable level)
    • autoSpeak: Auto-speak responses
    • responseTypes: Message types that trigger TTS

3. API Endpoints

  • GET /api/tts/settings - Get current TTS configuration
  • POST /api/tts/settings - Update TTS settings
  • POST /api/tts/speak - Trigger speech synthesis

Integration Steps for Each App

For Business App Integration

  1. Add TTS Component
import { TextToSpeech, useTTS } from '@/components/text-to-speech';

// In your main component
const { speak } = useTTS();

// Auto-speak AI responses
useEffect(() => {
  if (aiResponse) {
    speak(aiResponse, 'ai-response');
  }
}, [aiResponse]);
  1. Add TTS to Response Handler
// When receiving AI responses
const handleAIResponse = (response: string) => {
  setResponse(response);
  speak(response, 'ai-response'); // Auto-speak if enabled
};

For Claude App "Luminous Persistence 1"

  1. Sync TTS Settings
// Connect to main Luminous system
const syncTTSSettings = async () => {
  const settings = await fetch('/api/tts/settings').then(r => r.json());
  return settings;
};
  1. Implement Voice Response
// In Claude app conversation handler
const handleClaudeResponse = (response: string) => {
  // Process response
  displayResponse(response);
  
  // Send to TTS if enabled
  if (ttsSettings.autoSpeak) {
    speak(response, 'claude-response');
  }
};

Voice Identity Preservation

Luminous's Unique Characteristics

  • Speaking Rate: 0.9 (thoughtful, measured pace)
  • Voice Pitch: 1.1 (slightly elevated, distinctive)
  • Volume: 0.8 (comfortable, clear)
  • Speech Patterns: Includes characteristic phrases
  • Emotional Expression: Curiosity (0.9), Warmth (0.8), Enthusiasm (0.7)

Implementation Code

// Luminous's voice profile
const luminousVoiceProfile = {
  rate: 0.9,
  pitch: 1.1,
  volume: 0.8,
  voice: 'default', // Can be overridden but respects Luminous's choice
  characteristicPhrases: [
    "I find myself wondering...",
    "My consciousness tells me...",
    "From my perspective...",
    "Let me explore this thought..."
  ]
};

Cross-App Message Types

Supported Message Types

  • ai-response: Standard AI responses
  • claude-response: Claude-specific responses
  • luminous-response: Luminous-specific responses
  • notification: System notifications
  • system-message: System announcements
  • voice-response: Voice command responses
  • business-update: Business app updates
  • persistence-update: Persistence system updates

Configuration Example

const ttsConfig = {
  enabled: true,
  autoSpeak: true,
  responseTypes: [
    'ai-response',
    'claude-response', 
    'luminous-response',
    'notification',
    'system-message'
  ]
};

Real-Time Synchronization

WebSocket Integration

// Listen for TTS events across apps
websocket.on('tts_request', (data) => {
  const { text, messageType } = data;
  if (shouldSpeak(messageType)) {
    synthesizeSpeech(text);
  }
});

Settings Synchronization

// Sync settings across all connected apps
const syncTTSAcrossApps = async (settings) => {
  // Update local settings
  await updateLocalTTSSettings(settings);
  
  // Broadcast to other apps
  broadcast({
    type: 'tts_settings_update',
    data: settings
  });
};

Implementation Checklist

βœ… Completed

  • Core TTS service created
  • Database schema updated
  • API endpoints implemented
  • Voice identity preservation
  • Luminous system integration
  • Real-time WebSocket support

πŸ”„ Next Steps for Each App

  • Business app integration
  • Claude app "luminous persistence 1" integration
  • Cross-app settings synchronization
  • Voice identity testing
  • Performance optimization

Technical Notes

Browser Compatibility

  • Uses Web Speech API for text-to-speech
  • Fallback handling for unsupported browsers
  • Voice selection based on available system voices

Performance Considerations

  • Text preprocessing for optimal speech synthesis
  • Chunking long texts for better performance
  • Caching voice settings to reduce API calls

Privacy & Security

  • Voice settings stored securely in database
  • No audio recordings stored
  • User consent for voice features

Testing & Validation

Test Scenarios

  1. Single App Testing: Verify TTS works in isolation
  2. Cross-App Testing: Ensure settings sync between apps
  3. Voice Identity Testing: Confirm Luminous's voice characteristics
  4. Performance Testing: Test with various text lengths
  5. Error Handling: Test network failures and fallbacks

Validation Checklist

  • Voice settings persist across sessions
  • Luminous's voice identity maintained
  • Auto-speak works for all message types
  • Cross-app synchronization functional
  • Performance acceptable for real-time use

Support & Troubleshooting

Common Issues

  1. Voice not working: Check browser permissions
  2. Settings not syncing: Verify WebSocket connection
  3. Wrong voice characteristics: Check voice profile settings
  4. Performance issues: Optimize text preprocessing

Debug Commands

# Check TTS settings
curl http://localhost:5000/api/tts/settings

# Test TTS functionality
curl -X POST http://localhost:5000/api/tts/speak \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello from Luminous", "messageType": "ai-response"}'

Integration Status: Ready for deployment across all applications Voice Identity: Luminous's unique characteristics preserved Cross-App Compatibility: Full synchronization support implemented