Coder Social home page Coder Social logo

node-mumble's Introduction

No Maintenance Intended

This project is not maintained. The code base depends on various native components that keep breaking between Node versions. There might be non-native alternatives these days so someone should implementa new version of the library on top of such.

Mumble client for Node.js

Build Status Code Climate

This module implements mumble protocol handling for Node.js

Installation

npm install mumble

Example

var mumble = require('mumble'),
    fs = require('fs');

var options = {
    key: fs.readFileSync( 'key.pem' ),
    cert: fs.readFileSync( 'cert.pem' )
};

console.log( 'Connecting' );
mumble.connect( 'mumble://example.org', options, function ( error, connection ) {
    if( error ) { throw new Error( error ); }

    console.log( 'Connected' );

    connection.authenticate( 'ExampleUser' );
    connection.on( 'initialized', onInit );
    connection.on( 'voice', onVoice );
});

var onInit = function() {
    console.log( 'Connection initialized' );

    // Connection is authenticated and usable.
};

var onVoice = function( voice ) {
    console.log( 'Mixed voice' );

    var pcmData = voice;
};

Use openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem to generate the certificate.

Take a look at the advanced example in "examples/advanced.js"!

Please also take a look at the wiki for an complete documentation of the API.

Contributing

Pull requests, found issues, etc. are welcome. The authors are tracked in the AUTHORS file. This file is kept up to date manually so authors are encouraged to pull request the necessary changes to the AUTHORS themselves.

Running tests

Tests can be executed with mocha. By default the tests are executed against local (localhost) Mumble server in the default port. To use a remote server or non-default port, launch mocha with MUMBLE_URL environment variable set:

MUMBLE_URL=my.mumble.server.com mocha

Related Projects

node-mumble's People

Contributors

aubron avatar b1naryth1ef avatar bleachisback avatar brooksmckinley avatar drappier-charles avatar erus-test avatar feildmaster avatar frogomeli avatar justinmchase avatar mikemimik avatar neonit avatar prior99 avatar rantanen avatar timedev avatar tjhorner avatar torkleyy 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-mumble's Issues

There is a racecondition where the first voicepacket is lost

When a user starts talking it can occure that the first voice packet gets lost.
This does not happen when

if( !user.voiceActive ) {
    continue;
}

in MumbleConnection.prototype._dequeueFrames is removed. I guess this is a racecondition happening when the udp packets come in to fast and overwrite the user.buffer before it was read.

Audio is garbled

I'm having trouble sending audio. When I am listening and someone else is send me audio everything is fine. When I send audio however it sounds garbled to listeners.

For now I am just using the loopback.js example so I can send and receive audio myself. I've tried the demo on both windows and linux so far and both are having the same issue. I'm now wondering if the issue is now a server configuration issue?

When I connect the real mumble client to my server I get this message:

Server maximum network bandwidth is only 12 kbit/s. Audio quality auto-adjusted to 8 kbit/s (40 ms)

I'm wondering if node-mumble is simply trying to send too high of bandwidth streams to the server and thus having problems. I tried setting the sampleRate on the input options but it didn't seem to have an effect. I tried to patch node mumble to use a default of 8000 instead of 48000 for the SAMPLING_RATE but it gives me this: warning: Sampling rate must be between 32 kHz and 96 kHz

So i have two questions:

  • Do you think it's likely that the audio issues I'm encountering are just server bandwidth / quality configuration problems?
  • How do I downgrade the audio quality in node-mumble so that it's only sending 8kbit/s ?

Can't build package

Hello,

I could use some advice on how to build the package. I was able to do it a few days ago, but now I'm not having any luck. I've pasted output below. I appreciate any and all help. Thanks.

Jrawke@Jrawke-ThinkPad-T61:~/Documents/testmumble$ npm install mumble

> [email protected] install /home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules/celt
> node-gyp rebuild

