Giter Site home page Giter Site logo

read-audio's Introduction

read-audio

read audio samples as a stream of ndsamples

unstable

install

with npm, do:

npm i --save read-audio

using SoX

using read-audio with node depends on having SoX installed:

  • on Mac OS X, do brew install sox
  • on Debian-based Linux distros (e.g. Ubuntu), do sudo apt-get install sox

example

var readAudio = require('read-audio')
var through = require('through2')
var terminalBar = require('terminal-bar')

var audio = readAudio()
.pipe(through.obj(function (arr, enc, cb) {
  var data = [].slice.call(arr.data).slice(0, 128)
  cb(null, terminalBar(data) + "\n")
}))
.pipe(process.stdout)

(To run this example you will need:)

npm install --save through2
npm install --save terminal-bar

api

using node

var audio = readAudio({
  buffer: 1024,
  inFile: '-d', // '-d' is default device
  channels: 2,
  rate: 44000,
  dtype: 'int32',
    // int8, uint8, int16, uint16,
    // int32, uint32, float32, float64
    // also supported
  soxPath: 'sox'
})

using browserify

npm install --save getusermedia

getUserMedia({
  video: false,
  audio: true
}, function (err, media) {
  if (err) { throw err }

  var audio = readAudio({
    source: media,
    buffer: 1024,
    channels: 2,
})

source can be either MediaStream[0] or AudioNode[1]

0 1

license

ISC

read-audio's People

Contributors

ahdinosaur avatar

Stargazers

Michael Anthony avatar

Watchers

James Cloos avatar Michael Anthony avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.