04-05-2019, 09:21 AM | #1 | ||||
Human being with feelings
Join Date: Mar 2012
Posts: 610
|
How can I record ALSA on the command line in mono not 6 tracks at once?!
I have been messing about with this for ages, and finally I can record in the pcm_s32le my sound card outputs (rather than the default 16bit)... but only all six inputs at once?!
Quote:
Quote:
Quote:
I think the answer is here somewhere: Quote:
__________________
----------> Debian Linux Distribution = Computing Joy & Freedom <---------- Last edited by David Else; 04-05-2019 at 09:49 AM. |
||||
04-06-2019, 05:34 AM | #2 |
Human being with feelings
Join Date: Mar 2012
Posts: 610
|
I almost solved it, I think on an ALSA level the sound card is outputting all channels at once, so for some reason I need to specify that it has 6 channels. I then need to mix it down to one with -af "pan=mono|c0=FR".
__________________
----------> Debian Linux Distribution = Computing Joy & Freedom <---------- |
04-06-2019, 06:44 AM | #3 |
Human being with feelings
Join Date: Mar 2008
Location: Planet Earth
Posts: 9,055
|
I have different sound hardware (two M-Audio Delta 2496 cards) and could never get ALSA in REAPER to see four inputs and four outputs.
In Windows, the two cards appear as a single 4in/4out device. In Linux I had to use JACK with QjackCtrl's patchbay to get all four inputs to work in REAPER, but it's reliable and when I record acoustic drums now all I have to do is fire up QjackCtrl which launches REAPER for me, and I've got all four inputs. For anything else besides acoustic drums I launch REAPER direct and only have the primary sound card available. |
04-08-2019, 01:38 AM | #4 |
Human being with feelings
Join Date: Aug 2007
Location: Luxembourg/Spain
Posts: 1,922
|
I'm not 100% sure about this... But IIRC the alsa driver might present either a fixed amount of channels or a range. In one of the cases you have to open the device for all the channels, otherwise you get an error.
Regarding the M-Audio 2496 I think it's actually 12 channels or something like that, so to be able to open it you'd have to specify all the channels that the chip is supporting even if there isn't anything connected in the hardware itself. Back when I tried to help you with this, I think there was also a way to create a combined device and route the channels so that the channels that you have physically available would be consecutive in numbering, but I've forgotten the details IIRC you never tested the final config file I came up with, so not sure if it works in the real world If you are interested I could try to see if I still have the information available somewhere.
__________________
Reaper for Linux Documentation (WIP). Software: Archlinux/KDE, Fabfilter FX, Komplete 8, Nebula, Schwa/Stillwell, T-racks Max/Amplitube/SVX, etc. Gear: i7-2600k/4700HQ/16GB, RME Multiface/Babyface, Behringer X32, Genelec 8040, etc. :) |
04-08-2019, 06:19 AM | #5 |
Human being with feelings
Join Date: Mar 2008
Location: Planet Earth
Posts: 9,055
|
Back when we were trying to get multi-channel ALSA working with my two M-Audio cards, I tried that last configuration you made up but it still only showed up in REAPER as 2 channels in and out.
My biggest issue with using QjackCtrl to do my mapping is just remembering to launch REAPER using it. Only once so far have I recorded acoustic drum tracks and then realized I had fired up REAPER directly so only two of the four tracks recorded anything. Fortunately I had the part down pretty good. I re-launched with QjackCtrl, and got the four tracks recorded on the next try. |
04-08-2019, 11:14 AM | #6 |
Human being with feelings
Join Date: Mar 2012
Posts: 610
|
I have things working now, and my script is rocking! Anybody want to suggest an improvement or see a problem?
I have been deep in FFMPEG all week and ALSA, I have tried to breakdown this script into parts to make it easy to follow and adapt, even put some links in. Note the 'audio_input' and 'audio_hw' array of arguments, within is dark hidden info from the depths of ALSA! My sound card settings are: audio_input=(alsa -acodec pcm_s32le -ac 6) I need to choose pcm_s32le for 32bit input (which is probably 24bit, but it defaults to 16bit we definitely don't want). I need to choose 6 channels, as that is how many inputs my device has. Any other number and ALSA just says 'NO!' audio_hw=("front:CARD=USB,DEV=0") This is a direct reference to my sound card, if i did something like HW:0 that can change on reboot. Your card can reveal it's special name with aplay -L. It will look something like mine I suspect. Just save the script, make it executable, then call it with the name of the file you want to create. It then records the screen and sound in the ultimate quality of your choice, no crappy re-sampling or mucking about. Adapt as you wish. Right now it records my mic input in mono losslessly, which was not an easy feat and nearly drove me bonkers. Code:
#!/usr/bin/env bash set -eu buffer=(-thread_queue_size 128) video_input=(x11grab -video_size 1920x1080 -framerate 30) audio_input=(alsa -acodec pcm_s32le -ac 6) # we need to specify 6 channels/s32le as defaults fail audio_hw=("front:CARD=USB,DEV=0") # replaces usual hw:n that can change (use aplay -L) video_enc=(libx264 -preset ultrafast -crf 0) # https://trac.ffmpeg.org/wiki/Encode/H.264 audio_enc=(pcm_s32le -af "pan=mono|c0=FR") # https://ffmpeg.org/ffmpeg.html#Main-options ffmpeg "${buffer[@]}" -f "${video_input[@]}" -i "$DISPLAY" \ "${buffer[@]}" -f "${audio_input[@]}" -i "${audio_hw[@]}" \ -c:v "${video_enc[@]}" \ -c:a "${audio_enc[@]}" \ "$1".mkv
__________________
----------> Debian Linux Distribution = Computing Joy & Freedom <---------- |
04-08-2019, 11:37 AM | #7 |
Human being with feelings
Join Date: Aug 2007
Location: Luxembourg/Spain
Posts: 1,922
|
I seem to remember that you were happy with qjackctl so we gave up on it. I still had a few ideas though If you are interested I can see if I can dig that up again, I probably have it squirreled away somewhere, but I can't promise to do it straight away
__________________
Reaper for Linux Documentation (WIP). Software: Archlinux/KDE, Fabfilter FX, Komplete 8, Nebula, Schwa/Stillwell, T-racks Max/Amplitube/SVX, etc. Gear: i7-2600k/4700HQ/16GB, RME Multiface/Babyface, Behringer X32, Genelec 8040, etc. :) |
04-08-2019, 02:10 PM | #8 | |
Human being with feelings
Join Date: Mar 2008
Location: Planet Earth
Posts: 9,055
|
Quote:
I appreciate your offer because like you, I'm pretty sure it can be made to work. It's just not a high enough priority yet for me to spend more time with it. |
|
Thread Tools | |
Display Modes | |
|
|