|
| 1 | +package cmd |
| 2 | + |
| 3 | +import ( |
| 4 | + "fmt" |
| 5 | + |
| 6 | + "github.com/spf13/cobra" |
| 7 | +) |
| 8 | + |
| 9 | +var geminiGuideCmd = &cobra.Command{ |
| 10 | + Use: "gemini-guide", |
| 11 | + Short: "Gemini TTS voice steering and prompting guide", |
| 12 | + Long: "Show detailed guide for Gemini TTS --style prompting, bracket tags, and best practices.", |
| 13 | + Run: func(cmd *cobra.Command, args []string) { |
| 14 | + fmt.Print(geminiGuideText) |
| 15 | + }, |
| 16 | +} |
| 17 | + |
| 18 | +func init() { |
| 19 | + rootCmd.AddCommand(geminiGuideCmd) |
| 20 | +} |
| 21 | + |
| 22 | +const geminiGuideText = ` |
| 23 | +GEMINI TTS VOICE STEERING GUIDE |
| 24 | +================================ |
| 25 | +
|
| 26 | +Gemini TTS voices (bare names like Achernar, Kore, Puck) support voice steering |
| 27 | +via the --style flag when using GCP OAuth2 authentication. |
| 28 | +
|
| 29 | + prompt-tools speak "Hello world" --voice Achernar \ |
| 30 | + --style "speak warmly and professionally" -o hello.wav |
| 31 | +
|
| 32 | +
|
| 33 | +REQUIREMENTS |
| 34 | +------------ |
| 35 | + - GCP OAuth2 auth: gcloud auth application-default login |
| 36 | + - Gemini voice (bare name, not en-US-Chirp3-HD-*) |
| 37 | + - --style flag sets the "prompt" field in the Cloud TTS API |
| 38 | +
|
| 39 | +
|
| 40 | +THE THREE LEVERS OF SPEECH CONTROL |
| 41 | +----------------------------------- |
| 42 | +For best results, align all three: |
| 43 | +
|
| 44 | + 1. Style Prompt (--style) — overall emotional tone and delivery |
| 45 | + 2. Text Content — the semantic meaning of the words |
| 46 | + 3. Bracket Tags — localized modifications within the text |
| 47 | +
|
| 48 | +A scared style prompt works best with text like "I think someone is in the house." |
| 49 | +A scared style prompt with "The meeting is at 4 PM." will produce ambiguous results. |
| 50 | +
|
| 51 | +
|
| 52 | +STYLE PROMPT EXAMPLES |
| 53 | +--------------------- |
| 54 | +The --style flag accepts natural language instructions: |
| 55 | +
|
| 56 | + --style "Say the following in a curious way" |
| 57 | + --style "Say the following in an elated way" |
| 58 | + --style "You are having a casual conversation with a friend. Say the following in a friendly and amused way." |
| 59 | + --style "Narrate in a calm, professional tone for a documentary." |
| 60 | + --style "You are an AI assistant speaking in a friendly and helpful tone." |
| 61 | + --style "Narrate this in the calm, authoritative tone of a nature documentary narrator." |
| 62 | +
|
| 63 | +The more specific your style prompt, the more reliable the result. |
| 64 | +
|
| 65 | +
|
| 66 | +BRACKET TAGS |
| 67 | +------------ |
| 68 | +Bracket tags like [sigh] can be embedded directly in the text for localized effects. |
| 69 | +
|
| 70 | + Non-speech sounds (inserted inline): |
| 71 | + [sigh] Insert a sigh sound |
| 72 | + [laughing] Insert a laugh |
| 73 | + [uhm] Insert a hesitation sound |
| 74 | +
|
| 75 | + Style modifiers (affect subsequent speech): |
| 76 | + [sarcasm] Sarcastic tone on the next phrase |
| 77 | + [robotic] Robotic-sounding speech |
| 78 | + [shouting] Increased volume |
| 79 | + [whispering] Decreased volume |
| 80 | + [extremely fast] Increased speed |
| 81 | +
|
| 82 | + Pacing and pauses: |
| 83 | + [short pause] Brief pause, like a comma (~250ms) |
| 84 | + [medium pause] Standard pause, like a sentence break (~500ms) |
| 85 | + [long pause] Dramatic pause (~1000ms+) |
| 86 | +
|
| 87 | + Vocalized markup (the tag word is spoken, and tone changes): |
| 88 | + [scared] Word "scared" is spoken; sentence adopts scared tone |
| 89 | + [curious] Word "curious" is spoken; sentence adopts curious tone |
| 90 | + [bored] Word "bored" is spoken; sentence adopts bored tone |
| 91 | + Note: because the tag word itself is spoken, this mode may be undesired |
| 92 | + for most use cases. |
| 93 | +
|
| 94 | +Examples: |
| 95 | + prompt-tools speak "[extremely fast] Terms and conditions may apply." \ |
| 96 | + --voice Achernar --style "Read the following disclaimer" -o disclaimer.wav |
| 97 | +
|
| 98 | + prompt-tools speak "The answer is... [long pause] ...no." \ |
| 99 | + --voice Kore --style "Speak dramatically" -o dramatic.wav |
| 100 | +
|
| 101 | + prompt-tools speak "OK, so... tell me about this [uhm] AI thing." \ |
| 102 | + --voice Puck --style "Say the following in a curious way" -o curious.wav |
| 103 | +
|
| 104 | +
|
| 105 | +BEST PRACTICES |
| 106 | +-------------- |
| 107 | + - Write specific, detailed prompts — vague prompts produce vague results. |
| 108 | + - Use emotionally rich text — don't rely on prompts and tags alone. |
| 109 | + - Align style, text, and tags — all three should be semantically consistent. |
| 110 | + - Test new tag/prompt combinations before deploying to production. |
| 111 | + - Tag behavior is not always predictable for untested combinations. |
| 112 | +
|
| 113 | +
|
| 114 | +LIMITS |
| 115 | +------ |
| 116 | + - Text field: max 4,000 bytes |
| 117 | + - Style prompt: max 4,000 bytes |
| 118 | + - Combined: max 8,000 bytes |
| 119 | + - Output audio: max ~655 seconds (truncated if exceeded) |
| 120 | +
|
| 121 | +
|
| 122 | +SUPPORTED LANGUAGES (GA) |
| 123 | +------------------------- |
| 124 | + ar-EG Arabic (Egypt) mr-IN Marathi (India) |
| 125 | + bn-BD Bangla (Bangladesh) pl-PL Polish (Poland) |
| 126 | + de-DE German (Germany) pt-BR Portuguese (Brazil) |
| 127 | + en-IN English (India) ro-RO Romanian (Romania) |
| 128 | + en-US English (United States) ru-RU Russian (Russia) |
| 129 | + es-ES Spanish (Spain) ta-IN Tamil (India) |
| 130 | + fr-FR French (France) te-IN Telugu (India) |
| 131 | + hi-IN Hindi (India) th-TH Thai (Thailand) |
| 132 | + id-ID Indonesian (Indonesia) tr-TR Turkish (Turkey) |
| 133 | + it-IT Italian (Italy) uk-UA Ukrainian (Ukraine) |
| 134 | + ja-JP Japanese (Japan) vi-VN Vietnamese (Vietnam) |
| 135 | + ko-KR Korean (South Korea) |
| 136 | + nl-NL Dutch (Netherlands) |
| 137 | +
|
| 138 | + 60+ additional languages available in preview, including: |
| 139 | + cmn-CN Mandarin (China) en-AU English (Australia) |
| 140 | + cmn-TW Mandarin (Taiwan) en-GB English (United Kingdom) |
| 141 | + fr-CA French (Canada) es-MX Spanish (Mexico) |
| 142 | +
|
| 143 | +Use --language to set the language code for Gemini voices: |
| 144 | + prompt-tools speak "Bonjour le monde" --voice Achernar --language fr-FR -o bonjour.wav |
| 145 | +
|
| 146 | +
|
| 147 | +BULK PROCESSING |
| 148 | +--------------- |
| 149 | +Style and Language columns are supported in bulk spreadsheets (columns H and I): |
| 150 | +
|
| 151 | + Filename | Voice | Text | ... | Style | Language |
| 152 | + welcome.wav | Achernar | Welcome to... | ... | speak warmly | en-US |
| 153 | + bonjour.wav | Kore | Bonjour le... | ... | ton chaleureux | fr-FR |
| 154 | +
|
| 155 | +See: prompt-tools bulk template --output template.xlsx |
| 156 | +
|
| 157 | +
|
| 158 | +OFFICIAL DOCUMENTATION |
| 159 | +---------------------- |
| 160 | + https://cloud.google.com/text-to-speech/docs/gemini-tts |
| 161 | +
|
| 162 | +` |
0 commit comments