USB interface route input to output using Alsa ?

Talk about your MIDI interfaces, microphones, keyboards...

Moderators: MattKingUSA, khz

Post Reply
User avatar
Michael Z Freeman
Established Member
Posts: 43
Joined: Thu Dec 17, 2009 1:49 pm
Location: England
Contact:

USB interface route input to output using Alsa ?

Post by Michael Z Freeman »

Hi :D,

I have an Elextrix EBox44 USB interface. It has 2 line in/phono inputs and two outputs. It cannot route its own inputs to outputs and I've used Jack Audio to do that. However on my slower (and quieter) system Jack in RT mode causes the system to slow down quite a bit. So I wanted to set up Alsa to simply connect the EBox inputs to outputs so I can hear anything I'm inputting to it without having to start Jack.

This is the closest ~/.asoundrc example I've found to what I want ...

Code: Select all

# This is the four-channel card that sends its first two channels
# to one real card, and the other two channels to the other card.
pcm.tworooms {
    type multi;
    slaves {
        a {
           # The first real card, change to "channel:CARD=CardName"
           # for your system.
            pcm "front:CARD=Audigy";
            channels 2;
        }
        b {
           # The second real card, change to "channel:CARD=CardName"
           # for your system.
            pcm "iec958:CARD=VT82xx";
            channels 2;
        }
    }

    # This configures how the four channels of this virtual
    # card are distributed amongst the real cards.
    bindings {
        0 { slave a; channel 0; }
        1 { slave a; channel 1; }
        2 { slave b; channel 0; }
        3 { slave b; channel 1; }
    }
}

# This virtual "sound card" mixes two channels up to four.
pcm.both {
    type route

    # Its four-channel output is sent to the "tworooms" device.
    slave {
        pcm "tworooms"
    }

    # This defines how the channels are mixed. Input channel 0 is
    # sent for 100% to channels 0 and 2 of device "tworooms",
    # and its channel 1 is sent for 100% to channels 1 and 3.
    ttable {
        0 { 0 1.0; 2 1.0 }
        1 { 1 1.0; 3 1.0 }
    }
}
But not being familiar with Alsa .asoundrc I cannot see how to do what this guy is doing but with the inputs and outputs on my single USB device. It does seem possible looking at his example to route my input to output so I can hear it.

Any ideas or examples will be appreciated as for some reason the style of the Alsa .asoundrc gives me a huge headache :?. I think I need to run a command to show the names of all the mixer controls and inputs/output device names but not sure what that is.
User avatar
Michael Z Freeman
Established Member
Posts: 43
Joined: Thu Dec 17, 2009 1:49 pm
Location: England
Contact:

Re: USB interface route input to output using Alsa ?

Post by Michael Z Freeman »

OK, this is so absurdly simple ...

Code: Select all

djbarney@djbarney-anubis ~
$ arecord | aplay
Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
Playing WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
Someone on the #alsa Freenode told me that this cannot be done using the Alsa setup. It can. Using the Alsa "file" plugin, although at the moment I'm just going to do it on the command line. I suspect that Alsa can reroute the audio using a virtual sound card but this is not easy to work out how to do it.
Post Reply