Functions
Utility functions for audio processing, logging, and more.
Utility functions for audio processing, logging, and more.
- applyFade — Applies linear fade-in and fade-out effects to audio samples.
- blobToArrayBuffer — Converts an audio Blob to an ArrayBuffer.
- calculateRMS — Calculates the RMS (Root Mean Square) volume level of audio samples.
- concatenateArrayBuffers — Concatenates multiple ArrayBuffer instances into a single contiguous buffer.
- configureSTTFromMetadata — Auto-configures an STT provider’s audio format settings from input metadata.
- createAudioBlob — Creates a WAV audio Blob from raw 16-bit PCM data.
- createLogger — Factory function to create a new Logger instance.
- createWavHeader — Creates a standard 44-byte WAV (RIFF) header for raw PCM audio data.
- detectAudioFormat — Detects the audio container format from magic bytes in the buffer.
- downsampleAudio — Downsamples audio data from one sample rate to a lower sample rate.
- extractHeader — Extracts the container header from an audio buffer for a known format.
- floatTo16BitPCM — Converts a Float32Array of audio samples to a 16-bit signed integer PCM Int16Array.
- getAudioMimeType — Returns the MIME type string corresponding to an AudioFormat.
- int16ToFloat — Converts an Int16Array of 16-bit PCM samples to a Float32Array of normalized floats.
- isSilent — Detects whether an audio buffer contains silence.
- resolveLanguageCode — Resolves a language string to an ISO 639-3 code for ElevenLabs Scribe V2.
- resolveProviders — Resolve a flat array of providers into a fully typed ResolvedPipeline.
- textSimilarity — Compute a similarity score (0–1) between two transcript strings.