Recording from multiple channels via sox

I am trying to record 2 different microphones via Sox for one of my applications. I am currently just testing on a Mac terminal to record audio. However, I can only get sound through one microphone.

The sox command I use is:

sox -b 32 -e unsigned-integer -r 96k -c 2 -d --clobber --buffer $((96000*2*10)) /tmp/soxrecording.wav trim 0 10

Which gives a good wav file.

I have two different USB microphones that display as 2-channel I / p each in Sound / System Preferences. I tried making -c 4 a sox command to record from both microphones.

sox -b 32 -e unsigned-integer -r 96k -c 4 -d --clobber --buffer $((96000*2*10)) /tmp/soxrecording.wav trim 0 10

However, I get a warning; sox WARN formats: can't set 4 channels; using 2

And I can only get audio from one USB microphone. I tried to mess around and understand what was wrong, but any tips would be really helpful.

+5
source share
1 answer

You need to indicate that you are using ALSA , then run two different SOX commands and must specify the equipment that you use for each of them.

Please refer to soc, play, rec man page , basically you can use the -d, --default-device when running your command to indicate which ones you want to use.

Something like (simplified):

 sox -r 44100 -c 2 -es -t alsa hw:4,0 -d sox -r 44100 -c 2 -es -t alsa hw:3,0 -d 

This page and this page may also help you.

0
source

Source: https://habr.com/ru/post/1274639/


All Articles