> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Runway 音声を吹き替える

> Runway API を使用して、話し声の音声を対象言語に翻訳します。

`POST /runwayml/v1/voice_dubbing` を使用して、話し声の音声を別の
言語に翻訳します。モデル ID には `eleven_voice_dubbing` を使用します。
CometAPI API キーを Bearer 認証と JSON リクエスト本文で送信します。

## 音声と対象言語を指定する

`audioUri` には、ソース音声のアクセス可能な HTTPS URL を設定します。
`targetLang` には宛先言語コードを設定します。たとえば、スペイン語の場合は `es`
、フランス語の場合は `fr` を指定します。リクエストスキーマからサポートされているコードを選択してください。

このリクエストには `model`、`audioUri`、および `targetLang` が必要です。
サンプルの音声 URL をソースファイルに置き換えます。

## 吹き替えを設定する

| フィールド                 | 操作                                      |
| --------------------- | --------------------------------------- |
| `disableVoiceCloning` | `true` を設定すると、ソース音声を複製する代わりに汎用音声を使用します。 |
| `dropBackgroundAudio` | `true` を設定すると、吹き替え出力から背景音声を削除します。       |
| `numSpeakers`         | ソース話者数には正の整数を指定するか、自動検出する場合は省略します。      |

ブール値のコントロールを省略すると、モデルのデフォルト設定が使用されます。`false` を送信した場合も
デフォルト設定が使用されます。

## 結果を取得する

返された `id` を保存し、次に [Runway タスクを取得](./runway-to-get-task-details)
してタスクのステータスを取得します。`status` が `SUCCEEDED` の場合、音声 URL は次にあります：
`output`。タスクが失敗した場合は、`failure` と `failureCode` を確認します。


## OpenAPI

````yaml api/openapi/video/runway/official-format/post-dub-audio.openapi.json POST /runwayml/v1/voice_dubbing
openapi: 3.1.0
info:
  title: Dub Runway audio API
  version: 1.0.0
  description: Translate spoken audio into a target language with the Runway API.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /runwayml/v1/voice_dubbing:
    post:
      summary: Dub Runway audio
      description: >-
        Translate spoken audio into a target language with the Runway API. Save
        the returned id and retrieve the task to obtain its output.
      operationId: runway_voice_dubbing
      requestBody:
        required: true
        content:
          application/json:
            schema:
              title: eleven_voice_dubbing
              type: object
              properties:
                model:
                  type: string
                  const: eleven_voice_dubbing
                  enum:
                    - eleven_voice_dubbing
                  description: Model ID for this request.
                audioUri:
                  description: Audio input as an accessible HTTPS URL or base64 data URI.
                  anyOf:
                    - description: Accessible HTTPS URL of the audio file.
                      type: string
                      minLength: 13
                      maxLength: 2048
                      pattern: ^https:\/\/.*
                    - description: Base64 audio data URI, up to 5 MB.
                      type: string
                      minLength: 13
                      maxLength: 5242880
                      pattern: ^data:audio\/.*
                targetLang:
                  description: >-
                    The target language code to dub the audio to (e.g., "es" for
                    Spanish, "fr" for French).
                  type: string
                  enum:
                    - en
                    - hi
                    - pt
                    - zh
                    - es
                    - fr
                    - de
                    - ja
                    - ar
                    - ru
                    - ko
                    - id
                    - it
                    - nl
                    - tr
                    - pl
                    - sv
                    - fil
                    - ms
                    - ro
                    - uk
                    - el
                    - cs
                    - da
                    - fi
                    - bg
                    - hr
                    - sk
                    - ta
                disableVoiceCloning:
                  description: >-
                    Set true to use a generic voice instead of cloning the
                    source voice. Omit or use false for the model default.
                  type: boolean
                dropBackgroundAudio:
                  description: >-
                    Set true to remove background audio from the dubbed output.
                    Omit or use false for the model default.
                  type: boolean
                numSpeakers:
                  description: >-
                    Number of speakers in the source audio. Supply a positive
                    integer or omit it for automatic detection.
                  type: integer
                  exclusiveMinimum: 0
                  maximum: 9007199254740991
              required:
                - audioUri
                - targetLang
                - model
              additionalProperties: false
              description: Request settings for eleven_voice_dubbing.
              default:
                model: eleven_voice_dubbing
                audioUri: https://your-audio-host/source-speech.mp3
                targetLang: es
            examples:
              eleven_voice_dubbing:
                summary: eleven_voice_dubbing
                value:
                  model: eleven_voice_dubbing
                  audioUri: https://your-audio-host/source-speech.mp3
                  targetLang: es
      responses:
        '200':
          description: Task created. Save the returned id to retrieve task status.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Task ID for GET /runwayml/v1/tasks/{id}.
                  status:
                    type: string
                    description: Task state, when returned.
                  createdAt:
                    type: string
                    description: Task submission timestamp, when returned.
                    format: date-time
                  output:
                    type: array
                    description: Result URLs, when returned.
                    items:
                      type: string
                      format: uri
                  failure:
                    type: string
                    description: Failure explanation, when returned.
                  failureCode:
                    type: string
                    description: Machine-readable failure code, when returned.
                  estimatedCost:
                    type: object
                    description: Task estimate metadata, when returned.
                    properties:
                      credits:
                        type: integer
                        description: Credit value reported with the task.
                    required:
                      - credits
                    additionalProperties: false
                  cost:
                    type: object
                    description: Task cost metadata, when returned.
                    properties:
                      credits:
                        type: integer
                        description: Credit value reported with the task.
                    required:
                      - credits
                    additionalProperties: false
                required:
                  - id
                additionalProperties: false
              example:
                id: 123e4567-e89b-42d3-a456-426614174000
        '400':
          description: Invalid request or unavailable task ID.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    description: Task request error.
                    properties:
                      code:
                        type:
                          - string
                          - integer
                        description: Machine-readable task error code.
                      message:
                        type: string
                        description: Error explanation.
                      data:
                        description: Additional error details, when returned.
                    required:
                      - code
                      - message
                    additionalProperties: true
                  - type: object
                    description: Request authentication or validation error.
                    properties:
                      error:
                        type: object
                        description: Error details.
                        properties:
                          message:
                            type: string
                            description: Error explanation.
                          type:
                            type: string
                            description: Error category.
                          code:
                            type:
                              - string
                              - integer
                              - 'null'
                            description: Error code, when returned.
                        required:
                          - message
                        additionalProperties: true
                    required:
                      - error
                    additionalProperties: true
        '401':
          description: Authentication failed.
          content:
            application/json:
              schema:
                type: object
                description: Request authentication or validation error.
                properties:
                  error:
                    type: object
                    description: Error details.
                    properties:
                      message:
                        type: string
                        description: Error explanation.
                      type:
                        type: string
                        description: Error category.
                      code:
                        type:
                          - string
                          - integer
                          - 'null'
                        description: Error code, when returned.
                    required:
                      - message
                    additionalProperties: true
                required:
                  - error
                additionalProperties: true
      x-codeSamples:
        - lang: Shell
          label: eleven_voice_dubbing
          source: |
            curl https://api.cometapi.com/runwayml/v1/voice_dubbing \
              --request POST \
              --header "Authorization: Bearer $COMETAPI_KEY" \
              --header "Content-Type: application/json" \
              --data '{
              "model": "eleven_voice_dubbing",
              "audioUri": "https://your-audio-host/source-speech.mp3",
              "targetLang": "es"
            }'
        - lang: Python
          label: eleven_voice_dubbing
          source: |
            import os
            import requests

            payload = {   'model': 'eleven_voice_dubbing',
                'audioUri': 'https://your-audio-host/source-speech.mp3',
                'targetLang': 'es'}

            response = requests.post(
                "https://api.cometapi.com/runwayml/v1/voice_dubbing",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json=payload,
            )
            response.raise_for_status()
            print(response.json()["id"])
        - lang: JavaScript
          label: eleven_voice_dubbing
          source: |
            const payload = {
              "model": "eleven_voice_dubbing",
              "audioUri": "https://your-audio-host/source-speech.mp3",
              "targetLang": "es"
            };

            const response = await fetch(
              "https://api.cometapi.com/runwayml/v1/voice_dubbing",
              {
                method: "POST",
                headers: {
                  Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                  "Content-Type": "application/json",
                },
                body: JSON.stringify(payload),
              },
            );
            if (!response.ok) throw new Error(await response.text());
            const task = await response.json();
            console.log(task.id);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Use your CometAPI API key.

````