Utility to strip WAV headers and extract raw PCM samples for STT diagnostics.
// Source: https://github.com/mateaix/mateclaw | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package vip.mate.stt;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**
* Strip the RIFF/WAVE header off a WAV blob to expose raw PCM samples.
*
* <p>Used for pre-flight audio diagnostics: the web recorder (see
* {@code mateclaw-ui/src/utils/wavEncoder.ts}) emits a 16 kHz mono 16-bit
* WAV with the canonical 44-byte header, and unwrapping it lets STT
* providers run a peak/RMS silence check on the raw samples before paying
* for a recognition call — "mic captured nothing" then surfaces as a
* precise local error instead of an empty transcript.
*
* <p>Limitations: han
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key