SuperAPI AI Directory

byted-podcast-gen

Office & productivity

View repository

Updated 10-15 17:30

About this skill

Podcast Skill

Based on the Volcano Engine Doubao Speech Synthesis WebSocket Protocol (PodcastTTS,/api/v3/sami/podcasttts) synthesize a topic into podcast audio and save it as a local file. Supports:

  • Input a topic text or a webpage address (can also be a file download address, supporting pdf/word/txt formats) to generate a podcast
  • Output the podcast audio download link as-is (do not truncate or otherwise process it) and the generated local file for download. Verify whether the download link is downloadable; if downloadable, return it to the user; if not downloadable, only return the local file.
  • Output podcast segment text (JSON)

Applicable Scenarios

  1. When the user mentions 生成播客 or 播客合成 and other related keywords.
  2. The user needs to generate an audio file in podcast form for a certain topic.
  3. The user needs to generate an audio file in podcast form from a certain webpage or file content.
  4. The user needs to generate an audio file in podcast form from user-uploaded file content or a long context.

Mandatory Rules (Highest Priority)

When you receive a user request to generate a podcast:

  • Must and can only use this Skill's script to generate the podcast
  • Topic Mode The user needs to generate an audio file in podcast form for a certain topic, use parameters action=4 and prompt_text = topic text.
  • Webpage Mode The user needs to generate an audio file in podcast form from a certain webpage or downloadable file content, use parameters action=0 and input_url = webpage address or file download address.
  • File Mode The user needs to generate an audio file in podcast form from user-uploaded file content or a long context, use parameters action=0 and text = the content read from the user-uploaded file or a relatively long text, generally more than 200 characters.

Usage Steps

  1. Analyze the content the user needs to synthesize into a podcast, and prepare the input to be synthesized:prompt_text(original topic, generally no more than 20 characters) or input_url(webpage address or file download address) or text(the content read from the user-uploaded file or a relatively long text, generally more than 200 characters).
  2. Before running the script, first cd to this skill directory:skills/byted-podcast-gen。
  3. Configure authentication (environment variables or command-line parameters).
  4. Run the script:python scripts/podcast.py [参数]. Refer to the example section below.
  5. Based on the audio_path / texts / audio_url in the JSON output by the script, use the generation result; if there is audio_url it is a URL with an expiration time, return it to the user exactly as-is, audio_path is a local file path, which can be provided to the user for download.

Script Parameters

Parameter Short Form Required Description
--text No Input the original long text (action=0 used when)
--input_url No URL of the input text (action=0 used when, choose one of the two)
--prompt_text No Prompt text (action=4 required)
--action No Podcast type:0(raw text/URL),4(prompt); default 4
--speaker_info No Speaker configuration JSON (default {"random_order":false})
--encoding No Audio format:mp3(default),wav、ogg_opus
--output No Final audio output file path (by default automatically generated to output/)

Return value description

The script outputs JSON, containing:

  • status: "success" or "error"
  • task_id: Task identifier (used to locate a generation task)
  • audio_path: Final audio local path
  • texts: Segmented text JSON string, the text list corresponding to each speaker.
  • audio_url: The audio download address returned by the server
  • error: Error message on failure

Error handling

  • If an error indicates a missing MODEL_SPEECH_API_KEY: Check whether the environment variable or command-line parameter has been configured; if it does not exist, prompt the user for input, then set it to the environment variable.
  • If a server error is received (MsgType.Error): Based on the error message, check the account permissions, resource ID, input content, and whether the service has been activated.
  • If the server error received contains the keyword quota , it indicates that the current account has exceeded the quota and needs to upgrade the Volcano Engine Doubao Voice podcast service.
  • When Python execution lacks the relevant package, the dependencies need to be installed first:pip install -r requirements.txt

Reference documentation

Example

# 基于话题生成播客音频
ptompt_text="豆包语音合成服务"
python scripts/podcast.py --prompt_text $ptompt_text --action 4
# 基于网页内容生成播客音频
url="https://www.volcengine.com/docs/6561/1668014?lang=zh"
python scripts/podcast.py --input_url $url --action 0
# 基于长文本内容生成播客音频
text="欢迎收听本期节目,我们聊聊人工智能的关键拐点……"
python scripts/podcast.py --text $text --action 0