Skip to content

Commit 8690eab

Browse files
committed
redefinitions
1 parent 9c72833 commit 8690eab

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

examples/simple-tts/simple-tts.cpp

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -322,30 +322,6 @@ void batch_add(struct llama_batch & batch, llama_token id,llama_pos pos, const s
322322
batch.n_tokens++;
323323
}
324324

325-
static void save_wav16(const std::string & fname, const std::vector<float> & data, int sample_rate) {
326-
std::ofstream file(fname, std::ios::binary);
327-
if (!file) {
328-
fprintf(stderr, "%s: Failed to open file '%s' for writing", __func__, fname.c_str());
329-
return;
330-
}
331-
332-
wav_header header;
333-
header.sample_rate = sample_rate;
334-
header.byte_rate = header.sample_rate * header.num_channels * (header.bits_per_sample / 8);
335-
header.block_align = header.num_channels * (header.bits_per_sample / 8);
336-
header.data_size = data.size() * (header.bits_per_sample / 8);
337-
header.chunk_size = 36 + header.data_size;
338-
339-
file.write(reinterpret_cast<const char*>(&header), sizeof(header));
340-
341-
for (const auto & sample : data) {
342-
int16_t pcm_sample = static_cast<int16_t>(std::clamp(sample * 32767.0, -32768.0, 32767.0));
343-
file.write(reinterpret_cast<const char*>(&pcm_sample), sizeof(pcm_sample));
344-
}
345-
346-
file.close();
347-
}
348-
349325
static void fill_hann_window(int length, bool periodic, float * output) {
350326
int offset = -1;
351327
if (periodic) {
@@ -742,7 +718,7 @@ int main(int argc, char ** argv) {
742718

743719
const int n_codes = codes.size();
744720

745-
llama_batch batch = llama_batch_init(n_codes, 0, 1);
721+
batch = llama_batch_init(n_codes, 0, 1);
746722

747723
for (size_t i = 0; i < codes.size(); ++i) {
748724
batch_add(batch, codes[i], i, { 0 }, true); // TODO: all logits?

0 commit comments

Comments
 (0)