audio-playback

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sonilo Audio Playback

Sonilo 音频播放

Play a local audio file out loud through the system's default output device. This is the one Sonilo tool that makes no network call — it's pure local playback, useful right after a generation so the user can hear the result without leaving the conversation.
Setup: just needs the Sonilo MCP server connected — no API key required (see setup-api-key if the server itself isn't connected yet).
通过系统默认输出设备大声播放本地音频文件。这是Sonilo工具中无需进行网络调用的工具——它是纯本地播放,非常适合在生成音频后使用,用户无需离开对话即可收听结果。
设置: 只需连接Sonilo MCP服务器——无需API密钥(如果服务器尚未连接,请查看setup-api-key)。

Quick Start

快速开始

MCP tool call

MCP工具调用

play_audio(input_file_path="~/Desktop/thunder.m4a")
There is no REST, Python/JS SDK, or CLI equivalent — this is local-only playback specific to the MCP server, not a Sonilo API call at all. If you're integrating via the SDK or CLI instead of MCP, just play the saved file with whatever your own language/platform normally uses for local audio playback.
play_audio(input_file_path="~/Desktop/thunder.m4a")
此功能没有对应的REST、Python/JS SDK或CLI等效项——这是特定于MCP服务器的本地专属播放功能,完全不属于Sonilo API调用。如果您是通过SDK或CLI而非MCP进行集成,只需使用您自己的语言/平台通常用于本地音频播放的方式播放保存的文件即可。

Tool

工具

ToolDescription
play_audio(input_file_path)
Play a local audio file through the system's default speakers.
工具描述
play_audio(input_file_path)
通过系统默认扬声器播放本地音频文件。

Parameters

参数

ParameterTypeNotes
input_file_path
stringAbsolute path, or relative to
SONILO_MCP_BASE_PATH
. Supports
.wav/.mp3/.m4a/.aac/.ogg/.flac
.
参数类型说明
input_file_path
string绝对路径,或相对于
SONILO_MCP_BASE_PATH
的路径。支持
.wav/.mp3/.m4a/.aac/.ogg/.flac
格式。

Workflow Tips

工作流提示

  • Natural follow-up after any generation tool. Once
    text_to_music
    ,
    text_to_sfx
    ,
    video_to_music
    , etc. return a saved path, offer (or default, if the user's phrasing implies it — e.g. "play what you just made") to call
    play_audio
    on that same path.
  • Platform playback path: macOS uses
    afplay
    ; Linux prefers
    mpg123
    for
    .mp3
    or
    aplay
    otherwise. Windows has no native-player branch at all and always falls back to the
    sounddevice
    /
    soundfile
    Python packages, same as Linux when neither
    mpg123
    nor
    aplay
    is installed — that fallback needs the system
    PortAudio
    library installed separately (
    brew install portaudio
    on macOS,
    sudo apt-get install libportaudio2
    on Debian/Ubuntu). Everything else in this repo works without PortAudio.
  • Respects the same file-access confinement as every other tool: a path outside
    SONILO_MCP_BASE_PATH
    is rejected unless
    SONILO_MCP_ALLOW_ANY_PATH=true
    is set.
  • 任何生成工具后的自然跟进操作。一旦
    text_to_music
    text_to_sfx
    video_to_music
    等工具返回保存路径,可主动提供(或根据用户表述默认执行,例如用户说“播放你刚制作的内容”)对该路径调用
    play_audio
  • 平台播放路径: macOS使用
    afplay
    ;Linux优先对
    .mp3
    文件使用
    mpg123
    ,否则使用
    aplay
    Windows完全没有原生播放器分支,始终回退到
    sounddevice
    /
    soundfile
    Python包,与Linux在未安装
    mpg123
    aplay
    时的情况相同——该回退功能需要单独安装系统
    PortAudio
    库(macOS上使用
    brew install portaudio
    ,Debian/Ubuntu上使用
    sudo apt-get install libportaudio2
    )。此仓库中的其他所有功能无需PortAudio即可运行。
  • 遵循与其他所有工具相同的文件访问限制:除非设置
    SONILO_MCP_ALLOW_ANY_PATH=true
    ,否则
    SONILO_MCP_BASE_PATH
    之外的路径将被拒绝访问。

Error Handling

错误处理

Raises if the file doesn't exist, isn't a recognized audio format, is outside the confined base path, or if no player is available on the platform (with a message naming what's missing).
当文件不存在、不是可识别的音频格式、超出受限基础路径,或平台上没有可用播放器时(会提示缺少的组件名称),将触发错误。