The service automatically selects voices based on simulation outcomes:From /home/daytona/workspace/source/apps/api/src/services/elevenLabsService.ts:186-197:
selectVoiceByOutcome(successProbability: number): VoiceName { if (successProbability >= 0.75) { // Great news! Excited, celebratory return 'josh' } else if (successProbability >= 0.50) { // Decent odds, encouraging and confident return 'adam' } else { // Tough situation, empathetic and supportive return 'bella' }}
ElevenLabs pronounces formatted numbers more naturally when converted to words:From /home/daytona/workspace/source/apps/api/src/services/elevenLabsService.ts:199-246:
private numbersToWords(text: string): string { let result = text // Handle full words: "$30 million", "$30 billion", "$30 thousand" result = result.replace(/\$(\d+(?:\.\d+)?)\s*billion/gi, (_, num) => { return this.numberToSpoken(parseFloat(num), 'billion') }) result = result.replace(/\$(\d+(?:\.\d+)?)\s*million/gi, (_, num) => { return this.numberToSpoken(parseFloat(num), 'million') }) // Handle abbreviations: $1.5M, $25K, $100B result = result.replace(/\$(\d+(?:\.\d+)?)\s*M(?![a-z])/gi, (_, num) => { return this.numberToSpoken(parseFloat(num), 'million') }) result = result.replace(/\$(\d+(?:\.\d+)?)\s*K(?![a-z])/gi, (_, num) => { return this.numberToSpoken(parseFloat(num), 'thousand') }) // Plain $XX,XXX patterns (with commas) result = result.replace(/\$(\d{1,3}(?:,\d{3})+)/g, (_, num) => { const value = parseInt(num.replace(/,/g, '')) return this.dollarAmountToSpoken(value) }) // Percentages: 73% → "seventy-three percent" result = result.replace(/(\d+(?:\.\d+)?)\s*%/g, (_, num) => { const value = parseFloat(num) if (Number.isInteger(value)) { return `${this.intToWords(value)} percent` } return `${value} percent` }) return result}
stability (0.25): Low for expressive, energetic delivery
similarity_boost (0.85): High for voice consistency
style (0.8): High for engaging, exciting narration
use_speaker_boost: Enhances clarity and presence
These settings optimize for financial briefings where clarity and engagement are critical. Adjust stability higher (0.5-0.75) for more formal, calm delivery.
Great news! Based on 100,000 simulations of your financial future, you have a 73% chance of reaching your $500K retirement goal in 15 years.Your most likely outcome is $520,000, comfortably above your target. In the worst 10% of scenarios, you'd still have $380,000, while the best 10% could see you reach $720,000 or more.To maintain these strong odds, stay consistent with your current savings rate and consider small spending adjustments if market conditions change.
Audio Output:
Voice: Josh (success ≥75%)
Duration: ~25 seconds
Format: MP3, base64-encoded
Narrative text is generated by the LLM service (Gemini or GPT) before being converted to speech. See the AI service documentation for customization.