ashishbajaj99 / mic

A simple stream wrapper for arecord (Linux (including Raspbian)) and sox (Mac, Windows). Returns a Passthrough stream object so that stream control like pause(), resume(), pipe(), etc. are all available.
MIT License
103 stars 61 forks source link

use this to capture mic audio to client browser #11

Closed alisamir82 closed 7 years ago

alisamir82 commented 7 years ago

Hi, I am trying to create a tool that capture mic audio input - for this your node is doing a great job. however, the output is a .wav file, instead I would like to make that available via localhost for remote client to access. Please let me know if I can use your code your code for this or I will face some known limitation ? - I am new to this so please bear with me. Thanks for your help.

ashishbajaj99 commented 7 years ago

You mean you want to store it in a file that a client could access via FTP/HTTP, etc.? Then the wav file that is generated can be stored at a location where the FTP/HTTP server can access the file and serve it based on client request.

OR

Do you mean you want to stream the data to connected clients? For this you can use var micInputStream = micInstance.getAudioStream(); and treat it like any stream that can be fed to connected clients.

On Wed, Apr 26, 2017 at 8:55 PM, alisamir82 notifications@github.com wrote:

Hi, I am trying to create a tool that capture mic audio input - for this your node is doing a great job. however, the output is a .wav file, instead I would like to make that available via localhost for remote client to access. Please let me know if I can use your code your code for this or I will face some known limitation ? - I am new to this so please bear with me. Thanks for your help.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ashishbajaj99/mic/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/AEs6yBtHUV_SdC7tyTIdqUpFfMm2Af4tks5rz2HtgaJpZM4NJB6b .

ashishbajaj99 commented 7 years ago

See an example for #2 here: https://github.com/ashishbajaj99/wake-on-voice-keyword/blob/master/index.js

On Thu, Apr 27, 2017 at 3:16 PM, Ashish Bajaj bajaj.ashish@gmail.com wrote:

You mean you want to store it in a file that a client could access via FTP/HTTP, etc.? Then the wav file that is generated can be stored at a location where the FTP/HTTP server can access the file and serve it based on client request.

OR

Do you mean you want to stream the data to connected clients? For this you can use var micInputStream = micInstance.getAudioStream(); and treat it like any stream that can be fed to connected clients.

On Wed, Apr 26, 2017 at 8:55 PM, alisamir82 notifications@github.com wrote:

Hi, I am trying to create a tool that capture mic audio input - for this your node is doing a great job. however, the output is a .wav file, instead I would like to make that available via localhost for remote client to access. Please let me know if I can use your code your code for this or I will face some known limitation ? - I am new to this so please bear with me. Thanks for your help.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ashishbajaj99/mic/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/AEs6yBtHUV_SdC7tyTIdqUpFfMm2Af4tks5rz2HtgaJpZM4NJB6b .

alisamir82 commented 7 years ago

Yes, I would like to implement that latter - ie feeding the stream to any connected client.

I will follow the example, Many thanks for your help.

alisamir82 commented 7 years ago

Would you please let me know if I can feed audio stream from mic to HTML5 audio tag micInputStream = micInstance.getAudioStream();

Do you have an example for that by any change ? many thanks for your help.

ashishbajaj99 commented 7 years ago

Sorry for the late reply, unfortunately I dont have an example for this. What you could do in the front end is to open a UDP socket and feed that to the HTML5 audio tag.

If you got this working, you could share an example here and I can include it into the repo as an example use case.