MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / audio_data_from_speaker

Function audio_data_from_speaker

subprojects/llama.cpp/tools/tts/tts.cpp:512–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512static std::string audio_data_from_speaker(json speaker, const outetts_version tts_version = OUTETTS_V0_2) {
513 std::string audio_data = "<|audio_start|>\n";
514
515 if (tts_version == OUTETTS_V0_2 || tts_version == OUTETTS_V0_3) {
516 std::string code_start = (tts_version == OUTETTS_V0_3) ? "" : "<|code_start|>";
517 std::string code_end = (tts_version == OUTETTS_V0_3) ? "<|space|>" : "<|code_end|>";
518 for (const auto &word : speaker["words"]) {
519 std::string word_text = word["word"].get<std::string>();
520 double duration = word["duration"].get<double>();
521 std::vector<int> codes = word["codes"].get<std::vector<int>>();
522
523 // Create the audio output entry
524 std::ostringstream word_entry;
525 word_entry << word_text << "<|t_" << std::fixed << std::setprecision(2)
526 << duration << "|>" + code_start;
527 for (const auto &Code : codes) {
528 word_entry << "<|" << Code << "|>";
529 }
530 word_entry << code_end << "\n";
531 audio_data += word_entry.str();
532 }
533 }
534
535 return audio_data;
536}
537
538int main(int argc, char ** argv) {
539 common_params params;

Callers 1

mainFunction · 0.85

Calls 1

strMethod · 0.45

Tested by

no test coverage detected