음성 디자인

음성 디자인

Voice design을 사용하면 Gemini API Voices 엔드포인트(POST /v1beta/voices)를 통해 자연어 설명에서 완전히 새로운, 지속적인 보컬 페르소나를 만들 수 있어요. 미리 만들어진 음성으로 제한되거나 참조 오디오를 녹음하는 대신, 캐릭터의 나이, 음색, 억양, 기본 전달 방식을 설명하면 재사용 가능한 voice_... ID를 받아 프로젝트에 저장할 수 있어요.

커스텀 음성을 설계, 청취, 반복 개선하는 가장 빠른 방법은 Google AI Studio의 대화형 Voice Design 스튜디오예요. 텍스트 프롬프트로 커스텀 페르소나를 생성하고, 샘플 스크립트로 테스트하고, 결과 voice_... ID를 애플리케이션 코드에 직접 복사할 수 있어요.

Google AI Studio에서 사용해 보세요.

Gemini 3.8 Flash TTS(gemini-3.8-flash-tts)와 Gemini 3.8 Flash-Lite TTS(gemini-3.8-flash-lite-tts) 모두 Voice design을 지원해요.

출처: 원문

본문

설계된 음성 만들기

Google GenAI SDK(google-genai 2.25.0+ / @google/genai 2.24.0+) 또는 REST API를 사용해 텍스트 설명에서 커스텀 음성을 만들 수 있어요. "prompted" 음성의 경우 voices.create(CreateVoice)와 voices.get(GetVoice) 모두 생성된 음성을 즉시 청취할 수 있도록 출력 전용 sample_audio 필드(mime_type: "audio/wav", base64 인코딩 data)를 반환해요.

import base64
from google import genai

client = genai.Client()

# 1. Design a custom voice persona from natural language
created_voice = client.voices.create(
    store=True,
    voice={
        "model": "gemini-3.8-flash-tts",
        "type": "prompted",
        "display_name": "Warm British Astronomer",
        "gender": "male",
        "language_code": "en-GB",
        "prompted": {
            "input": (
                "A warm, thoughtful astronomer in his late 60s with a gentle"
                " British accent, speaking with quiet wonder."
            )
        },
    },
)

print(f"Created voice ID: {created_voice.id}")

# Save the generated sample_audio preview (audio/wav) returned by CreateVoice
if created_voice.sample_audio and created_voice.sample_audio.data:
    with open("voice_preview.wav", "wb") as f:
        f.write(base64.b64decode(created_voice.sample_audio.data))
import * as fs from "node:fs";
import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI();

// 1. Design a custom voice persona from natural language
const createdVoice = await ai.voices.create({
  store: true,
  voice: {
    model: "gemini-3.8-flash-tts",
    type: "prompted",
    display_name: "Warm British Astronomer",
    gender: "male",
    language_code: "en-GB",
    prompted: {
      input:
        "A warm, thoughtful astronomer in his late 60s with a gentle British accent, speaking with quiet wonder.",
    },
  },
});

console.log(`Created voice ID: ${createdVoice.id}`);

// Save the generated sample_audio preview (audio/wav) returned by CreateVoice
if (createdVoice.sample_audio?.data) {
  fs.writeFileSync(
    "voice_preview.wav",
    Buffer.from(createdVoice.sample_audio.data, "base64")
  );
}
curl "https://generativelanguage.googleapis.com/v1beta/voices" \
  -H "x-goog-api-key: *** \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{
    "store": true,
    "voice": {
      "model": "gemini-3.8-flash-tts",
      "type": "prompted",
      "display_name": "Warm British Astronomer",
      "gender": "male",
      "language_code": "en-GB",
      "prompted": {
        "input": "A warm, thoughtful astronomer in his late 60s with a gentle British accent, speaking with quiet wonder."
      }
    }
  }' | tee created_voice.json | jq -r '.sample_audio.data' | base64 --decode > voice_preview.wav

Voice design의 작동 방식

  1. 프롬프트 음성 만들기: type="prompted"와 store=True로 voices.create(POST /v1beta/voices)를 호출해요.
  2. 지속적인 voice_id와 sample_audio 미리보기 받기: API가 보컬 정체성을 생성해 프로젝트에 저장하고, 음성의 생성된 미리보기 오디오가 담긴 sample_audio(mime_type: "audio/wav", base64 인코딩 data)와 함께 영구 ID(예: voice_abc123...)를 반환해요.
  3. 음성 합성: generateContent 호출 시 speechConfig.voiceConfig.voice에 voice_id를 전달해요.

설계된 음성으로 음성 합성

generateContent 호출 시 반환된 id(voice_...)를 voiceConfig.voice에 전달해요.

from google import genai

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3.8-flash-tts",
    contents=[{
        "role": "user",
        "parts": [{
            "text": (
                "Look out past the rings of Saturn. Those faint photons left"
                " their source millions of years ago."
            ),
            "speech_metadata": {"style": "reflective and awe-inspired"},
        }],
    }],
    config={
        "response_modalities": ["AUDIO"],
        "speech_config": {
            "voice_config": {"voice": created_voice.id}
        },
    },
)