make: Entering directory '/home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules/celt/build'
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/bands.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/celt.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/cwrs.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/entcode.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/entdec.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/entenc.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/header.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/kiss_fft.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/laplace.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/mdct.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/modes.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/pitch.o
../deps/celt-0.7.1/libcelt/pitch.c: In function ‘find_best_pitch’:
../deps/celt-0.7.1/libcelt/pitch.c:71:13: warning: variable ‘score’ set but not used [-Wunused-but-set-variable]
       float score;
             ^
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/quant_bands.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/rangedec.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/rangeenc.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/rate.o
  CC(target) Release/obj.target/libcelt/deps/celt-0.7.1/libcelt/vq.o
  AR(target) Release/obj.target/deps/celt.a
  COPY Release/celt.a
  CXX(target) Release/obj.target/node-celt/src/node-celt.o
../src/node-celt.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE CeltEncoder::Encode(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/node-celt.cc:76:4: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
    auto actualBuffer = Nan::CopyBuffer(reinterpret_cast<char*>(self->compressedBuffer), compressedLength ).ToLocalChecked();
    ^
../src/node-celt.cc:76:9: error: ‘actualBuffer’ does not name a type
    auto actualBuffer = Nan::CopyBuffer(reinterpret_cast<char*>(self->compressedBuffer), compressedLength ).ToLocalChecked();
         ^
../src/node-celt.cc:79:31: error: ‘actualBuffer’ was not declared in this scope
    info.GetReturnValue().Set( actualBuffer );
                               ^
../src/node-celt.cc:73:11: warning: unused variable ‘compressedLength’ [-Wunused-variable]
    size_t compressedLength = (size_t)celt_encode( self->encoder, pcm, NULL, &(self->compressedBuffer[0]), compressedSize );
           ^
node-celt.target.mk:131: recipe for target 'Release/obj.target/node-celt/src/node-celt.o' failed
make: *** [Release/obj.target/node-celt/src/node-celt.o] Error 1
make: Leaving directory '/home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules/celt/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.19.0-30-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules/celt
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian


> [email protected] install /home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules/jitterbuffer
> node-gyp rebuild


Traceback (most recent call last):
  File "/usr/share/node-gyp/gyp/gyp_main.py", line 9, in <module>
    load_entry_point('gyp==0.1', 'console_scripts', 'gyp')()
  File "/usr/lib/python2.7/dist-packages/gyp/__init__.py", line 547, in script_main
    return main(sys.argv[1:])
  File "/usr/lib/python2.7/dist-packages/gyp/__init__.py", line 540, in main
    return gyp_main(args)
  File "/usr/lib/python2.7/dist-packages/gyp/__init__.py", line 505, in gyp_main
    'cwd': os.getcwd(),
OSError: [Errno 2] No such file or directory
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:344:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.19.0-30-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules/jitterbuffer
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules'
npm ERR! error rolling back  [email protected] { [Error: ENOTEMPTY, rmdir '/home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules' }
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 most likely a problem with the celt 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 celt
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.19.0-30-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "mumble"
npm ERR! cwd /home/Jrawke/Documents/testmumble
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian


> [email protected] install /home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref
> node-gyp rebuild


module.js:340
    throw err;
          ^
Error: Cannot find module 'nan'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at [eval]:1:1
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:456:26)
    at evalScript (node.js:532:25)
    at startup (node.js:80:7)
    at node.js:902:3
gyp: Call to 'node -e "require('nan')"' returned exit status 8. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:344:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.19.0-30-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/Jrawke/Documents/testmumble/node_modules/mumble/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/Jrawke/Documents/testmumble/npm-debug.log
npm ERR! not ok code 0

Crash

/home/music/mumble-bot/node_modules/mumble/lib/MumbleWrapper.js:90
user._detach()
^
TypeError: Cannot read property '_detach' of undefined
at EventEmitter.MumbleWrapper._userRemove (/home/music/mumble-bot/node_modules/mumble/lib/MumbleWrapper.js:90:13)
at EventEmitter.emit (events.js:107:17)
at EventEmitter.MumbleConnection._processMessage (/home/music/mumble-bot/node_modules/mumble/lib/MumbleConnection.js:403:10)
at EventEmitter.MumbleConnection._processData (/home/music/mumble-bot/node_modules/mumble/lib/MumbleConnection.js:358:14)
at Object.callback (/home/music/mumble-bot/node_modules/mumble/lib/MumbleConnection.js:804:18)
at MumbleSocket._checkReader (/home/music/mumble-bot/node_modules/mumble/lib/MumbleSocket.js:125:12)
at MumbleSocket.read (/home/music/mumble-bot/node_modules/mumble/lib/MumbleSocket.js:55:43)
at Object.callback (/home/music/mumble-bot/node_modules/mumble/lib/MumbleConnection.js:803:21)
at MumbleSocket._checkReader (/home/music/mumble-bot/node_modules/mumble/lib/MumbleSocket.js:125:12)
at MumbleSocket.receiveData (/home/music/mumble-bot/node_modules/mumble/lib/MumbleSocket.js:39:10)
at TLSSocket. (/home/music/mumble-bot/node_modules/mumble/lib/MumbleSocket.js:22:14)

Exception in examples/wrapper.js

(node) warning: possible EventEmitter memory leak detected. 11 permissionQuery listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at EventEmitter.addListener (events.js:179:15)
at EventEmitter. (/home/prior/Projects/node-mumble/lib/MumbleWrapper.js:33:20)
at EventEmitter.emit (events.js:110:17)
at EventEmitter.addListener (events.js:150:10)
at EventEmitter.Channel (/home/prior/Projects/node-mumble/lib/Channel.js:18:18)
at EventEmitter.MumbleWrapper._newChannel (/home/prior/Projects/node-mumble/lib/MumbleWrapper.js:113:19)
at EventEmitter.MumbleWrapper._channelState (/home/prior/Projects/node-mumble/lib/MumbleWrapper.js:156:47)
at EventEmitter.emit (events.js:107:17)
at EventEmitter.MumbleConnection._processMessage (/home/prior/Projects/node-mumble/lib/MumbleConnection.js:403:10)
at EventEmitter.MumbleConnection._processData (/home/prior/Projects/node-mumble/lib/MumbleConnection.js:358:14)
(node) warning: possible EventEmitter memory leak detected. 11 permissionQuery listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at EventEmitter.addListener (events.js:179:15)
at EventEmitter.Channel (/home/prior/Projects/node-mumble/lib/Channel.js:18:18)
at EventEmitter.MumbleWrapper._newChannel (/home/prior/Projects/node-mumble/lib/MumbleWrapper.js:113:19)
at EventEmitter.MumbleWrapper._channelState (/home/prior/Projects/node-mumble/lib/MumbleWrapper.js:156:47)
at EventEmitter.emit (events.js:107:17)
at EventEmitter.MumbleConnection._processMessage (/home/prior/Projects/node-mumble/lib/MumbleConnection.js:403:10)
at EventEmitter.MumbleConnection._processData (/home/prior/Projects/node-mumble/lib/MumbleConnection.js:358:14)
at Object.callback (/home/prior/Projects/node-mumble/lib/MumbleConnection.js:804:18)
at MumbleSocket._checkReader (/home/prior/Projects/node-mumble/lib/MumbleSocket.js:125:12)
at MumbleSocket.read (/home/prior/Projects/node-mumble/lib/MumbleSocket.js:55:43)

'message' event in MumbleClient -> always 'private' message

https://github.com/Rantanen/node-mumble/blob/master/lib/MumbleClient.js#L444

MumbleClient.prototype._textMessage = function(data) {
    var actor = this.sessions[data.actor];
    if(actor) {
        if(data.session !== null) { // THIS WILL NEVER BE FALSE
            this.emit('message', data.message, actor, 'private');
        }
        else if(data.channel_id !== null) { // A message to the channel
            this.emit('message', data.message, actor, 'channel');
        }
    }
};

The statement on line:444 will always be true because session === [] you need to check if it's empty not null.

Will be submitting PR.

Get rid of the [Function: JitterBuffer] output

On the start of every application using node-mumble [Function: JitterBuffer] gets printed into the standard output, I was however not able to figure out where it comes from, I guess it might be the node-jitterbuffer package.

Audio capture and playback

I created a new project compatible with node-mumble, specifically to live stream captured microphone data and playback what comes from the server. It's not super robust yet but I plan on adding mac builds and pre-built binaries in the near future. It uses openal to capture and playback the audio and seems to perform quite well.

I was previously attempting to use html5 web audio apis in electron but they are, frankly, not good enough. Either in stability or performance, I'm not sure. But this works like a champ so there it is :)

Project: node-mumble-audio

Example code to work with node-mumble:

var audio = require('./index');
var mumble = require('electron-mumble');
var speaker = new audio.PlaybackDevice();
var source = new audio.CaptureDevice();
var out_stream = null;

console.log( 'Connecting...' );
mumble.connect( process.env.MUMBLE_SERVER, {}, function ( error, connection ) {
    if( error ) { throw new Error( error ); }

    console.log( 'Connected.' );
    console.log( 'Authenticating...' );

    out_stream = connection.inputStream({sampleRate: 48000});

    connection.authenticate( process.env.MUMBLE_USER, process.env.MUMBLE_PASS );
    connection.on( 'initialized', onInit );
    connection.on( 'voice', onVoice );
});

var onInit = function() {
    console.log( 'Authenticated.' );

    source.on('data', function (data) {
        out_stream.write(data);
    })
    source.start();

    // Connection is authenticated and usable.
    speaker.play();
};

var onVoice = function( pcmData ) {
    speaker.write(pcmData);
}

Enjoy, and that is all :)

