Skip to content

Commit a1af459

Browse files
data-manggerganov
authored andcommitted
common : fix audio loading by miniaudio (whisper/2862)
1 parent 7b08f4c commit a1af459

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

examples/common.cpp

-15
Original file line numberDiff line numberDiff line change
@@ -609,21 +609,6 @@ gpt_vocab::id gpt_sample_top_k_top_p_repeat(
609609

610610
}
611611

612-
bool is_wav_buffer(const std::string buf) {
613-
// RIFF ref: https://en.wikipedia.org/wiki/Resource_Interchange_File_Format
614-
// WAV ref: https://www.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
615-
if (buf.size() < 12 || buf.substr(0, 4) != "RIFF" || buf.substr(8, 4) != "WAVE") {
616-
return false;
617-
}
618-
619-
uint32_t chunk_size = *reinterpret_cast<const uint32_t*>(buf.data() + 4);
620-
if (chunk_size + 8 != buf.size()) {
621-
return false;
622-
}
623-
624-
return true;
625-
}
626-
627612
void high_pass_filter(std::vector<float> & data, float cutoff, float sample_rate) {
628613
const float rc = 1.0f / (2.0f * M_PI * cutoff);
629614
const float dt = 1.0f / sample_rate;

examples/common.h

-3
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ gpt_vocab::id gpt_sample_top_k_top_p_repeat(
134134
// Audio utils
135135
//
136136

137-
// Check if a buffer is a WAV audio file
138-
bool is_wav_buffer(const std::string buf);
139-
140137
// Write PCM data into WAV audio file
141138
class wav_writer {
142139
private:

0 commit comments

Comments
 (0)