convertToWav (utils/audio-recording.ts)

llama.cpp · tools/ui/src/lib/utils/audio-recording.ts · typescript · MIT
voice, tag:knn-classified

Browser audio recorder using MediaRecorder, supports WAV/WebM, with start/stop and conversion helpers.

// Source: https://github.com/ggml-org/llama.cpp | License: MIT | Copyright 2023-2026 The ggml authors
// Provided via justclaw.it.com; keep this notice with the code.
import { MimeTypeAudio } from '$lib/enums';

/**
 * AudioRecorder - Browser-based audio recording with MediaRecorder API
 *
 * This class provides a complete audio recording solution using the browser's MediaRecorder API.
 * It handles microphone access, recording state management, and audio format optimization.
 *
 * **Features:**
 * - Automatic microphone permission handling
 * - Audio enhancement (echo cancellation, noise suppression, auto gain)
 * - Multiple format support with fallback (WAV, WebM, MP4, AAC)
 * - Real-time recording state tracking
 * - Proper cleanup and resource management
 */
export class AudioRecorder

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key