From: Dmitry Atamanov Date: Tue, 4 Mar 2025 17:05:21 +0000 (+0500) Subject: common : fix audio loading by miniaudio (whisper/2862) X-Git-Tag: upstream/0.0.1802~1 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=a1af459fd89125f9bc1ff6faa84c5167b6394e0a;p=pkg%2Fggml%2Fsources%2Fggml common : fix audio loading by miniaudio (whisper/2862) --- diff --git a/examples/common.cpp b/examples/common.cpp index 484cb773..f40bcf6d 100644 --- a/examples/common.cpp +++ b/examples/common.cpp @@ -609,21 +609,6 @@ gpt_vocab::id gpt_sample_top_k_top_p_repeat( } -bool is_wav_buffer(const std::string buf) { - // RIFF ref: https://en.wikipedia.org/wiki/Resource_Interchange_File_Format - // WAV ref: https://www.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html - if (buf.size() < 12 || buf.substr(0, 4) != "RIFF" || buf.substr(8, 4) != "WAVE") { - return false; - } - - uint32_t chunk_size = *reinterpret_cast(buf.data() + 4); - if (chunk_size + 8 != buf.size()) { - return false; - } - - return true; -} - void high_pass_filter(std::vector & data, float cutoff, float sample_rate) { const float rc = 1.0f / (2.0f * M_PI * cutoff); const float dt = 1.0f / sample_rate; diff --git a/examples/common.h b/examples/common.h index 7d2219d7..f6bf0a9e 100644 --- a/examples/common.h +++ b/examples/common.h @@ -134,9 +134,6 @@ gpt_vocab::id gpt_sample_top_k_top_p_repeat( // Audio utils // -// Check if a buffer is a WAV audio file -bool is_wav_buffer(const std::string buf); - // Write PCM data into WAV audio file class wav_writer { private: