0

I'm trying: 1) record audio via arecord 2) live playback using aplay 3) convert the recorded audio to .flac using flac

Is it possible to perform all three actions simultaneously with the pipe command on command line?

The command i'm trying to use is:

arecord -D plughw:0,0 -d 5 -r 16 -f S16_LE | aplay -f S16_LE | flac - -f --best --sample-rate 16000 -o file.flac

I'm getting this as the error message:

Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono ERROR: for encoding a raw file you must specify a value for --endian, --sign, --channels, --bps, and --sample-rate

On adding the recommended values

arecord -D plughw:0,0 -d 5 -r 16 -f S16_LE | aplay -f S16_LE | flac - -f --best --sample-rate 16000 --endian little --sign signed --channels 1 --bps 16 -o file.flac

This is the output I get: Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono (No runtime statistics possible; please wait for encoding to finish...)

soxi file.flac

Input File : 'file.flac' Channels : 1 Sample Rate : 16000 Precision : 16-bit Sample Encoding: 16-bit FLAC

1

You should be able to use the tee command to get this to work. Try something like

arecord -D plughw:0,0 -d 5 -r 16 -f S16_LE | tee >(aplay -f S16_LE) | flac - -f --best --sample-rate 16000 -o file.flac

This should redirect the record output into aplay and flac using some redirection.

  • If that's working it's wonderful. I hope we'll get some news from the OP :)! – YCN- Jul 3 '17 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.