4.1.0 • Published 3 months ago

audio-sample v4.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
3 months ago

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
4.1.0

3 months ago

4.0.1

5 months ago

4.0.0

5 months ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.0

3 years ago

1.1.1

4 years ago

1.1.0

5 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

8 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago