@eduvidu/node
v0.0.2
Published
The `WaveToBlobService` class is responsible for converting audio data (in `Blob` format) to a WAV file. It supports encoding in both 16-bit PCM and 32-bit float formats and includes functionality for audio resampling.
Downloads
12
Maintainers
Keywords
Readme
WaveToBlobService
The WaveToBlobService
class is responsible for converting audio data (in Blob
format) to a WAV file. It supports encoding in both 16-bit PCM and 32-bit float formats and includes functionality for audio resampling.
Features
- Converts audio
Blob
data to WAV format. - Supports both 16-bit PCM and 32-bit float encoding.
- Handles audio resampling when needed.
- Provides helper functions for encoding audio data and managing WAV file headers.
Installation
To use this service, import it into your project and call the relevant methods.
Example
import { waveToBlobService } from './path/to/WaveToBlobService';
async function convertBlobToWav(blob: Blob) {
const wavBlob = await waveToBlobService.getWaveBlob(blob, true);
console.log(wavBlob);
}
BlobCombinator
The BlobCombinator
class combines multiple audio Blob
objects into a single audio file. It uses the crunker
library to concatenate and optionally download the combined audio. Additionally, it handles audio resampling to ensure a consistent sample rate of 44.1 kHz for all input audio buffers.
Features
- Combines multiple audio
Blob
objects into a single audioBlob
. - Supports resampling of audio buffers to ensure consistency in sample rate (default is 44.1 kHz).
- Optionally downloads the resulting audio file.
- Uses the
crunker
library for audio manipulation.
Installation
First, install crunker
in your project:
npm install crunker