Replies: 3 comments 12 replies
-
Beta Was this translation helpful? Give feedback.
9 replies
-
Ok. Fixed |
Beta Was this translation helpful? Give feedback.
0 replies
-
Of course there are some boards have implemented this function. But we want
to keep the project focused and extendable. These PRs are not merged into
the main branch.
…On Sat, 27 Sep 2025 at 1:31 PM, Teguh Sakura ***@***.***> wrote:
Of course. This is a piece of sample code you can implement in your custom
board class:
std::string GetSdcardAudioList() {
return "[{\"name\": \"test.mp3\", \"size\": 1000}]";
}
std::string PlaySdcardAudio(const std::string& name) {
if (true) {
return "{\"status\": \"playing\"}";
} else {
return "{\"status\": \"audio file not found\"}";
}
}
// IoT initialization, gradually migrating to MCP protocol
void InitializeTools() {
auto& mcp_server = McpServer::GetInstance();
// SDCard audio list retrieval tool
mcp_server.AddTool("self.sdcard.get_audio_list",
"Get a list of all audio files in SDCard",
PropertyList(),
[this](const PropertyList& properties) -> ReturnValue {
return GetSdcardAudioList();
});
// SDCard audio playback tool
mcp_server.AddTool("self.sdcard.play_audio",
"Play a specified audio file from SDCard",
PropertyList({
Property("name", kPropertyTypeString, "The name of the audio file to play")
}),
[this](const PropertyList& properties) -> ReturnValue {
std::string name = properties["name"].value<std::string>();
return PlaySdcardAudio(name);
});
}
Thanks.
Is there board that already have a feature to play audio file using that
class?
or the xiaozhi-esp32 doesn't have that feature.
—
Reply to this email directly, view it on GitHub
<#562 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCHXRJMFRDSZFTOK4FSRYT3UYOJRAVCNFSM6AAAAAB4FV2DPGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJSG42TQNA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
新版的没有唤醒词选择了。
Beta Was this translation helpful? Give feedback.
All reactions