index.js
function toArrayBuffer (audioBuffer, format) {
	if (!isNormalized(format)) format = normalize(format)

	var data

	//convert to arraybuffer
	if (audioBuffer._data) data = audioBuffer._data.buffer;

	else {
		var floatArray = audioBuffer.getChannelData(0).constructor;
		data = new floatArray(audioBuffer.length * audioBuffer.numberOfChannels);

		for (var channel = 0; channel < audioBuffer.numberOfChannels; channel++) {
			data.set(audioBuffer.getChannelData(channel), channel * audioBuffer.length);
		}
	}

	var arrayFormat = fromTypedArray(audioBuffer.getChannelData(0))

	var buffer = convert(data, {
		float: true,
		channels: audioBuffer.numberOfChannels,
		sampleRate: audioBuffer.sampleRate,
		interleaved: false,
		bitDepth: arrayFormat.bitDepth
	}, format)

	return buffer
}
function toArrayBuffer (audioBuffer, format) {
	if (!isNormalized(format)) format = normalize(format)

	var data

	//convert to arraybuffer
	if (audioBuffer._data) data = audioBuffer._data.buffer;

	else {
		var floatArray = audioBuffer.getChannelData(0).constructor;
		data = new floatArray(audioBuffer.length * audioBuffer.numberOfChannels);

		for (var channel = 0; channel < audioBuffer.numberOfChannels; channel++) {
			data.set(audioBuffer.getChannelData(channel), channel * audioBuffer.length);
		}
	}

	var arrayFormat = fromTypedArray(audioBuffer.getChannelData(0))

	var buffer = convert(data, {
		float: true,
		channels: audioBuffer.numberOfChannels,
		sampleRate: audioBuffer.sampleRate,
		interleaved: false,
		bitDepth: arrayFormat.bitDepth
	}, format)

	return buffer
}
function toArrayBuffer ( audioBuffer , format ) { if ( ! isNormalized ( format ) ) format = normalize ( format ) var data //convert to arraybuffer if ( audioBuffer . _data ) data = audioBuffer . _data . buffer ; else { var floatArray = audioBuffer . getChannelData ( 0 ) . constructor ; data = new floatArray ( audioBuffer . length * audioBuffer . numberOfChannels ) ; for ( var channel = 0 ; channel < audioBuffer . numberOfChannels ; channel ++ ) { data . set ( audioBuffer . getChannelData ( channel ) , channel * audioBuffer . length ) ; } } var arrayFormat = fromTypedArray ( audioBuffer . getChannelData ( 0 ) ) var buffer = convert ( data , { float : true , channels : audioBuffer . numberOfChannels , sampleRate : audioBuffer . sampleRate , interleaved : false , bitDepth : arrayFormat . bitDepth } , format ) return buffer }
Convert AudioBuffer to Buffer with specified format
Convert AudioBuffer to Buffer with specified format