Create audio

HTTP request

POST /ai/audio_generation

Authorization

Include your ACCESS TOKEN in HTTP Authorization header.

Authorization: Bearer Token

Request Parameters

KEY
TYPE
VALUE

prompt

String

The text you wish to convert into speech. Example: "Hello, my name is Suno".

configs

JSON

This parameter is a JSON object encompassing a variety of settings you can adjust to customize the image generation process. It includes several parameters, which we will describe next, allowing you to control different aspects of the generation.

model

String

Specifies the AI model used for generating the speech. Default is "bark".

User Guide

  1. Craft a Clear Prompt: Start by writing the text that you want to be spoken. This text should be clear and well-structured, as it will be directly converted into speech. Consider the flow and natural pauses in speech to make the output sound more realistic.

  2. Generate and Evaluate: Once you've crafted your prompt, generate your speech. Listen to the audio output carefully to assess its quality, clarity, and how well it matches your expectations.

  3. Refine Your Prompt for Naturalness: If the speech doesn't sound as natural or expressive as you'd like, consider revising your prompt. Adding punctuation, changing sentence structures, or even specifying the tone can help guide the AI to produce more natural-sounding speech.

Example Request

{
  "prompt": "Hello, my name is Parrot AI. I can generate audio from text",
  "configs": {
    "model": "bark"
  }
}

Parrot API

audio_task = parrot.create_txt2audio(prompt, model)

Response

Returns the ID of the successful task.

{
  "data": {
    "task_id": "f8184aff872c4062ac7fb7e3a40dafac",
    "prompt": "The motorbike engine is accelerating",
    "config": {
      "model": "bark",
      "task_name": "tasks.parrot_t2s_task",
      "task_type": "TEXT-TO-AUDIO",
    }
  },
  "errors": [],
  "error_description": "",
  "start_time": "2024-03-15 01:34:49.257219",
  "end_time": "2024-03-15 01:34:49.359186",
  "host_of_client_call_request": "103.186.100.36",
  "total_time_by_second": 0.101979,
  "status": "success"
}

Last updated

Was this helpful?