por
portaudio
npm i portaudio
por

portaudio

Node bindings for PortAudio

by Joe Ferner

0.0.3 (see all)TypeScript:Not Found
npm i portaudio
Readme

portaudio

Node wrapper around PortAudio

*NOTE:

Example

var portAudio = require('portaudio');

// create a sine wave lookup table
var sampleRate = 44100;
var tableSize = 200;
var buffer = new Buffer(tableSize);
for (var i = 0; i < tableSize; i++) {
  buffer[i] = (Math.sin((i / tableSize) * 3.1415 * 2.0) * 127) + 127;
}

portAudio.open({
  channelCount: 1,
  sampleFormat: portAudio.SampleFormat8Bit,
  sampleRate: sampleRate
}, function (err, pa) {
  // send samples to be played
  for (var i = 0; i < 5 * sampleRate / tableSize; i++) {
    pa.write(buffer);
  }

  // start playing
  pa.start();

  // stop playing 1 second later
  setTimeout(function () {
    pa.stop();
  }, 1 * 1000);
});

Downloads/wk

1

GitHub Stars

24

LAST COMMIT

9yrs ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

4

OPEN PRs

0
VersionTagPublished
0.0.3
latest
9yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate