{"id":17249271,"url":"https://github.com/leon3s/node-mic-record","last_synced_at":"2025-04-14T06:07:09.032Z","repository":{"id":65424682,"uuid":"143069588","full_name":"leon3s/node-mic-record","owner":"leon3s","description":"Record microphone sound using nodejs","archived":false,"fork":false,"pushed_at":"2022-07-16T13:29:56.000Z","size":7,"stargazers_count":20,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T11:24:47.605Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leon3s.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-31T20:57:50.000Z","updated_at":"2024-08-04T20:07:03.000Z","dependencies_parsed_at":"2023-01-23T02:05:13.555Z","dependency_job_id":null,"html_url":"https://github.com/leon3s/node-mic-record","commit_stats":{"total_commits":3,"total_committers":3,"mean_commits":1.0,"dds":0.6666666666666667,"last_synced_commit":"f6814f3d8f6f211b4383aaa86a9cc5f8c3ba42c2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leon3s%2Fnode-mic-record","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leon3s%2Fnode-mic-record/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leon3s%2Fnode-mic-record/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leon3s%2Fnode-mic-record/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leon3s","download_url":"https://codeload.github.com/leon3s/node-mic-record/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233641230,"owners_count":18707118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T06:43:50.049Z","updated_at":"2025-01-12T17:49:16.603Z","avatar_url":"https://github.com/leon3s.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-mic-record\n\nRecords a 16-bit signed-integer linear pulse modulation code WAV audio file.\n\nThis module uses Node.js streams to minimize memory usage and optimize speed, perfect for embedded devices and \"the internet of things\".\n\nThese audio files are fully compatible with both the [Google Speech to Text API (v2)](https://github.com/gillesdemey/google-speech-v2) and the [Wit.ai Speech API](https://wit.ai/docs/api#span-classtitle-verb-postspeech).\n\n## Installation\n\n`npm install node-mic-record`\n\n## Dependencies\n\nGenerally, running `npm install` should suffice.\n\nThis module requires you to install [SoX](http://sox.sourceforge.net) and it must be available in your `$PATH`.\n\n### For Mac OS\n`brew install sox`\n\n### For most linux disto's\n`sudo apt-get install sox libsox-fmt-all`\n\n### For Windows\n[download the binaries](http://sourceforge.net/projects/sox/files/latest/download)\n\n## Options\n\n```\nsampleRate    : 16000  // audio sample rate\nchannels      : 1      // number of channels\nthreshold     : 0.5    // silence threshold (rec only)\nthresholdStart: null   // silence threshold to start recording, overrides threshold (rec only)\nthresholdEnd  : null   // silence threshold to end recording, overrides threshold (rec only)\nsilence       : '1.0'  // seconds of silence before ending\nverbose       : false  // log info to the console\nrecordProgram : 'sox'  // Defaults to 'sox' - also supports 'arecord' and 'rec'\ndevice        : null   // recording device (e.g.: 'plughw:1')\n```\n\n\u003e Please note that `arecord` might not work on all operating systems. If you can't capture any sound with `arecord`, try to change device (`arecord -l`).\n\n## Usage\n\n```javascript\nvar record = require('node-mic-record')\nvar fs = require('fs')\n\nvar file = fs.createWriteStream('test.wav', { encoding: 'binary' })\n\nrecord.start({\n  sampleRate : 44100,\n  verbose : true\n})\n.pipe(file)\n```\n\nThe library will automatically attempt to stop when it encounters silence, if not you can stop the recording manually.\n\n```javascript\nvar record = require('node-mic-record')\nvar fs = require('fs')\n\nvar file = fs.createWriteStream('test.wav', { encoding: 'binary' })\n\nrecord.start().pipe(file)\n\n// Stop recording after three seconds\nsetTimeout(function () {\n  record.stop()\n}, 3000)\n```\nThis module uses Node.js streams, if you're unfamiliar with them I'd suggest reading Substack's excellent [stream handbook](https://github.com/substack/stream-handbook).\n\n## Example\n\nHere's how you can write your own Siri in just 10 lines of code.\n\n```javascript\nvar rec = require('node-mic-record')\nvar request = require('request')\n\nvar witToken = process.env.WIT_TOKEN; // get one from wit.ai!\n\nexports.parseResult = function (err, resp, body) {\n  console.log(body)\n}\n\nrec.start().pipe(request.post({\n  'url'     : 'https://api.wit.ai/speech?client=chromium\u0026lang=en-us\u0026output=json',\n  'headers' : {\n    'Accept'        : 'application/vnd.wit.20160202+json',\n    'Authorization' : 'Bearer ' + witToken,\n    'Content-Type'  : 'audio/wav'\n  }\n}, exports.parseResult))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleon3s%2Fnode-mic-record","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleon3s%2Fnode-mic-record","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleon3s%2Fnode-mic-record/lists"}