/**
 * Audio Utilities for Voice Module
 *
 * Provides audio format conversion, duration calculation, and buffer utilities.
 *
 * @module voice/audio-utils
 */
import type { TTSAudioFormat } from "../types/index.js";
/**
 * Detect audio format from buffer
 *
 * @param buffer - Audio data buffer
 * @returns Detected audio format or null
 */
export declare function detectAudioFormat(buffer: Buffer): TTSAudioFormat | null;
/**
 * Get MIME type for audio format
 *
 * @param format - Audio format
 * @returns MIME type string
 */
export declare function getMimeType(format: TTSAudioFormat): string;
/**
 * Get file extension for audio format
 *
 * @param format - Audio format
 * @returns File extension with dot
 */
export declare function getFileExtension(format: TTSAudioFormat): string;
/**
 * Calculate audio duration from buffer
 *
 * @param buffer - Audio data buffer
 * @param format - Audio format (optional, will be detected if not provided)
 * @param sampleRate - Sample rate in Hz (optional, will be extracted if possible)
 * @returns Duration in seconds, or undefined if cannot be calculated
 */
export declare function calculateDuration(buffer: Buffer, format?: TTSAudioFormat, sampleRate?: number): number | undefined;
/**
 * Convert audio format (basic conversion)
 *
 * Note: For full format conversion, external tools like ffmpeg would be needed.
 * This provides basic PCM resampling only.
 *
 * @param buffer - Input audio buffer
 * @param fromFormat - Source format
 * @param toFormat - Target format
 * @param options - Conversion options
 * @returns Converted audio buffer
 */
export declare function convertAudioFormat(buffer: Buffer, fromFormat: TTSAudioFormat, toFormat: TTSAudioFormat, _options?: Record<string, unknown>): Promise<Buffer>;
/**
 * Create PCM audio buffer from raw samples
 *
 * @param samples - Array of sample values (-1 to 1)
 * @param sampleRate - Sample rate in Hz
 * @param bitDepth - Bit depth (8, 16, 24, or 32)
 * @returns PCM audio buffer
 */
export declare function createPcmBuffer(samples: number[], _sampleRate?: number, bitDepth?: 8 | 16 | 24 | 32): Buffer;
/**
 * Extract PCM samples from buffer
 *
 * @param buffer - PCM audio buffer
 * @param bitDepth - Bit depth (8, 16, 24, or 32)
 * @returns Array of sample values (-1 to 1)
 */
export declare function extractPcmSamples(buffer: Buffer, bitDepth?: 8 | 16 | 24 | 32): number[];
/**
 * Resample PCM audio
 *
 * @param samples - Input samples
 * @param fromSampleRate - Source sample rate
 * @param toSampleRate - Target sample rate
 * @returns Resampled samples
 */
export declare function resamplePcm(samples: number[], fromSampleRate: number, toSampleRate: number): number[];
/**
 * Normalize audio levels
 *
 * @param samples - Input samples
 * @param targetPeak - Target peak level (0 to 1)
 * @returns Normalized samples
 */
export declare function normalizeAudio(samples: number[], targetPeak?: number): number[];
/**
 * Create a WAV header
 *
 * @param dataSize - Size of audio data in bytes
 * @param sampleRate - Sample rate in Hz
 * @param channels - Number of channels
 * @param bitDepth - Bit depth
 * @returns WAV header buffer
 */
export declare function createWavHeader(dataSize: number, sampleRate?: number, channels?: number, bitDepth?: number): Buffer;
/**
 * Create a complete WAV file from PCM data
 *
 * @param pcmData - PCM audio data
 * @param sampleRate - Sample rate in Hz
 * @param channels - Number of channels
 * @param bitDepth - Bit depth
 * @returns Complete WAV file buffer
 */
export declare function createWavFile(pcmData: Buffer, sampleRate?: number, channels?: number, bitDepth?: number): Buffer;
/**
 * Split audio buffer into chunks
 *
 * @param buffer - Audio buffer to split
 * @param chunkDurationMs - Duration of each chunk in milliseconds
 * @param sampleRate - Sample rate in Hz
 * @param bytesPerSample - Bytes per sample (channels * bitDepth / 8)
 * @returns Array of audio chunks
 */
export declare function splitIntoChunks(buffer: Buffer, chunkDurationMs: number, sampleRate?: number, bytesPerSample?: number): Buffer[];
/**
 * Audio format signatures for detection
 */
export declare const AUDIO_SIGNATURES: {
    readonly wav: Buffer<ArrayBuffer>;
    readonly mp3: {
        readonly id3: Buffer<ArrayBuffer>;
        readonly frameSync: Buffer<ArrayBuffer>;
    };
    readonly ogg: Buffer<ArrayBuffer>;
};
/**
 * MIME types for audio formats
 */
export declare const MIME_TYPES: {
    readonly wav: "audio/wav";
    readonly mp3: "audio/mpeg";
    readonly ogg: "audio/ogg";
    readonly opus: "audio/opus";
};
