Code Monkey home page Code Monkey logo

node-osx-audio's Introduction

osx-audio

A library that provides access to Mac OS X Audio I/O as streams. Only input is supported so far.

Audio captured is Signed 16-bit PCM, Stereo, 44100Hz, in little-endian byte-order. Alternate capture modes will be supported in future versions.

Installation

To install the module for use in your projects:

npm install osx-audio

Usage

Pipe input to a writeable file stream:

var fs = require('fs');
var audio = require('osx-audio');

var input = new audio.Input();

var writable = fs.createWriteStream('output.wav');
input.pipe(writable);

Options

None yet.

API

audio.Input()

Creates a readable stream from the system audio's selected input.

Environment Variables

None yet.

Known Issues

  • Opening, closing, then opening an input will fail to open. Re-instantiating works fine.

Contributing

Feel free to send pull requests! I'm not picky, but would like the following:

  1. Write tests for any new features, and do not break existing tests.
  2. Be sure to point out any changes that break API.

History

  • v1.0.0
    Ports native bindings to nan, newly supporting the latest Node.js versions. Huge thanks to Alexander Kuznetsov for this contribution!

  • v0.2.0
    Reimplements streams (again) and fixes stuttering bugs. Exposes audio event emitter directly if you wanted to use it.

  • v0.1.0
    Reimplement streams and change API.

  • v0.0.2
    Fixup stream resume crash.

  • v0.0.1
    Initial Release. Only input is supported.

The MIT License (MIT)

Copyright (c) 2014 Nathan Wittstock

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

node-osx-audio's People

Contributors

alexkuz avatar fardog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-osx-audio's Issues

Problems installing osx-audio

Hi,

I am a completely noob using npm... I tried to install osx-audio and the process failed as you can see below:

 ✘ muammar@zarathustra ⮀ /tmp ⮀ npm install osx-audio

> [email protected] install /private/tmp/node_modules/osx-audio
> node-gyp rebuild

  CXX(target) Release/obj.target/audio/src/bindings.o
../src/bindings.cc:113:42: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
                static v8::Handle<v8::Value> New(const v8::Arguments& args)
                                                       ^~~~~~~~~~~~~
                                                       v8::internal::Arguments
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/bindings.cc:129:48: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
                static v8::Handle<v8::Value> OpenInput(const v8::Arguments& args)
                                                             ^~~~~~~~~~~~~
                                                             v8::internal::Arguments
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/bindings.cc:139:49: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
                static v8::Handle<v8::Value> CloseInput(const v8::Arguments& args)
                                                              ^~~~~~~~~~~~~
                                                              v8::internal::Arguments
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/bindings.cc:149:45: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
                static v8::Handle<v8::Value> IsOpen(const v8::Arguments& args)
                                                          ^~~~~~~~~~~~~
                                                          v8::internal::Arguments
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/bindings.cc:43:20: error: calling a protected constructor of class 'v8::HandleScope'
                        v8::HandleScope scope;
                                        ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:889:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../src/bindings.cc:45:66: error: cannot initialize a parameter of type 'v8::Isolate *' with an lvalue of type 'v8::Handle<v8::Value>
      (const v8::internal::Arguments &)'
                        v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(New);
                                                                                      ^~~
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:4349:16: note: passing argument to parameter 'isolate' here
      Isolate* isolate, FunctionCallback callback = 0,
               ^
../src/bindings.cc:47:49: error: 'New' is a private member of 'v8::PersistentBase<v8::FunctionTemplate>'
                        s_ct = v8::Persistent<v8::FunctionTemplate>::New(t);
                                                                     ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:643:23: note: declared private here
  V8_INLINE static T* New(Isolate* isolate, T* that);
                      ^
../src/bindings.cc:47:11: error: too few arguments to function call, expected 2, have 1; did you mean '::AudioInput::New'?
                        s_ct = v8::Persistent<v8::FunctionTemplate>::New(t);
                               ^~
                               ::AudioInput::New
../src/bindings.cc:113:32: note: '::AudioInput::New' declared here
                static v8::Handle<v8::Value> New(const v8::Arguments& args)
                                             ^
../src/bindings.cc:48:8: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
                        s_ct->InstanceTemplate()->SetInternalFieldCount(1);
                        ~~~~^~
                            .
../src/bindings.cc:48:10: error: no member named 'InstanceTemplate' in 'v8::Persistent<v8::FunctionTemplate,
      v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
                        s_ct->InstanceTemplate()->SetInternalFieldCount(1);
                        ~~~~  ^
../src/bindings.cc:50:8: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
                        s_ct->SetClassName(v8::String::NewSymbol("AudioInput"));
                        ~~~~^~
                            .
../src/bindings.cc:50:10: error: no member named 'SetClassName' in 'v8::Persistent<v8::FunctionTemplate,
      v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
                        s_ct->SetClassName(v8::String::NewSymbol("AudioInput"));
                        ~~~~  ^
