# portaudio

> Node bindings for PortAudio

Latest version **0.0.3** (published 2013-08-12) · 0 weekly downloads

## Install

```sh
npm install portaudio
pnpm add portaudio
yarn add portaudio
bun add portaudio
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2013-08-12 |
| First published | 2012-07-17 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ~0.8.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 27 |
| Author | Joe Ferner |
| Maintainers | joeferner |
| Keywords | portaudio, audio, raw, play, wav |

## Links

- npm: https://www.npmjs.com/package/portaudio
- Repository: https://github.com/joeferner/node-portaudio
- Issues: https://github.com/joeferner/node-portaudio/issues
- npm.io page: https://npm.io/package/portaudio

## Dependencies (1)

- [bindings](https://npm.io/package/bindings.md) ~1.0.0

## Alternatives

- [@snazzah/davey](https://npm.io/package/@snazzah/davey.md) — 1.5M weekly downloads
- [@vendure/testing](https://npm.io/package/@vendure/testing.md) — 8.3K weekly downloads
- [vue-simple-context-menu](https://npm.io/package/vue-simple-context-menu.md) — 6.6K weekly downloads
- [cypress-webpack-preprocessor-v5](https://npm.io/package/cypress-webpack-preprocessor-v5.md) — 2.1K weekly downloads
- [@backstage/plugin-catalog-backend-module-puppetdb](https://npm.io/package/@backstage/plugin-catalog-backend-module-puppetdb.md) — 1.3K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2013-08-12
- 0.0.2 — 2013-01-18
- 0.0.1 — 2012-07-17

## README

# portaudio

Node wrapper around [PortAudio](http://www.portaudio.com/)

**Note: This module has not been tested on windows. If you would like to submit a pull request that would be great.**

**Note: You must install PortAudio libs first.**

## Example

```javascript
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.getDevices(function(err, devices) {
  console.log(devices);
});

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);
});
```

## Troubleshooting

### error: 'PaStreamCallbackFlags' has not been declared

Try installing "libasound-dev" package. See (http://portaudio.com/docs/v19-doxydocs/compile_linux.html). Then try rebuilding.

If that doesn't fix it try building and installing portaudio from source (http://www.portaudio.com/download.html). I've compiled
node-portaudio with pa_stable_v19_20111121.tgz and was successful on Ubunutu.

### No Default Device Found

Ensure that when you compile portaudio that the configure scripts says "ALSA" yes.

---
_Source: https://npm.io/package/portaudio · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
