Take the 2-minute tour ×
Sound Design Stack Exchange is a question and answer site for sound engineers, producers, editors, and enthusiasts. It's 100% free, no registration required.

I just found this forum. I previously asked my question at http://unix.stackexchange.com/q/88067/15010 but due to lack of response so far I want to ask here. (I can delete that prior question if advised.)

I am attempting to record phone interviews conducted via VoIP (using SIP, not Skype). I want the caller's voice on one channel and my voice on the other. The Skype Call Recorder offers this option, but I need to do this on my local box running Linux and a SIP client that does not have built-in recording.

I think avconv might allow me to accomplish my goal, but my question is broader because I'm inviting any response that will steer me in the right direction. However, if avconv is the right direction, I need help defining the audio stream inputs (see below).

My distro is Kubuntu 12.04 LTS.

My audio source hardware is listed at bottom. Specifically, I believe the two sources I want to record at the same time are:

  1. alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor/#2: Monitor of Scarlett 2i2 USB Analog Stereo
  2. alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#3: Scarlett 2i2 USB Analog Stereo

I have confirmed that when I am conducting a VoIP interview, the interview subject's voice is on the monitor source above and my voice is on the other source listed above. I can record either source separately in Audacity.

So far I cannot record both sources in a full duplex mode. Furthermore, I cannot so far achieve my goal of one voice recorded to the left channel and the other voice recorded to the right channel.

This great tutorial gave me some clues but ultimately the full duplex mode described there does not meet my goals (and I cannot even get it to work anyway - it crashes pulse audio on my machine).

This also seems relevant, but I am struggling to understand it: http://ubuntuforums.org/showthread.php?t=1962947

Based on the link above, my first guess about how to do this is this simple script:

#!/bin/bash
OUTPUT="audio_`date +%Y-%m-%d_%H%M`"
avconv \
-f alsa -ac 2 -i <alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor> \
-f alsa -ac 1 -i <alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo> \
-map 0:0 -map 1:0 \
-acodec flac \
-threads 0 \
-y $OUTPUT

I assume I need to replace what is in angle brackets with the correct notation. I have no idea if the rest of the above script is even close... If I am on the right track with avconv I would appreciate some help with the above command.

Here's my hardware info:

$ pacmd list-cards  
Welcome to PulseAudio! Use "help" for usage information.  
>>> 3 card(s) available.  
[snip other cards]
index: 2
name: <alsa_card.usb-Focusrite_Scarlett_2i2_USB-00-USB>
driver: <module-alsa-card.c>
owner module: 6
properties:
        alsa.card = "1"
        alsa.card_name = "Scarlett 2i2 USB"
        alsa.long_card_name = "Focusrite Scarlett 2i2 USB at usb-0000:04:00.0-2, high speed"
        alsa.driver_name = "snd_usb_audio"
        device.bus_path = "pci-0000:04:00.0-usb-0:2:1.0"
        sysfs.path = "/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb3/3-2/3-2:1.0/sound/card1"
        udev.id = "usb-Focusrite_Scarlett_2i2_USB-00-USB"
        device.bus = "usb"
        device.vendor.id = "1235"
        device.vendor.name = "Novation EMS"
        device.product.id = "8006"
        device.product.name = "Scarlett 2i2 USB"
        device.serial = "Focusrite_Scarlett_2i2_USB"
        device.string = "1"
        device.description = "Scarlett 2i2 USB"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-usb"
profiles:
        output:analog-stereo: Analog Stereo Output (priority 6000)
        output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060)
        output:analog-stereo+input:iec958-stereo: Analog Stereo Output + Digital Stereo (IEC958) Input (priority 6055)
        output:iec958-stereo: Digital Stereo (IEC958) Output (priority 5500)
        output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (priority 5560)
        output:iec958-stereo+input:iec958-stereo: Digital Stereo Duplex (IEC958) (priority 5555)
        input:analog-stereo: Analog Stereo Input (priority 60)
        input:iec958-stereo: Digital Stereo (IEC958) Input (priority 55)
        off: Off (priority 0)
active profile: <output:analog-stereo+input:analog-stereo>
sinks:
        alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#1: Scarlett 2i2 USB Analog Stereo
sources:
        alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor/#2: Monitor of Scarlett 2i2 USB Analog Stereo
        alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#3: Scarlett 2i2 USB Analog Stereo
ports:
        analog-output: Analog Output (priority 9900, available: unknown)
                properties:

        analog-input: Analog Input (priority 10000, available: unknown)
                properties:

        iec958-stereo-input: iec958-stereo-input (priority 0, available: unknown)
                properties:

        iec958-stereo-output: Digital Output (S/PDIF) (priority 0, available: unknown)
                properties:

Here is more info on this hardware:

$ cat /proc/asound/cards
 1 [USB            ]: USB-Audio - Scarlett 2i2 USB
                      Focusrite Scarlett 2i2 USB at usb-0000:04:00.0-2, high speed

$ cat /proc/asound/card1/pcm0c/info 
card: 1
device: 0
subdevice: 0
stream: CAPTURE
id: USB Audio
name: USB Audio
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 0

$ cat /proc/asound/card1/pcm0p/info 
card: 1
device: 0
subdevice: 0
stream: PLAYBACK
id: USB Audio
name: USB Audio
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
share|improve this question

migrated from avp.stackexchange.com Jan 24 at 12:01

This question came from our site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation.

add comment

2 Answers 2

up vote 1 down vote accepted

I think that JACK is the right tool for the job, as for every nontrivial problem of sound recording under Linux (I'd recommend not to use PulseAudio here, or to route it through JACK).

Have a look at the patchbay of a popular JACK GUI, called qjackctl: http://qjackctl.sourceforge.net/qjackctl-ss1.html

You can rewire left and right channels of whatever programs and microphones you're using to wherever you want, e.g. the microphone and the incoming speech on the left and right recording channel of Ardour, the professional audio recording tool for Linux.

If your SIP client does not support JACK directly, you can still reroute its output. Drop a comment (or open a separate question) if you need help on that.

share|improve this answer
add comment

This is really just to point you in a potentially useful direction, since I just stumbled upon this myself the other day, but there's a program called SoX that looks like it will easily do exactly what you're looking for. It's a pretty versatile program, and comes standard on UbuntuStudio (which is a distro you should definitely check out if you're doing audio work). Of course, if it's not standard in your distro, its only an apt-get away. I've been using SoX to play my music from the command line for the last week and have really been enjoying its controls and flexibility.

Anyawy, hope that helps!

-kael

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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