MCPcopy Create free account
hub / github.com/PABannier/bark.cpp / generate_audio

Function generate_audio

examples/server/server.cpp:76–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76bool generate_audio(int n_threads, bark_context *bctx, std::string text, std::string dest) {
77 if (!bark_generate_audio(bctx, text.c_str(), n_threads)) {
78 fprintf(stderr, "%s: An error occured. If the problem persists, feel free to open an issue to report it.\n", __func__);
79 return false;
80 }
81
82 const float *audio_data = bark_get_audio_data(bctx);
83 if (audio_data == NULL) {
84 fprintf(stderr, "%s: Could not get audio data\n", __func__);
85 return false;
86 }
87
88 const int audio_arr_size = bark_get_audio_data_size(bctx);
89
90 std::vector<float> audio_arr(audio_data, audio_data + audio_arr_size);
91
92 write_wav_on_disk(audio_arr, dest);
93 return true;
94}
95
96int main(int argc, char **argv) {
97 ggml_time_init();

Callers 1

mainFunction · 0.85

Calls 4

write_wav_on_diskFunction · 0.85
bark_generate_audioFunction · 0.50
bark_get_audio_dataFunction · 0.50
bark_get_audio_data_sizeFunction · 0.50

Tested by

no test coverage detected