How to reorder channels?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings,

Someone has proposed a great idea recently: what if it were possible to play 
two audio tracks of a video file simultaneously, for example, when several 
people want to watch a film, but some want it translated and someone 
understands the film’s original language and prefers that track?

To implement that, one needs ALSA to have distinct devices for headphones and 
speakers, and one has to configure the media player accordingly.

Could you please tell me how does one perform the first part of the task? I’ve 
done a lot of research/RTFM, but none of my solutions were satisfactory.

(The second part: http://rsdn.ru/forum/message/3283171.1.aspx (in Russian). If 
someone’s interested, I can elaborate.)

I have an Intel HDA physical device (the one built into Asus P5GD1 
motherboard), which has eight channels (7.1), to which six (5.1) speakers are 
connected and also the headphones. ALSA thinks the headphones and the front 
channel of the speakers are the same, and I failed to configure it otherwise. 
However, because a pair of outputs (namely, the side channel) is free, an 
obvious solution would be to plug the front speakers there and have ALSA 
redirect the channels 0/1 to 6/7. I’m stuck with this seemingly trivial task 
though. If I use the route plugin, then two programs can’t output sound 
simultaneously, even if they use different channels. If I choose dshare, then 
it works, but mixing is gone: only one program can use a given channel, and 
Amarok won’t even start. If I use dmix, then I get annoying clicks every 
second or even more often.

Each of the asoundrc snippets below works in the sense aplay -D headphones, 
mplayer -ao alsa:device=speakers produce sound as intended, but each suffers 
from one of the above drawbacks. With the default settings mixing is 
completely OK; how do I just rearrange audio channels?

http://qwertty.com/tmp/alsa-info.txt is available, though I don’t think it’s 
needed.

My attempts:

#################### route ####################

pcm.hda71 {
    type plug
    slave.pcm "surround71"
}

pcm.headphones {
    type route
    slave.pcm "hda71"
    slave.channels 8
    ttable.0.0 1
    ttable.1.1 1
}

pcm.speakers {
    type route
    slave.pcm "hda71"
    slave.channels 8
    ttable.0.6 1
    ttable.1.7 1
    ttable.2.2 1
    ttable.3.3 1
    ttable.4.4 1
    ttable.5.5 1
}

#################### dshare ####################

pcm.headphones {
    type dshare
    ipc_key 3071
    slave.pcm "hw:0"
    slave.channels 8
    bindings {
        0 0
        1 1
    }
}

pcm.speakers {
    type dshare
    ipc_key 3071
    slave.pcm "hw:0"
    slave.channels 8
    bindings {
        0 6
        1 7
        2 2
        3 3
        4 4
        5 5
    }
}

pcm.!default {
    type dshare
    ipc_key 3071
    slave.pcm "hw:0"
    slave.channels 8
    channels 6
    bindings {
        0 0
        1 1
        0 6
        1 7
        2 2
        3 3
        4 4
        5 5
    }
}

#################### dmix ####################

pcm.hda71 {
    type dmix
    ipc_key 2071
    slave {
        pcm "hw:0,0"
        channels 8
        rate 48000
        periods 128
        period_time 0
        period_size 2048
        buffer_time 0
        buffer_size 4096
        # Experimented with settings a lot, clicks persist...
    }

}
pcm.headphones {
    type route
    slave.pcm "hda71"
    slave.channels 8
    ttable.0.0 1
    ttable.1.1 1
}

pcm.speakers {
    type route
    slave.pcm "hda71"
    slave.channels 8
    ttable.0.6 1
    ttable.1.7 1
    ttable.2.2 1
    ttable.3.3 1
    ttable.4.4 1
    ttable.5.5 1
}

pcm.!default {
    type route
    slave.pcm "hda71"
    slave.channels 8
    ttable.0.0 1
    ttable.1.1 1
    ttable.0.6 1
    ttable.1.7 1
    ttable.2.2 1
    ttable.3.3 1
    ttable.4.4 1
    ttable.5.5 1
}

-- 
TIA
Roman.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux