]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
common : fix audio loading by miniaudio (whisper/2862)
authorDmitry Atamanov <redacted>
Tue, 4 Mar 2025 17:05:21 +0000 (22:05 +0500)
committerGeorgi Gerganov <redacted>
Sat, 8 Mar 2025 13:18:10 +0000 (15:18 +0200)
examples/common.cpp
examples/common.h

index 484cb7732dd8a27b89817e656a2e3d714ea8645f..f40bcf6d2ab40aea1faf7c0b6f4f4ed0558795a9 100644 (file)
@@ -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<const uint32_t*>(buf.data() + 4);
-    if (chunk_size + 8 != buf.size()) {
-        return false;
-    }
-
-    return true;
-}
-
 void high_pass_filter(std::vector<float> & data, float cutoff, float sample_rate) {
     const float rc = 1.0f / (2.0f * M_PI * cutoff);
     const float dt = 1.0f / sample_rate;
index 7d2219d705473a04b415c42d5f9417b1250819e3..f6bf0a9ecaab032e6b9098e6dbce97c81dd2cf67 100644 (file)
@@ -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: