audio-playback
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSonilo 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
工具
| Tool | Description |
|---|---|
| Play a local audio file through the system's default speakers. |
| 工具 | 描述 |
|---|---|
| 通过系统默认扬声器播放本地音频文件。 |
Parameters
参数
| Parameter | Type | Notes |
|---|---|---|
| string | Absolute path, or relative to |
| 参数 | 类型 | 说明 |
|---|---|---|
| string | 绝对路径,或相对于 |
Workflow Tips
工作流提示
- Natural follow-up after any generation tool. Once ,
text_to_music,text_to_sfx, etc. return a saved path, offer (or default, if the user's phrasing implies it — e.g. "play what you just made") to callvideo_to_musicon that same path.play_audio - Platform playback path: macOS uses ; Linux prefers
afplayformpg123or.mp3otherwise. Windows has no native-player branch at all and always falls back to theaplay/sounddevicePython packages, same as Linux when neithersoundfilenormpg123is installed — that fallback needs the systemaplaylibrary installed separately (PortAudioon macOS,brew install portaudioon Debian/Ubuntu). Everything else in this repo works without PortAudio.sudo apt-get install libportaudio2 - Respects the same file-access confinement as every other tool: a path outside is rejected unless
SONILO_MCP_BASE_PATHis set.SONILO_MCP_ALLOW_ANY_PATH=true
- 任何生成工具后的自然跟进操作。一旦、
text_to_music、text_to_sfx等工具返回保存路径,可主动提供(或根据用户表述默认执行,例如用户说“播放你刚制作的内容”)对该路径调用video_to_music。play_audio - 平台播放路径: macOS使用;Linux优先对
afplay文件使用.mp3,否则使用mpg123。Windows完全没有原生播放器分支,始终回退到aplay/sounddevicePython包,与Linux在未安装soundfile或mpg123时的情况相同——该回退功能需要单独安装系统aplay库(macOS上使用PortAudio,Debian/Ubuntu上使用brew install portaudio)。此仓库中的其他所有功能无需PortAudio即可运行。sudo apt-get install libportaudio2 - 遵循与其他所有工具相同的文件访问限制:除非设置,否则
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).
当文件不存在、不是可识别的音频格式、超出受限基础路径,或平台上没有可用播放器时(会提示缺少的组件名称),将触发错误。