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

Function write_wav_on_disk

examples/common.cpp:11–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#define SAMPLE_RATE 24000
10
11void write_wav_on_disk(std::vector<float>& audio_arr, std::string dest_path) {
12 drwav_data_format format;
13 format.bitsPerSample = 32;
14 format.sampleRate = SAMPLE_RATE;
15 format.container = drwav_container_riff;
16 format.channels = 1;
17 format.format = DR_WAVE_FORMAT_IEEE_FLOAT;
18
19 drwav wav;
20 drwav_init_file_write(&wav, dest_path.c_str(), &format, NULL);
21 drwav_uint64 frames = drwav_write_pcm_frames(&wav, audio_arr.size(), audio_arr.data());
22 drwav_uninit(&wav);
23
24 fprintf(stderr, "%s: Number of frames written = %lld.\n", __func__, frames);
25}
26
27void bark_print_usage(char** argv, const bark_params& params) {
28 std::cout << "usage: " << argv[0] << " [options]\n"

Callers 2

mainFunction · 0.85
generate_audioFunction · 0.85

Calls 2

dataMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected