Morphex's blogologue (Life, technology, music, politics, business, mental health and more)

This is the blog of Morten W. Petersen, aka. morphex in various places. I blog about my life, and what I find interesting and/or important. This is a personal blog without any editor or a lot of oversight so treat it as such. :)

My email is

An OGG/Vorbis player, implemented in Javascript.

My Kiva bragging page
My shared (open source) code on GitHub

Morphex's Blogodex


Zope hosting by Nidelven IT

Morten Petersen on Linkedin

Morten Petersen on Facebook

Morten Petersen on SoundCloud

Morten Petersen on MixCloud

Blogologue on Twitter

Older entries

Atom - Subscribe - Categories

Facebook icon Share on Facebook Google+ icon Share on Google+ Twitter icon Share on Twitter LinkedIn icon Share on LinkedIn

Recording multiple audio input streams on Linux

I guess one of the important things for me dabbling with music, is the ability to perform using only a guitar and my voice. Piano and vocal is another thing I'd like to do, but maybe a bit later. So when I'm able to play the guitar and sing at the same time, why not record both at the same time.

So, I was looking at the possibility of recording the guitar and the vocal microphone at the same time, using Audacity.

I also googled a bit and it was a lot of yada yada expensive sound cards.

Now I have a built-in soundcard on the motherboard of my desktop computer, I also had a USB stick soundcard lying around.

So why not plug in the USB card and see if I can setup a system where I record guitar and vocal using two separate sound cards?

The sound system on my Fedora desktop is ALSA:

[morphex@localhost ~]$ ps uaxww|grep alsa
root 874 0.0 0.0 17160 2892 ? SNs nov.26 0:00 /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main rdaemon
morphex 23598 0.0 0.0 119468 960 pts/5 S+ 19:00 0:00 grep --color=auto alsa
[morphex@localhost ~]$

And to get a list of recording devices, I used

[morphex@localhost ~]$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Megalodon [Razer Megalodon], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: ALC1150 Analog [ALC1150 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 2: ALC1150 Alt Analog [ALC1150 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 3: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
[morphex@localhost ~]$

I guess the most complicated part of getting this multi-source recording to work was getting the arecord commands right. But here's the recording script:

[morphex@localhost ~]$ cat
arecord -D hw:1,0 -f S16_LE -d 360 -c2 -r 44100 voice.wav &> voice.wav.log&
arecord -D hw:3,0 -f S16_LE -d 360 -c1 -r 44100 guitar.wav &> guitar.wav.log&
[morphex@localhost ~]$

arecord gave an obscure message which led me to try -c2 as an argument on the first command, and there was also some sampling rate issues so I set both sampling rates to 44100.

I was worried about syncing issues on a setup like this, but importing both wav files into Audacity and working on them from there, there were no issues with one track lagging behind the other. I can't notice any guitar echo on the vocal mic on the recording below.

So there you have it, fairly simple and cheap to setup a multi-input-source recording system on Linux.

You can hear the result here:

I also created that video using kdenlive, which is about the simplest and best video editor I've found on Linux. I'm not an advanced video editor, and it was fairly easy to get results using kdenlive.

[Permalink] [By morphex] [Music (Atom feed)] [27 Nov 18:58 Europe/Oslo]