@scottishcyclops/node-recorder

1.1.1 • Public • Published

node-recorder

A simple cross-platform audio recoding utility for node

It requires the installation of the command line utility rec, which is part of sox

Examples

Record audio, trimming the beginning and the end to audio.wav

const mic = require('@scottishcyclops/node-recorder')
const audio = require('@scottishcyclops/node-audio')
const { createWriteStream } = require('fs')

async function main()
{
  const audiofile = __dirname + '/audio.wav'
  const out = createWriteStream(audiofile, { flags: 'w+', encoding: 'binary' })

  const recorder = mic.start({ trimEnd: true })

  recorder.stdout.pipe(out)

  out.once('close', async () => {
    mic.stop(recorder)
    await audio.play(audiofile)
  })
}

main().catch(console.error)

Please report any bugs here

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @scottishcyclops/node-recorder

      Weekly Downloads

      0

      Version

      1.1.1

      License

      MIT

      Unpacked Size

      3.88 kB

      Total Files

      3

      Last publish

      Collaborators

      • scottishcyclops