3.0.1 • Published 1 year ago

audio-sample v3.0.1

Weekly downloads
5
License
ISC
Repository
github
Last release
1 year ago

Build Status

audio-sample

That's an audio sample class, accepting a Float32Array in the constructor with one public function. It turns that Float32 into a buffer with the most fastest algorithm.

This within ~20 code lines only by reusing other useful node modules. It cannot get faster and shorter. If I am wrong, let me know and I'll fix that asap.

This component is very useful for turning raw WebAudio samples, which are in Float32, into a buffer with 16 bit signed integers while respecting endianness.

For inspiration refer to: http://blog.groupbuddies.com/posts/39-tutorial-html-audio-capture-streaming-to-node-js-no-browser-extensions

Install

npm i -S audio-sample

How to use

// just an example, this array can come from the first audio channel of a webcam (getUserMedia)
var arrayOfFloats = e.inputBuffer.getChannelData(0)

// create a single audio sample instance
var audioSample = new AudioSample(new Float32Array(arrayOfFloats))

// and now, convert it into a buffer super-fast
var buffer = audioSample.toBuffer()

// then you can send this buffer easily over to the server and do some processing there
3.0.1

1 year ago

3.0.0

1 year ago

2.0.0

2 years ago

1.1.1

4 years ago

1.1.0

5 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

7 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

9 years ago