0.0.19 • Published 6 years ago

@bigear/convertbuffertowav v0.0.19

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

convertBufferToWav

It is a helper converting audio buffer in to wav format

npm-img npm-url

nodei.co

Install

$ npm install --save @bigear/convertBufferToWav

Usage

import convertBufferToWav from "@bigear/convertBufferToWav";

const {buffer} = this.bufferSourceNode
// console.log(buffer.getChannelData(1))
// AudioBufferSourceNode ...
// buffer : AudioBuffer ...
// channelCount: 2
// channelCountMode: "max"
// channelInterpretation: "speakers"
// context: AudioContext ...
// currentTime: 10.518639455782314, sampleRate: 44100, ...
// detune: AudioParam ...
// loop: false

const dataview = convertBufferToWav(buffer.getChannelData(0))
const audioBlob = new Blob([dataview], {type: 'audio/wav'})