You are not logged in.

#1 2009-02-03 14:58:53

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,724
Website

Alsa: redirect one card's output to another

*edit: simplified*
This is similar to this question: http://bbs.archlinux.org/viewtopic.php?id=72281

I want to redirect mic input from the onboard card to the mixer of the second card, which is the main card, so that I can hear the live feed in the output of the second card.

Just to be clear, I am able to record from the microphone in different applications(e.g. audacity)  by changing the input settings.

Last edited by Xyne (2009-05-19 11:43:12)

Offline

#2 2009-05-19 11:47:05

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,724
Website

Re: Alsa: redirect one card's output to another

*bump* (3.5 months... seems reasonable to bump it now tongue)

I'd really appreciate some help with this. I've simplified the OP again to be as concise as possible.

Offline

#3 2009-05-20 17:59:31

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: Alsa: redirect one card's output to another

Have you checked alsa-project.org (i think that's the website anyway)?

They have all sorts of things on there.

What have you tried so far?
What does your ~/.asoundrc or /etc/asound.conf look like?


Knute

Offline

#4 2009-05-21 02:41:12

zoidby
Member
Registered: 2009-04-25
Posts: 3

Re: Alsa: redirect one card's output to another

Hi,

arecord -f S16_LE -r48000 -c2 -D hw:0 -F0 --period-size=1024 -B0 --buffer-size=4096 | aplay -D hw:1 -

Redirects the input upon the output. If You specify the device(-D hw:0) correctly.

You can use

aplay -l

to get a list of the device numbers.


    hth, zoidby

Last edited by zoidby (2009-05-21 02:44:49)

Offline

#5 2009-05-21 16:11:10

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,724
Website

Re: Alsa: redirect one card's output to another

@Knute
I've looked at it before and I'll look again, but I wasn't able to find anything to do this specifically. I've tried a few different things when I first posted this a few months ago, but I didn't make any progress and eventually gave up. I really haven't completely understood the asound file syntax to such a degree that I can manage this without a really good starting point.

At the moment I don't have an asound file. If you have some suggestions for a starting point I would be grateful. Otherwise I'll go back to the site and see if I can figure it out (maybe they've updated some documentation). I'm sure it's actually quite easy once you've understood it, but I just haven't managed yet.

@zoidby
That's the right idea and my original post actually contained a simplified arecord-aplay pipe to demonstrate the effect that I want. The problem is that there is a very noticeable delay when using such a pipe which makes it unusable for me.




Thanks for replying.

Offline

#6 2009-06-07 20:36:43

siliciferous
Member
From: Cleveland, OH
Registered: 2009-06-07
Posts: 2
Website

Re: Alsa: redirect one card's output to another

You may be looking for something more like this:

ecasound -B:rtlowlatency -b:256 -f:s32_le,2,44100 -i:alsahw,0,0 -o:alsahw

Install ecasound, check the manpage, and alter the above to your liking. It seems to work with much lower latencies than the piping described above but...I still don't think it is an optimal solution. The latency is much lower but still discernible, and depending on the speed of your machine you may have to increase the buffer size to prevent over/underruns. There might be a way to get the redirection to work right on the card, but I haven't figured it out yet. I'm actually going to toy with it more under Windows today and see if I can get the redirection to work at even lower latency with no problems, and if I can...then I will at least know whether it is possible.

I use an M-Audio Revolution 7.1 (ice1724) under Gentoo.


"We demand rigidly defined values of doubt and uncertainty!"

Offline

#7 2009-06-07 23:15:14

siliciferous
Member
From: Cleveland, OH
Registered: 2009-06-07
Posts: 2
Website

Re: Alsa: redirect one card's output to another

Actually, I don't think this will quite work for you. I've been using ecasound to take the cards input (line in) and pipe it to the output (speakers). After that, I have not been specifying the mic/line in or speakers-out at all; I've just been pointing the application to the sound card device and it figures things out in context. With ecasound I don't know if you can pipe an output to an...output.


"We demand rigidly defined values of doubt and uncertainty!"

Offline

#8 2009-06-07 23:21:42

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: Alsa: redirect one card's output to another

Maybe this will work tongue

arecord -f S16_LE -r48000 -c2 -D hw:0 -F0 --period-size=1024 -B0 --buffer-size=4096 | unbuffered | aplay -D hw:1 -

unbuffered is in AUR.


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#9 2009-06-22 20:29:59

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: Alsa: redirect one card's output to another

did it work?


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#10 2009-06-22 22:46:58

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,724
Website

Re: Alsa: redirect one card's output to another

Sorry for the delayed reply, test1000. That pipe still has a very noticeable delay and the inclusion of "unbuffered" doesn't change anything.

I need to find the time and motivation to figure out the asoundrc configuration syntax which I still find cryptic. Something tells me that it should be possible with that.

Offline

#11 2009-06-23 08:08:12

Themaister
Member
From: Horten, Norway
Registered: 2008-07-21
Posts: 647
Website

Re: Alsa: redirect one card's output to another

Isn't this the time where you use PA or Jack? tongue

Offline

#12 2009-06-23 08:14:12

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,724
Website

Re: Alsa: redirect one card's output to another

Just about, yeah. I've never used either of them though and after taking a quick look at jack and qjackctl I'm still not sure how to do it. After wasting more time on the asoundrc wiki trying to figure this out, I'd appreciate it if someone could either tell me how to do this with jack or point me to a clear tutorial that will teach me.

Offline

#13 2009-06-23 08:47:02

Themaister
Member
From: Horten, Norway
Registered: 2008-07-21
Posts: 647
Website

Re: Alsa: redirect one card's output to another

Hmm. That gave me an idea for a wiki page. There's no JACK guide as far as I can see ... tongue

Well, the basic idea is that you start jack, go to "connections", and simply put a virtual "cable" from the mic input to the system output and voila, it should work. To problem here is that you're using two different sound cards, which might be troublesome. I don't know how to do that with Jack (loading two different sound cards at the same time, but of course, it should work)

Last edited by Themaister (2009-06-23 08:51:36)

Offline

#14 2010-10-20 02:34:46

k2000
Member
Registered: 2009-12-02
Posts: 33

Re: Alsa: redirect one card's output to another

hi you all,
I'm trying to do the same thing. I have a turntable plugged in my inboard sound card, it plays whitout any config from this soundcard, but I want it to play in the pci soundcard too.
Jackd seems to be the solution, but I did not find the way to do it yet...
So, subscribing to the post.

Offline

#15 2010-10-20 18:27:47

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: Alsa: redirect one card's output to another

Phonon and/or PulseAudio should allow choosing between multiple cards for playback and recording.

I've never used multiple devices at once, but I do believe jack only allows selection of subdevices, i.e the "interface" or card choice is only for one at a time, but you are allowed to choose input and output devices separately. You have the following options:

http://ubuntuforums.org/showthread.php?t=1128748

So apparently, you run one jack instance and then use jack_load to bring in the other devices.

Else:

http://ubuntuforums.org/showthread.php?t=464086

Else:

http://alsa.opensrc.org/index.php/TwoCardsAsOne

Some examples:

http://www.jrigg.co.uk/linuxaudio/ice1712multi.html
http://bpmdj.yellowcouch.org/jack.html

So then you'd have one interface, but at the same time you will end up with the ins/outs of both the (merged) cards.

Last edited by schivmeister (2010-10-20 18:29:35)


I need real, proper pen and paper for this.

Offline

#16 2010-10-20 23:05:54

k2000
Member
Registered: 2009-12-02
Posts: 33

Re: Alsa: redirect one card's output to another

Thanks schivmeister,
That looks quite complicated just for listening to old vinyls...
But the first link seems to be what I need. Gonna read it more carefully later.

[edit]
by the way, I like your signature wink

Last edited by k2000 (2010-10-20 23:07:22)

Offline

#17 2010-10-20 23:13:17

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 6,854

Re: Alsa: redirect one card's output to another

If you want to output on multiple cards at once Jack gives you the flexibility, but I do this with Pulseaudio and a 'combined' output (module-combine). Its only really useful to play exactly the same thing on all your cards, but since that's what I want... my music comes out through my inbuilt speakers/headphones, my BT headset, and the speakers on my cooling pad at the same time. Jack wouldn't be able to handle the BT, but otherwise would be much more flexible.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#18 2010-10-21 01:58:20

k2000
Member
Registered: 2009-12-02
Posts: 33

Re: Alsa: redirect one card's output to another

One of the links posted by schivmeister shows something like this, a 'combined' output, with alsa. I think that's what I will try. I rather stay with alsa if possible.
But what I want to achieve is having only the mic input coming out of the second sound card, on demand if possible (just when I use the turntable).
I already use this card for mpd output (https://bbs.archlinux.org/viewtopic.php?id=102677).

Offline

#19 2010-10-21 06:28:07

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 6,854

Re: Alsa: redirect one card's output to another

Well, I could tell you how to achieve that on Pulseaudio (its actually pretty simple) smile but on Alsa, you'd need a REAL expert.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#20 2010-10-21 16:48:43

k2000
Member
Registered: 2009-12-02
Posts: 33

Re: Alsa: redirect one card's output to another

Maybe one day I'll become one smile

Offline

#21 2010-10-23 18:24:00

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,724
Website

Re: Alsa: redirect one card's output to another

@ngoonee & k2000
Please post working solutions if you have/find them. I feel the same as k2000 in wanting to avoid Pulseaudio and Jack for something so seemingly trivial so I'm hoping a working Asla solution shows up, but others who find this thread might appreciate the Pulseaudio solution.

Offline

#22 2010-10-23 21:38:14

k2000
Member
Registered: 2009-12-02
Posts: 33

Re: Alsa: redirect one card's output to another

I have a solution for now, it's call a Y cable... wink
I think I will finally use pulseaudi, alsa seems too much headache and I don't really have lot of time to spend on this.
But I'm a bit afraid that installing pulseaudio will f**** all my existing sound settings...

Offline

#23 2010-10-23 22:55:03

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: Alsa: redirect one card's output to another

k2000 wrote:

But I'm a bit afraid that installing pulseaudio will f**** all my existing sound settings...

It will take over your machine, but that's not necessarily a bad thing.

Whatever works with jack will work with alsa. The only reason for using jack here is for the latency and visual routing. In fact, this scenario is even slower than standard mic-to-soundcard because the mic is connected to a different "soundcard" (so the sound travels between two distinct devices). But of course, you could try decreasing the alsa buffer/period sizes without jack if the recording app provides options for it.

Last edited by schivmeister (2010-10-23 23:13:36)


I need real, proper pen and paper for this.

Offline

#24 2010-10-25 02:33:37

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 6,854

Re: Alsa: redirect one card's output to another

With pulseaudio its almost dead-simple. Two steps:-

1. Load module-loopback
2. Open pavucontrol and set your module-loopback to take the correct sink/source.

That's it smile


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#25 2012-09-29 23:12:25

dll
Member
Registered: 2012-09-29
Posts: 1

Re: Alsa: redirect one card's output to another

Hi everybody,

Sorry for resurrecting an old thread but this might be helpful for those who end up here.

k2000 wrote:

I have a turntable plugged in my inboard sound card, it plays whitout any config from this soundcard, but I want it to play in the pci soundcard too.

To solve a similar problem (with three outputs instead) I added the following to my asound.conf file.

# Joins all equalizers into a single stereo output.
pcm.join {
        type plug
        slave.pcm multi
	slave.rate 48000
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
        ttable.0.4 1.0
        ttable.1.5 1.0
}
pcm.multi {
        type multi
        slaves.a.pcm "plugeqmun"
        slaves.a.channels 2
        slaves.b.pcm "plugeqspk"
        slaves.b.channels 2
        slaves.c.pcm "plugeqsub"
        slaves.c.channels 2
        bindings.0.slave a
        bindings.0.channel 0
        bindings.1.slave a
        bindings.1.channel 1
        bindings.2.slave b
        bindings.2.channel 0
        bindings.3.slave b
        bindings.3.channel 1
        bindings.4.slave c
        bindings.4.channel 0
        bindings.5.slave c
        bindings.5.channel 1
}

Then following siliciferous' advice I use ecasound and get a low enough latency with:

ecasound -B:rtlowlatency -b:128 -f:s32_le,2,44100 -i:alsahw,0,0 -o:alsa,join 

Voilá! No need to use Jack for this.

Offline

Board footer

Powered by FluxBB