
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
@ra2web/wavefile
Advanced tools
A WAV file processing library extracted from the ra2web project. This library provides comprehensive functionality for reading, writing, and manipulating WAV audio files.
npm install @ra2web/wavefile
import { WaveFile } from '@ra2web/wavefile';
// Create a new WaveFile instance
const wav = new WaveFile();
// Load from buffer
const buffer = /* your audio buffer */;
wav.fromBuffer(buffer);
// Access audio properties
console.log('Sample Rate:', wav.fmt.sampleRate);
console.log('Channels:', wav.fmt.numChannels);
console.log('Bit Depth:', wav.bitDepth);
// Get samples
const samples = wav.getSamples();
// Convert to different formats
wav.toBitDepth('16');
wav.toSampleRate(44100);
// Export as buffer
const outputBuffer = wav.toBuffer();
// Convert to different compression formats
wav.toALaw(); // Convert to A-Law
wav.toMuLaw(); // Convert to μ-Law
wav.toIMAADPCM(); // Convert to IMA-ADPCM
// Convert from compressed formats
wav.fromALaw();
wav.fromMuLaw();
wav.fromIMAADPCM();
// Convert to Base64
const base64String = wav.toBase64();
// Load from Base64
wav.fromBase64(base64String);
// Convert to Data URI
const dataUri = wav.toDataURI();
// Load from Data URI
wav.fromDataURI(dataUri);
new WaveFile(buffer?)
- Create a new WaveFile instance, optionally from a bufferfromBuffer(buffer)
- Load WAV data from a buffertoBuffer()
- Export WAV data as a bufferfromBase64(base64String)
- Load WAV data from Base64 stringtoBase64()
- Export WAV data as Base64 stringfromDataURI(dataUri)
- Load WAV data from Data URItoDataURI()
- Export WAV data as Data URItoBitDepth(bitDepth, dithered?)
- Convert bit depthtoSampleRate(sampleRate, options?)
- Convert sample ratetoRIFF()
- Convert to RIFF formattoRIFX()
- Convert to RIFX formattoALaw()
- Convert to A-Law compressionfromALaw(bitDepth?)
- Convert from A-Law compressiontoMuLaw()
- Convert to μ-Law compressionfromMuLaw(bitDepth?)
- Convert from μ-Law compressiontoIMAADPCM()
- Convert to IMA-ADPCM compressionfromIMAADPCM(bitDepth?)
- Convert from IMA-ADPCM compressiongetSamples(interleaved?)
- Get audio samplesfmt
- Format chunk datadata
- Audio data chunkbitDepth
- Current bit depthcontainer
- Container format (RIFF/RIFX/RF64)MIT
This library was extracted from the ra2web project. For issues and contributions, please refer to the original project repository.
FAQs
WAV file processing library from ra2web project
The npm package @ra2web/wavefile receives a total of 6 weekly downloads. As such, @ra2web/wavefile popularity was classified as not popular.
We found that @ra2web/wavefile demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.