Skip to content

v6.3.0: Voice Casting Support

Choose a tag to compare

@stovak stovak released this 15 Feb 04:47
· 15 commits to main since this release
b04d5fa

SwiftCompartido v6.3.0

🎤 Voice Casting System

This release adds comprehensive voice casting support for character-to-voice assignments, enabling SwiftHablare integration for automated audio generation workflows.

New Features

  • CharacterVoiceMapping Data Model - SwiftData model with document relationships for persistent voice assignments
  • CharacterVoiceMappingSnapshot - Codable DTO for JSON .guion file persistence
  • GuionDocumentSnapshot Casting - Added casting dictionary with helper methods (voiceMapping(for:), setVoiceMapping(_:for:))
  • App Intents for Shortcuts - GetVoiceCastingIntent and SetVoiceCastingIntent enable Shortcuts automation
  • Multi-Provider Support - Voice URI format supports macOS, ElevenLabs, OpenAI, and custom TTS providers

Voice URI Format

Standardized URI format for voice identification:

  • macOS System: macos://Samantha?lang=en
  • ElevenLabs: elevenlabs://voice-id?lang=en
  • OpenAI: openai://alloy?lang=en
  • Custom Providers: provider://identifier?lang=<languageCode>

Usage Example

// Parse screenplay and assign voices
let screenplay = try await GuionParsedElementCollection(file: "script.fountain")
var snapshot = GuionDocumentSnapshot(from: screenplay)

// Assign voice to character
let janeVoice = CharacterVoiceMappingSnapshot(
    voiceURI: "macos://Samantha?lang=en",
    voiceName: "Samantha",
    providerID: "macos"
)
snapshot.setVoiceMapping(janeVoice, for: "JANE")

// Save to .guion file
let data = try GuionJSONSerializer.encode(snapshot)
try data.write(to: url)

Shortcuts Integration

Use App Intents for automation:

  1. Extract Characters from screenplay
  2. Set Voice Casting for each character
  3. Get Voice Casting to retrieve assignments
  4. Generate audio with SwiftHablare using assigned voices

📚 Documentation Improvements

  • AGENTS.md - Universal project documentation (290 lines)
  • CLAUDE.md - Expanded with MCP server configuration (60 → 105 lines)
    • XcodeBuildMCP operations and benefits
    • App Store Connect MCP for CI/CD monitoring
    • Claude-specific build preferences
  • GEMINI.md - Added standard CLI workflows (3 → 61 lines)
    • Standard xcodebuild commands
    • Test workflows for Gemini agents
  • Clear Separation - Universal vs. agent-specific content properly organized

✅ Testing

  • Unit Tests: Full coverage for voice casting snapshots and models
  • Integration Tests: JSON round-trip fidelity, UUID preservation, large documents (1000+ elements)
  • CI/CD: All checks passing (Code Quality, macOS Unit Tests, AI Tests)
  • Test Count: 156 tests passing

🏗️ Architecture

Phase 6 File-Based Storage:

  • SwiftData models for in-memory operations
  • Codable snapshots for JSON persistence
  • Actor-isolated operations (DocumentModelActor)
  • DTO pattern prevents main thread blocking

No Breaking Changes - All existing APIs preserved, voice casting is purely additive.

🔮 What's Next

  • SwiftUI Components - Voice assignment UI (future release)
  • SwiftHablare Integration - Consume voice mappings for TTS generation
  • Voice Preview - Listen to character voices before assignment

Full Changelog: v6.2.2...v6.3.0

🤖 Generated with Claude Code