/** * TTS Audio Processing Utilities * * Stateless utility functions for WAV and MP3 audio manipulation. * Provides binary-level audio processing without external dependencies. */ /** * Merge binary WAV data chunks into a single WAV file. * * Extracts audio data from each chunk, combines them, and creates a new * WAV header with correct file size information. Preserves audio format * parameters (channels, sample rate, etc.) from the first chunk. * * @param audioChunks - Array of binary WAV data to merge * @returns Merged WAV file as binary data */ export declare function mergeWavBinary(audioChunks: Uint8Array[]): Uint8Array; /** * Merge MP3 audio chunks using simple concatenation. * * This is a practical approach for MP3 merging. For more advanced * MP3 merging with proper frame handling, consider using external libraries. * * @param audioChunks - Array of binary MP3 data to merge * @returns Concatenated MP3 data */ export declare function mergeMp3Binary(audioChunks: Uint8Array[]): Uint8Array; /** * Remove WAV header from audio data. * * Used for intermediate chunks when merging multiple WAV files. * Finds the "data" chunk and returns only the audio data portion. * * @param audioData - Binary WAV data with header * @returns Binary audio data without header */ export declare function removeWavHeader(audioData: Uint8Array): Uint8Array; /** * Remove MP3 ID3 tags (v1 and v2) from audio data. * * Handles both ID3v2 tags (at the beginning) and ID3v1 tags (at the end). * Returns pure MPEG audio data without metadata. * * @param mp3Data - Binary MP3 data with headers * @returns Binary MP3 data without ID3 tags */ export declare function removeMp3Header(mp3Data: Uint8Array): Uint8Array; /** * Detect audio format from binary data. * * Examines the first few bytes to determine if the data is WAV, MP3, * or unknown format. * * @param audioData - Binary audio data * @returns Format string: 'wav', 'mp3', or 'unknown' */ export declare function detectAudioFormat(audioData: Uint8Array): string; /** * Extract audio data from response object. * * Handles ReadableStream and direct content types. * * @param response - Response object * @returns Binary audio data */ export declare function extractAudioFromResponse(response: any): Promise; /** * Extract audio data from multiple responses. * * @param responses - Array of response objects * @returns Array of extracted binary audio data */ export declare function extractAudioFromResponses(responses: any[]): Promise; //# sourceMappingURL=audio_utils.d.ts.map