Rantanen / node-mumble

Mumble client in Node.js
MIT License
155 stars 48 forks source link

Play audio from channel (server) #120

Open ughstudios opened 4 years ago

ughstudios commented 4 years ago

According to the api wiki it says this: MumbleOutputStream - Audio output stream for streaming audio from the server.

How do I use this?: https://github.com/Rantanen/node-mumble/blob/6b873788f12509f7928f2a2dbd1b57d67fb8b384/lib/MumbleOutputStream.js

I simply want to be able to sit on my laptop and say something and be able to hear it from my desktop running this npm package. Is this possible? Could you give me a pre-made example which just works out of the box? If not, could you lead me in the right direction?

I was looking through the source and could not find out how this node package is getting input from the inputStream, how does it know what microphone to use?

Prior99 commented 4 years ago

This is possible. You would need to somehow get access to your PCs audio devices, via some other NPM package. You could then connect to mumble using this package, create a stream as already mentioned by you, connect the microphone stream to the mumble stream and you're good to go. There are many examples available. For example this one: https://github.com/Rantanen/node-mumble/blob/master/examples/stream.js

On Tue, 7 Jul 2020, 02:57 Daniel Gleason, notifications@github.com wrote:

According to the api wiki it says this: MumbleOutputStream - Audio output stream for streaming audio from the server.

How do I use this?:

https://github.com/Rantanen/node-mumble/blob/6b873788f12509f7928f2a2dbd1b57d67fb8b384/lib/MumbleOutputStream.js

I simply want to be able to sit on my laptop and say something and be able to hear it from my desktop running this npm package. Is this possible? Could you give me a pre-made example which just works out of the box? If not, could you lead me in the right direction?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Rantanen/node-mumble/issues/120, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALME5Q2RLUK5ONISLC6FF3R2JXH3ANCNFSM4OSIMPVA .

ughstudios commented 4 years ago

I was thinking about using this to play the PCMData from the 'voice' event: https://github.com/TooTallNate/node-speaker

Do you think this would work? Then, I could simply find another way of getting live audio (probably using another npm package, and just pipe it into the input stream?)

ughstudios commented 4 years ago

Also, is there a way to 'create' new channels?

ughstudios commented 4 years ago

I'm trying to use this: https://github.com/TooTallNate/node-speaker

So I wrote this code ion my init event:

const speaker = new Speaker({
            channels: 1,          // 2 channels
            bitDepth: 16,         // 16-bit samples
            sampleRate: 48000 //44100     // 44,100 Hz sample rate
        });
        connection.outputStream().pipe(speaker);

Now it works, but the quality is off, it sounds slow, laggy and robotic. Any ideas?