../src/bindings.cc:50:35: error: no member named 'NewSymbol' in 'v8::String'
                        s_ct->SetClassName(v8::String::NewSymbol("AudioInput"));
                                           ~~~~~~~~~~~~^
../src/bindings.cc:52:30: error: no viable conversion from 'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate>'
                        NODE_SET_PROTOTYPE_METHOD(s_ct, "openInput", OpenInput);
                                                  ^~~~
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'const v8::Local<v8::FunctionTemplate> &' for 1st argument
class Local {
      ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate> &&' for 1st argument
class Local {
      ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'Persistent'
  V8_INLINE Local(Local<S> that)
            ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against
      'v8::Persistent<v8::FunctionTemplate>'
  V8_INLINE Local(S* that)
            ^
/Users/muammar/.node-gyp/5.8.0/include/node/node.h:252:71: note: passing argument to parameter 'recv' here
inline void NODE_SET_PROTOTYPE_METHOD(v8::Local<v8::FunctionTemplate> recv,
                                                                      ^
../src/bindings.cc:53:30: error: no viable conversion from 'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate>'
                        NODE_SET_PROTOTYPE_METHOD(s_ct, "closeInput", CloseInput);
                                                  ^~~~
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'const v8::Local<v8::FunctionTemplate> &' for 1st argument
class Local {
      ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate> &&' for 1st argument
class Local {
      ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'Persistent'
  V8_INLINE Local(Local<S> that)
            ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against
      'v8::Persistent<v8::FunctionTemplate>'
  V8_INLINE Local(S* that)
            ^
/Users/muammar/.node-gyp/5.8.0/include/node/node.h:252:71: note: passing argument to parameter 'recv' here
inline void NODE_SET_PROTOTYPE_METHOD(v8::Local<v8::FunctionTemplate> recv,
                                                                      ^
../src/bindings.cc:54:30: error: no viable conversion from 'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate>'
                        NODE_SET_PROTOTYPE_METHOD(s_ct, "isOpen", IsOpen);
                                                  ^~~~
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'const v8::Local<v8::FunctionTemplate> &' for 1st argument
class Local {
      ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate> &&' for 1st argument
class Local {
      ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'Persistent'
  V8_INLINE Local(Local<S> that)
            ^
/Users/muammar/.node-gyp/5.8.0/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against
      'v8::Persistent<v8::FunctionTemplate>'
  V8_INLINE Local(S* that)
            ^
/Users/muammar/.node-gyp/5.8.0/include/node/node.h:252:71: note: passing argument to parameter 'recv' here
inline void NODE_SET_PROTOTYPE_METHOD(v8::Local<v8::FunctionTemplate> recv,
                                                                      ^
../src/bindings.cc:57:10: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
                                        s_ct->GetFunction());
                                        ~~~~^~
                                            .
../src/bindings.cc:57:12: error: no member named 'GetFunction' in 'v8::Persistent<v8::FunctionTemplate,
      v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
                                        s_ct->GetFunction());
                                        ~~~~  ^
../src/bindings.cc:56:28: error: no member named 'NewSymbol' in 'v8::String'
                        target->Set(v8::String::NewSymbol("input"),
                                    ~~~~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/audio/src/bindings.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 15.3.0
gyp ERR! command "/usr/local/Cellar/node/5.8.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /private/tmp/node_modules/osx-audio
gyp ERR! node -v v5.8.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/private/tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/Cellar/node/5.8.0/bin/node" "/usr/local/bin/npm" "install" "osx-audio"
npm ERR! node v5.8.0
npm ERR! npm  v3.7.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the osx-audio package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs osx-audio
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls osx-audio
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /private/tmp/npm-debug.log

I followed the recommendation and I checked that npm and node were updated. Is it a local problem with my environment or something else?.

Thanks.

Port c++ bindings to Nan

Found out that node-midi did this already (also, check the two following commits [https://github.com/justinlatimer/node-midi/commit/e53396be77e699dc72fa320f6a21ddbb32ac8fbe] and [https://github.com/justinlatimer/node-midi/commit/6048bb747b995161a6f2479d0dff6aba8e2c06c9]) so, since node-osx-audio bindings are based on that project's, it should be somehow straightforward to do this.

The only thing bothering me (for now) is the node::Buffer stuff. It's not based on node-midi, so I have no reference to port it.

@fardog, do you have any ideas/comments to this?

Does not compile on Node v4.2.1

I'm sorry I don't have more time to figure this out, but I'm not a Node person (just using this library for the chromecast-osx-audio package), and I've managed to get this working by just using the Node version specified in the Readme.

npm WARN engine [email protected]: wanted: {"node":">=0.10.30 <0.12"} (current: {"node":"4.2.1","npm":"2.14.7"})

> [email protected] install /usr/local/lib/node_modules/osx-audio
> node-gyp rebuild

  CXX(target) Release/obj.target/audio/src/bindings.o
../src/bindings.cc:113:42: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
                static v8::Handle<v8::Value> New(const v8::Arguments& args)
                                                       ^~~~~~~~~~~~~
                                                       v8::internal::Arguments
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/bindings.cc:129:48: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
                static v8::Handle<v8::Value> OpenInput(const v8::Arguments& args)
                                                             ^~~~~~~~~~~~~
                                                             v8::internal::Arguments
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/bindings.cc:139:49: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
                static v8::Handle<v8::Value> CloseInput(const v8::Arguments& args)
                                                              ^~~~~~~~~~~~~
                                                              v8::internal::Arguments
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/bindings.cc:149:45: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
                static v8::Handle<v8::Value> IsOpen(const v8::Arguments& args)
                                                          ^~~~~~~~~~~~~
                                                          v8::internal::Arguments
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/bindings.cc:43:20: error: calling a protected constructor of class 'v8::HandleScope'
                        v8::HandleScope scope;
                                        ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:885:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../src/bindings.cc:45:66: error: cannot initialize a parameter of type 'v8::Isolate *' with an lvalue of type 'v8::Handle<v8::Value>
      (const v8::internal::Arguments &)'
                        v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(New);
                                                                                      ^~~
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:4350:16: note: passing argument to parameter 'isolate' here
      Isolate* isolate, FunctionCallback callback = 0,
               ^
../src/bindings.cc:47:49: error: 'New' is a private member of 'v8::PersistentBase<v8::FunctionTemplate>'
                        s_ct = v8::Persistent<v8::FunctionTemplate>::New(t);
                                                                     ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:639:23: note: declared private here
  V8_INLINE static T* New(Isolate* isolate, T* that);
                      ^
../src/bindings.cc:47:11: error: too few arguments to function call, expected 2, have 1; did you mean '::AudioInput::New'?
                        s_ct = v8::Persistent<v8::FunctionTemplate>::New(t);
                               ^~
                               ::AudioInput::New
../src/bindings.cc:113:32: note: '::AudioInput::New' declared here
                static v8::Handle<v8::Value> New(const v8::Arguments& args)
                                             ^
../src/bindings.cc:48:8: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
                        s_ct->InstanceTemplate()->SetInternalFieldCount(1);
                        ~~~~^~
                            .
../src/bindings.cc:48:10: error: no member named 'InstanceTemplate' in 'v8::Persistent<v8::FunctionTemplate,
      v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
                        s_ct->InstanceTemplate()->SetInternalFieldCount(1);
                        ~~~~  ^
../src/bindings.cc:50:8: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
                        s_ct->SetClassName(v8::String::NewSymbol("AudioInput"));
                        ~~~~^~
                            .
../src/bindings.cc:50:10: error: no member named 'SetClassName' in 'v8::Persistent<v8::FunctionTemplate,
      v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
                        s_ct->SetClassName(v8::String::NewSymbol("AudioInput"));
                        ~~~~  ^
../src/bindings.cc:50:35: error: no member named 'NewSymbol' in 'v8::String'
                        s_ct->SetClassName(v8::String::NewSymbol("AudioInput"));
                                           ~~~~~~~~~~~~^
../src/bindings.cc:52:30: error: no viable conversion from 'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate>'
                        NODE_SET_PROTOTYPE_METHOD(s_ct, "openInput", OpenInput);
                                                  ^~~~
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'const v8::Local<v8::FunctionTemplate> &' for 1st argument
class Local {
      ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate> &&' for 1st argument
class Local {
      ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'Persistent'
  V8_INLINE Local(Local<S> that)
            ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::Persistent<v8::FunctionTemplate>'
  V8_INLINE Local(S* that)
            ^
/Users/dan/.node-gyp/4.2.1/include/node/node.h:252:71: note: passing argument to parameter 'recv' here
inline void NODE_SET_PROTOTYPE_METHOD(v8::Local<v8::FunctionTemplate> recv,
                                                                      ^
../src/bindings.cc:53:30: error: no viable conversion from 'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate>'
                        NODE_SET_PROTOTYPE_METHOD(s_ct, "closeInput", CloseInput);
                                                  ^~~~
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'const v8::Local<v8::FunctionTemplate> &' for 1st argument
class Local {
      ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate> &&' for 1st argument
class Local {
      ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'Persistent'
  V8_INLINE Local(Local<S> that)
            ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::Persistent<v8::FunctionTemplate>'
  V8_INLINE Local(S* that)
            ^
/Users/dan/.node-gyp/4.2.1/include/node/node.h:252:71: note: passing argument to parameter 'recv' here
inline void NODE_SET_PROTOTYPE_METHOD(v8::Local<v8::FunctionTemplate> recv,
                                                                      ^
../src/bindings.cc:54:30: error: no viable conversion from 'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate>'
                        NODE_SET_PROTOTYPE_METHOD(s_ct, "isOpen", IsOpen);
                                                  ^~~~
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'const v8::Local<v8::FunctionTemplate> &' for 1st argument
class Local {
      ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from
      'v8::Persistent<v8::FunctionTemplate>' to 'v8::Local<v8::FunctionTemplate> &&' for 1st argument
class Local {
      ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'Persistent'
  V8_INLINE Local(Local<S> that)
            ^
/Users/dan/.node-gyp/4.2.1/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::Persistent<v8::FunctionTemplate>'
  V8_INLINE Local(S* that)
            ^
/Users/dan/.node-gyp/4.2.1/include/node/node.h:252:71: note: passing argument to parameter 'recv' here
inline void NODE_SET_PROTOTYPE_METHOD(v8::Local<v8::FunctionTemplate> recv,
                                                                      ^
../src/bindings.cc:57:10: error: member reference type 'v8::Persistent<v8::FunctionTemplate>' is not a pointer; maybe you meant to use '.'?
                                        s_ct->GetFunction());
                                        ~~~~^~
                                            .
../src/bindings.cc:57:12: error: no member named 'GetFunction' in 'v8::Persistent<v8::FunctionTemplate,
      v8::NonCopyablePersistentTraits<v8::FunctionTemplate> >'
                                        s_ct->GetFunction());
                                        ~~~~  ^
../src/bindings.cc:56:28: error: no member named 'NewSymbol' in 'v8::String'
                        target->Set(v8::String::NewSymbol("input"),
                                    ~~~~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/audio/src/bindings.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.0.0
gyp ERR! command "/usr/local/Cellar/node/4.2.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/osx-audio
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/4.2.1/bin/node" "/usr/local/bin/npm" "install" "-g" "osx-audio"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the osx-audio package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls osx-audio
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/dan/Code/code_review/backend/npm-debug.log

Not working on node@10

I've got reports on fardog/node-chromecast-osx-audio#15 that the C++ extensions are failing to compile on node v10. with any luck just the nan version needs to be updated, but I don't have the hardware to develop this library any longer. stacktrace from that issue is:

/usr/local/bin/chromecast -> /usr/local/lib/node_modules/chromecast-osx-audio/bin/chromecast.js

> [email protected] install /usr/local/lib/node_modules/chromecast-osx-audio/node_modules/osx-audio
> node-gyp rebuild

  CXX(target) Release/obj.target/audio/src/bindings.o
In file included from ../src/bindings.cc:1:
In file included from ../../nan/nan.h:190:
../../nan/nan_maybe_43_inl.h:88:15: error: no member named 'ForceSet' in 'v8::Object'
  return obj->ForceSet(GetCurrentContext(), key, value, attribs);
         ~~~  ^
In file included from ../src/bindings.cc:1:
../../nan/nan.h:816:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/myuser/.node-gyp/10.0.0/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/myuser/.node-gyp/10.0.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/bindings.cc:1:
../../nan/nan.h:830:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/myuser/.node-gyp/10.0.0/include/node/node.h:164:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/myuser/.node-gyp/10.0.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/bindings.cc:1:
../../nan/nan.h:844:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/myuser/.node-gyp/10.0.0/include/node/node.h:157:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/myuser/.node-gyp/10.0.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/bindings.cc:1:
../../nan/nan.h:1457:31: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return scope.Escape(node::MakeCallback(
                              ^
/Users/myuser/.node-gyp/10.0.0/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/myuser/.node-gyp/10.0.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
4 warnings and 1 error generated.
make: *** [Release/obj.target/audio/src/bindings.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/Cellar/node/10.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/chromecast-osx-audio/node_modules/osx-audio
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/myuser/.npm/_logs/2018-05-03T16_53_56_438Z-debug.log

Feature request: option to select audio device

Thanks for this great package. Worked as described. But I am dearly missing an way to:

  • inspect which audio devices are available on the Mac
  • select on of those

We're trying to hook into the audio chain of a digital audio workstation, and setting the mic input device as the default input just to route to this package seems a bit odd and impractical. Is there any chance to extend this?

Of course, it would also be cool if you could select an output device directly. This would free you from using additional tools like Soundflower. But being able to select the input device is nearly a "must-have" in our case.

how to play file?

I have VLC, is there anyway to play the file or save as .mp3 or .ogg?

Wav file is not readable

Hi there,

I'm running node v0.10.38 and when I execute the little example script you provide, a wave file is being generated but it doesn't appear to be readable by audio players.

Any ideas?

screen shot 2015-05-21 at 12 05 57
screen shot 2015-05-21 at 12 06 26

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.