audio_bytes = response.candidates[0].content.parts[0].inline_data.data
with open("designed_voice.wav", "wb") as f:
    f.write(audio_bytes)
import * as fs from "node:fs";
import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI();

const response = await ai.models.generateContent({
  model: "gemini-3.8-flash-tts",
  contents: [{
    role: "user",
    parts: [{
      text: "Look out past the rings of Saturn. Those faint photons left their source millions of years ago.",
      speechMetadata: { style: "reflective and awe-inspired" },
    }],
  }],
  config: {
    responseModalities: ["AUDIO"],
    speechConfig: {
      voiceConfig: { voice: createdVoice.id },
    },
  },
});

const data = response.candidates?.[0]?.content?.parts?.[0]?.inlineData?.data;
if (data) {
  fs.writeFileSync("designed_voice.wav", Buffer.from(data, "base64"));
}
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash-tts:generateContent" \
  -H "x-goog-api-key: *** \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [{
        "text": "Look out past the rings of Saturn. Those faint photons left their source millions of years ago.",
        "speech_metadata": {
          "style": "reflective and awe-inspired"
        }
      }]
    }],
    "generationConfig": {
      "responseModalities": ["AUDIO"],
      "speechConfig": {
        "voiceConfig": {
          "voice": "voice_YOUR_DESIGNED_VOICE_ID"
        }
      }
    }
  }'

음성 관리

Voices API를 사용해 언제든지 저장된 음성을 나열, 필터링, 검사, 삭제할 수 있어요(모든 필터 매개변수는 확장 음성 라이브러리 및 필터링 참조).

  • 저장 한도 및 TTL: 상태 저장 음성(store=True, prompted 및 replicated 음성에 걸쳐 공유)은 프로젝트당 200개 한도와 1년 TTL(수명)을 가져요.
  • sample_audio 가용성: voices.create()(CreateVoice)와 voices.get()(GetVoice)는 "prompted" 음성에 대해 sample_audio(mime_type: "audio/wav", base64 인코딩 data)를 채워요. 목록을 가볍게 유지하기 위해 voices.list()(ListVoices)는 sample_audio를 생략해요("replicated" 및 "prebuilt" 음성에서는 sample_audio가 설정되지 않아요).
from google import genai

client = genai.Client()

# List stored prompted voices in your project filtered by language
response = client.voices.list(
    type_=["prompted"],
    language_code=["en-US", "en-GB"],
)
for voice in response.voices or []:
    print(voice.id, voice.display_name, voice.type)

# Retrieve a specific voice by ID
voice_details = client.voices.get(id=created_voice.id)

# Delete a stored custom voice
client.voices.delete(id=created_voice.id)
import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI();

// List stored prompted voices in your project filtered by language
const response = await ai.voices.list({
  type: ["prompted"],
  language_code: ["en-US", "en-GB"],
});
for (const voice of response.voices ?? []) {
  console.log(voice.id, voice.display_name, voice.type);
}

// Retrieve a specific voice by ID
const voiceDetails = await ai.voices.get(createdVoice.id);

// Delete a stored custom voice
await ai.voices.delete(createdVoice.id);
# List stored prompted voices filtered by language
curl -G "https://generativelanguage.googleapis.com/v1beta/voices" \
  -H "x-goog-api-key: *** \
  --data-urlencode "type=prompted" \
  --data-urlencode "language_code=en-US" \
  --data-urlencode "language_code=en-GB"

# Retrieve a specific voice by ID
curl "https://generativelanguage.googleapis.com/v1beta/voices/voice_YOUR_DESIGNED_VOICE_ID" \
  -H "x-goog-api-key: ***

# Delete a stored custom voice
curl -X DELETE "https://generativelanguage.googleapis.com/v1beta/voices/voice_YOUR_DESIGNED_VOICE_ID" \
  -H "x-goog-api-key: ***

Voice design 프롬프트 모범 사례

  • 영구적인 보컬 특성은 Voice design에, 스타일은 프롬프트에 두지 마세요: voices.create에서 음성을 만들 때 나이, 성별, 음색, 보컬 텍스처, 지역 억양 같은 불변 특성을 정의해요.
  • speech_metadata.style은 상황별 감정에 예약하세요: 커스텀 음성을 만든 뒤에는 "whispered urgently"나 "cheerful and energetic" 같은 짧은 style 프롬프트를 사용해 스피커의 핵심 정체성을 바꾸지 않고 턴마다 연기를 조절해요.
  • 구체적이고 간결하게: 1~2문장의 명확한 설명(예: "약간 중서부 억양을 가진 30대의 또렷하고 활기찬 스포츠 아나운서")은 모순되거나 지나치게 긴 문단보다 더 깔끔하고 일관된 결과를 만들어요.

다음 단계

더 알아보기 (Learn more)