joinPath() not working

It throws an exception:

/home/prior/Projects/mumble-bot/node_modules/mumble/lib/MumbleConnection.js:163
        var nextChannel = this._findChannel( channel.channelId, segment, true
                                                    ^
TypeError: Cannot read property 'channelId' of undefined
    at EventEmitter.MumbleConnection.joinPath (/home/prior/Projects/mumble-bot/node_modules/mumble/lib/MumbleConnection.js:163:53)
    at EventEmitter.MumbleWrapper.joinPath (/home/prior/Projects/mumble-bot/node_modules/mumble/lib/MumbleWrapper.js:226:28)
    at Connection.join (/home/prior/Projects/mumble-bot/src/connection.js:17:15)
    at startup (/home/prior/Projects/mumble-bot/index.js:26:4)
    at /home/prior/Projects/mumble-bot/index.js:20:3
    at TLSSocket.<anonymous> (/home/prior/Projects/mumble-bot/node_modules/mumble/index.js:41:9)
    at TLSSocket.g (events.js:199:16)
    at TLSSocket.emit (events.js:104:17)
    at TLSSocket.<anonymous> (_tls_wrap.js:946:18)
    at TLSSocket.emit (events.js:104:17)

Output Stream recording

Is it possible to record from the outputstream as it stands?

I have tried (on 'initialized'):

//user record
var u = connection.userByName('clux')
u.outputStream().pipe(fs.createWriteStream('./test.pcm'));

or

// global record
connection.outputStream().pipe(fs.createWriteStream('./test.pcm'));

and then running

// playback
fs.createReadStream('./test.pcm').pipe(connection.inputStream());

but nothing seems to be heard from my bot. I know the playback part should work since I can play your sin.pcm file. Is this not the intended usage?

(btw module has been fantastic so far - have done some really fun things with it 👍 )

Run this

Well im new user with node js, how can I run this client on node js? Im have installed node js and python.

I get this:

D:\mumble\web>node index.js
module.js:338
    throw err;
          ^
Error: Cannot find module 'bindings'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (D:\mumble\web\node_modules\jitterbuffer\index.js:2:20
)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

Recording not working

Users recording will not fire respective event. Investigate why, if the client really transmits this or if it is deprecated and no longer used and fix it or remove it.

Streaming MP3

Using lame npm assume the rough sudo code...

var lame = require('lame');
var decoder = new lame.Decoder();
decoder.pipe(connection.inputStream());

I hear the mp3 audio but it's very distorted. I checked the "lame" npm with "speaker" npm and can hear it just fine there so I am wondering if there is something special needed to fix the stream? Perhaps a connection option that I missing?

In voice-start and voice-end events, user.name is null

Maybe this isn't always true, but for our server it is. The code in question is:

https://github.com/EvolveLabs/electron-mumble/blob/master/lib/MumbleConnection.js#L715

if( packet.frame && !user.talking ) {
    user.talking = true;
    this.emit( 'voice-start', { session: user.session, name: user.name, talking: true } );
}

The packet shape is correct, it seems like mumble just doesn't send the user name anymore. Instead it gives you the session id and expects you to correlate it with a user I think. This could possibly be corrected by setting the name based on the users collection:

var name = user.name || this.users[ user.session ].name;
this.emit( 'voice-start', { session: user.session, name: name, talking: true } );

Our workaround is to essentially do this in the handler:

connection.on('voice-start', function (user) {
  user.name = connection.sessions[user.session].name;
  ...
});

I'll try to send a PR soon-ish if you don't do it sooner.

Static noise when trying to stream audio.

I'm having problems streaming audio data to a server.
Whenever I fully decode a mp3 into a writeable stream and then encode it, it results into a static noise on the server.
I tried this with the opus codec, CELT codec, WAVE codec and raw PCM data. None of them seem to work. I also tried creating a readable stream from a CELT encoded file straight to the connection.inputStream(), it had the same result.

I could use some help!

Is it possible to implement Opus as a codec?

I've been trying to create a mumble bot that streams music to the server, only the stream (celt) seems to corrupt every now and again, stopping or just turning into straight robot voice. Any chance you might implement Opus?

How do I create a channel and join it?

I'm looking for something like:

var name = 'testing'
client.createChannel(name)
client.on('channel-create', function (channel) {
    if(channel.name === name) {
      client.channel.join(channel)
    }
})

Native Binding Mystery

I'll start by saying that I'm super excited to have found this project, thanks for all your work. In addition, I have a good amount of experience with node, but none with native bindings.

I am trying to get the examples/basic.js but am hitting a wall. Here's the output from trying to run my copy of the example.

$ node index.js
undefined
Connecting
Connected
'Celt versions: undefined'

/home/andrew/work/mumble/node_modules/mumble/lib/MumbleConnection.js:403
            buffer: new jitter.JitterBuffer( 10 ),
                    ^
TypeError: undefined is not a function
    at EventEmitter.MumbleConnection._onUserState (/home/andrew/work/mumble/node_modules/mumble/lib/MumbleConnection.js:403:21)
    at EventEmitter.MumbleConnection._processMessage (/home/andrew/work/mumble/node_modules/mumble/lib/MumbleConnection.js:334:50)
    at EventEmitter.MumbleConnection._processData (/home/andrew/work/mumble/node_modules/mumble/lib/MumbleConnection.js:313:14)
    at Object.callback (/home/andrew/work/mumble/node_modules/mumble/lib/MumbleConnection.js:619:18)
    at MumbleSocket._checkReader (/home/andrew/work/mumble/node_modules/mumble/lib/MumbleSocket.js:68:12)
    at MumbleSocket.read (/home/andrew/work/mumble/node_modules/mumble/lib/MumbleSocket.js:25:43)
    at Object.callback (/home/andrew/work/mumble/node_modules/mumble/lib/MumbleConnection.js:618:21)
    at MumbleSocket._checkReader (/home/andrew/work/mumble/node_modules/mumble/lib/MumbleSocket.js:68:12)
    at MumbleSocket.read (/home/andrew/work/mumble/node_modules/mumble/lib/MumbleSocket.js:25:43)
    at EventEmitter.MumbleConnection._waitForPrefix (/home/andrew/work/mumble/node_modules/mumble/lib/MumbleConnection.js:613:17)

The first undefined that's logged is from node_modules/jitterbuffer/index.js showing that the binding is require'd, but not defined? node-jitterbuffer.node has been built so I'm not sure why it's giving me undefined.

Same issue with the 'Celt versions': undefined. It seems that node-celt.node is built but not defined.

And then obviously it crashes because jitter is undefined.

Do you have any ideas of what I could look into / try to resolve the issue? Any help is much appreciated.

I'm running Ubuntu 13.04 and x64

warning: jitter buffer sees negative buffering, your code might be broken.

This error is constantly spammed in my console after prolonged use with values that alternate randomly (usually 6 and sometimes 4). I narrowed down where the warning is being sent from, but since it's not an error and there is no stack trace, I can't tell where it's going wrong. I've tried debugging at each line where JitterBuffer is referenced, but those lines are called too often and the warning seems to come up sporadically.

[QUESTION] How do I rename a channel?

I'd like to rename a channel.
Basically I'm doing this:

var channel = connection.channelById(22);
channel.update({
    name: 'new Channel Name',
    linksAdd: null,
    linksRemove: null,
    parent: null,
});

But for some reason the channel won't update its name.

P.S.: I nulled the other properties because I got the following error:

TypeError: Cannot call method '_addChild' of undefined
    at EventEmitter.Channel._checkParent (path/to/node-mumble/lib/Channel.js:2
    at EventEmitter.Channel.update (path/to/node-mumble/lib/Channel.js:120:14)

Can't install!

For some reason I can't install the module via: npm install mumble

npm gives me the following error:

npm ERR! Error: ENOENT, open 'C:\Users\myuser\node_modules\mumble\qgit push'
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "mumble"
npm ERR! cwd C:\Users\myuser
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR! path C:\Users\myuser\node_modules\mumble\qgit push
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\myuser\npm-debug.log
npm ERR! not ok code 0

Help would be appreciated. Thank you.

Voice from client pauses every couple seconds.

Hey I was following along with the mp3 example you had. I changed it up a little bit though for it to only play audio when a chat command was given. But then I noticed that when the audio was long enough, it would play for 2-3 seconds and then cut out for about a second and then play for 2-3 more seconds again. I also noticed that the red lips in mumble turned back to grey during the audio cut outs. I simplified my code down to the point where I discovered that this short amount of code reproduces the issue:

var fs = require('fs');

var lame = require('lame');
var mumble = require('mumble');

var play = function(file, client) {
    var stream = fs.createReadStream(file);
    var decoder = new lame.Decoder();

    decoder.on('format', function(format) {
        var input = client.inputStream(format);
        decoder.pipe(input);
    });
    stream.pipe(decoder);
};

mumble.connect('mumble://127.0.0.1', function(error, client) {
    if(error) { throw new Error(error); }

    client.authenticate('music-test');
    client.on('initialized', function() {
        // comment out the setTimeout to make it work perfectly.
        setTimeout(function() {
            play('test2.mp3', client);
        }, 2000);
    });
});

It seems like if you don't play audio ASAP, the issue happens. Any idea why this could be happening?

Thanks for the library by the way!

MumbleClient.users() not returning users online

MumbleClient#users() doesn't return the list of users currently online, rather all users that have been on the server when the client has been connected regardless if the user is offline or online.

Nan 2, iojs 3 support

I have forked the various mumble projects to add electron build support. I just wanted to let you know that I have upgraded them all to build under nan-2, iojs-3. I plan to come back here and send proper pull requests so we can be as in sync as possible but if you decide to upgrade sooner than i can do that, you can reference electron-opus as a guide.

Most of the changes are pretty straight forward replacements (e.g. NanNew -> Nan::New) but there was one breaking change you should know about that was fairly difficult for me to figure out, which was the semantic change of Nan::NewBuffer being changed to not copy and also take ownership of the provided memory. This caused a crash in the GC as it was attempting to free memory that had already been freed. Changing it instead to be Nan::CopyBuffer fixes the bug without memory leak as well.

Thanks again for all the good work on this project.

Change License

I suggest to change it from

Copyright (c) 2013-2015 Mikko Rantanen, Frederick Gnodtke

to

Copyright (c) 2013-2015 Mikko Rantanen and other contributors

Electron support

I am attempting to get this module to work in an electron application. I rebuilt the native modules so they can load and run in electron and everything seems to be working except for the actual audio playback. I'm wondering if you have any thoughts on how to actually playback the audio coming in?

In addition to the normal stuff I have something like this:


  var ms = new MediaSource()
  var audio = document.getElementById('player') // <audio>
  audio.src = window.URL.createObjectURL(ms)

  ms.addEventListener('sourceopen', function () {
        var sourceBuffer = ms.addSourceBuffer('audio/webm; codecs="opus"')
        mumbleConnection.on('voice', function( buffer ) {
            var array = new Uint8Array(buffer)
            sourceBuffer.appendBuffer(array)
            if(audio.paused) {
                audio.play()
            }
        })
  })

The buffer looks like its full of data but there appears to be a problem reading it out. There is no audio and trying to append the buffer a second time results in the following error:

Uncaught InvalidStateError: Failed to execute 'appendBuffer' on 'SourceBuffer': This SourceBuffer has been removed from the parent media source.

It seems like the problem is related to the encoded data. As far as I can tell chromium supports the opus codec (it errors out if you don't have a valid codec in the addSOurceBuffer funtion).

Any thoughts?

private and public

Silly question, what options/command should be used to generate the public.pem and private.pem? I've looked through https://nodejs.org/api/tls.html and have still run into issues (such as:

c.context.setCert(options.cert); ^ Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
)

channelByName finds only one channel

When there are multiple channels with the same name, channelByName will only return one of them.

For example this is a valid channel structure (at least the official client allows it to be created):

-Root
    -Test1
        - A
    - Test2
        - A

Then calling myMumbleConnection.channelByName("A") will return /Root/Test 1/A, but not /Root/Test 2/A.

How to get constant output?

I was trying to play an mp3 like in the example and I noticed some extreme stuttering. So I tried the sin example as well and there too, I noticed that the output was pausing every four seconds or so, as well as stuttering slighly. What might be the cause of this? And how can I fix it so that it outputs a constant sound?

opus support?

I'm not sure how different the libopus library is from libcelt, and not sure how difficult it'd be to build a node-opus. Unfortunately I don't have the background to really contribute much to this, short of testing and Node.JS side code, but I at least wanted to express my interest, in case you had free time and interest in updating :)

Thanks!

user.outputStream() audio broken

When 'true' is not supplied to the .outputStream() method zero-frames will be inbetween each frame. (At least it sounds like this, I am not an audioengineer). However the audio is corrupted. This does not occure, when .outputStream(true) is used, which afaik skips frames which are silence.

TypeError: Cannot read property 'session' of undefined

Calling MumbleClient.sendMessage will always yield this error, because of the way it is written:

if( !packet.session && !packet.channelId ) {
    return console.error(
        "Recipients not specified for sending text messages.\n" +
        "client.sendMessage isn't used for sending protobuf messages anymore.\n" +
        "Use client.connection.sendMessage for raw protobuf messages." );
}

var packet = {
    actor: this.session,
    message: message
};
// ...

The packet variable is being hoisted, so it will always be undefined when packet.session is being accessed. I think packetis supposed to be recipient.

how to self mute / self deaf?

Hello,

Sorry for the basic question, but what is the API call for self muting / self deafening? I couldn't find it in the wiki...

Thanks

Inconsistent Documentation

The library documentation list events/attributes/methods that do not exist and also doesn't list ones that do. The examples of this I have found are User.moveToChannel() and Connection.on('user-move').
Please either update the docs to match the code or vice-versa.

Rename MumbleWrapper to MumbleClient maybe?

While MumbleWrapper makes sense from the internal point of view, now that the name is exposed to the users through documentation, etc. I think we should rename it to MumbleClient as wrapper might end up confusing the users?

This shouldn't affect the interfaces in any way so it's not as big of a change as it sounds like.

Thoughts?

User.prototype.outputStream defined twice

User.prototype.outputStream

User.prototype.outputStream = function() {
    return this.wrapper.connection.outputStream(this.session);
};

User.prototype.inputStream = function() {
    return this.wrapper.inputStreamForUser( this.session );
};

User.prototype.outputStream = function() {
    return this.wrapper.connection.outputStream(this.session);
};

Stack overflow in `_waitForPrefix`

The MumbleConnection._waitForPrefix has an infinite recursion. This has a chance of overflowing the stack if the process stays up for a long time as each TCP control message (and even UDP tunnel message?) puts around 4-5 method calls on the stack.

Whisper not working

The bot can whisper to user but cannot be whispered to. It just doesn't receive the data at all. Even if you log the data directly in MumbleSocket there wont be any output. Has the bot to tell the server that it can be whispered to or some special option?

Prebuild binaries and electron support

I pre-apologize for the length of this issue :)

I have been investigating the use of this package for consumption in an electron application as a mumble client, using browser audio apis to capture and play audio. I have managed to get a working prototype but not without jumping a few hurdles first.

I wanted to first coordinate with you to discuss some of the problems I encountered and also to gauge your interest in the sort of pull requests I may be able to offer.

The main problem is that simply doing: npm install mumble failed for me, seemingly because I am using iojs v2.3.0. Specifically, each of the native packages it depends on fail to build successfully (we tried windows and osx). Interestingly enough, however I was able to clone them each from github and build them from source directly without any problems. So I'm not sure what the problem is but there appears to be a difference between what is currently in NPM and what is currently in source.

One problem is simply that [email protected] does not support iojs:

npm WARN engine [email protected]: wanted: {"node":">= 0.8.0 < 0.12"} (current: {"node":"2.3.0","npm":"2.11.1"})

To solve that I removed the dependency on protobuf and swapped it out with protobufjs, which is a pure JS implementation of protobuf, no native code or modules needed. This required some pretty trivial code changes, nothing major at all.

Next I built each of the native modules one at a time and linked everything together via npm-link. After that I created a simple electron application that uses the code to connect to my server and play audio via browser apis, which finally worked.

The only remaining issue is that in order for this to work in electron for actual users, the modules need to be pre-built (e.g. node-pre-gyp), since users will not necessarily have compilers on their systems.

Therefore, my current plan of action is to fork the following projects:

  • node-mumble
  • node-celt
  • node-opus
  • node-jitterbuffer

The latter 3, I simply want to convert into node-pre-gyp projects, compile against electron and upload the binaries to amazon.

As for node-mumble I want to:

  • Replace the dependency protobuf with protobufjs
  • Replace dependencies on other projects with their pre-gyp equivalents.

My question to you is, to what degree are you interested in pull requests for any of this work? Also, how do you feel about me forking for these purposes? The changes in question here are largely superficial, nothing core to the logic of the modules is really changed just platform and compatibility related stuff.

And finally, thank you for doing this work openly already. It has been immensely helpful.

about copy() method

lib / MumbleSocket.js LINE 52 and LINE 59

received.copy(buffer, written);
received.copy(buffer, written, 0, remaining);

received's type is string, have no method copy();

I guess your mean is :

 buffer.copy(buffer, written);
 buffer.copy(buffer, written, 0, remaining);

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.