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

audio open error #18

Closed AndrewKralovec closed 7 years ago

AndrewKralovec commented 7 years ago

Hello, so i download the package and added your example, but i get the following error. Any idea on how to reslove this. I'm unable to figure the arecord command that is getting launched in this package.

Got SIGNAL startComplete
Received Info: ALSA lib pcm_hw.c:1700:(_snd_pcm_hw_open) Invalid value for card
arecord: main:722: audio open error: No such file or directory
recording audioProcess has exited with code = 1
ashishbajaj99 commented 7 years ago

If you are on Linux, what is the output of this?

$ arecord temp.wav

Please see the README file carefully:

This module depends on your machine having an installation of sox (Mac/Windows Users) OR ALSA tools for Linux. You can use this library to record from any microphone device. Before installing and experimenting with the mic module, you need to ensure that you are able to capture audio via the command line:

$ arecord temp.wav

To get ALSA tools on Raspberry Pi running raspbian, try the following:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install alsa-base alsa-utils

After the above is tested and validated, you can proceed to install the module using:

$ npm install mic
AndrewKralovec commented 7 years ago

@ashishbajaj99 Yes, i have th libs installed. image

chandywerks commented 6 years ago

I had a similar issue. In my case I found that I needed to specify the correct device. I'm using a USB audio capture device.

To list available devices run this,

arecord --list-pcm

The value I used was, "plughw:CARD=system,DEV=0" which you can pass to the mic() constructor like so,

var micInstance = mic({
    device: "plughw:CARD=system,DEV=0",
    rate: '16000',
    channels: '1',
    debug: true,
    exitOnSilence: 6
});