[pulseaudio-discuss] mixing and selecting left and right channels

Colin Guthrie gmane at colin.guthr.ie
Sat Jul 11 04:00:13 PDT 2009


Hiya

'Twas brillig, and Max Waterman at 11/07/09 08:47 did gyre and gimble:
> I'm new to this list - I hope this is the right place for my question.

Yup this is the right place. Welcome aboard :)

> I'm deaf in one ear, and am a linux developer. I would like to attempt 
> to develop an application that will allow me to choose any 
> combination/selection of the left and right input and output channels.
> 
> The most significant combination to me is 'mix of left and right 
> channels to output on only left channel', but there are quite a few 
> other combinations that could be useful for others.
> 
> For example, some language learning tracks have one language on the left 
> channel and another language on the right, and being able to select just 
> one channel is important, preferably to both left and right outputs at 
> the same time.
> 
> Another example is; being deaf in my right ear, I don't bother putting 
> the right ear-phone in, and leave it dangling. This means that the sound 
> leaks and it annoying to others sitting nearby. So, being able to have 
> just one channel play (as a mix of left and right inputs) is desirable.
> 
>  From reading the documentation, it seems like I should be able to do 
> what I want with pulseaudio, but the mixing discussions all seem to be 
> about different stereo sources, rather than mixing/selecting left and 
> right channels.
> 
> Perhaps there's already a tool to do this, though I doubt it since the 
> demand is quite niche.
> 
> Can someone give me some guidance?

You can do this but sadly not via a nice GUI (yet - I'm half working on 
it!).

What you want is a module called "module-remap-sink":
http://www.pulseaudio.org/wiki/Modules#module-remap-sink

Now I've not really played too much with this but as far as I know, 
there is no way to change the mixing characteristcs here (e.g. the 
levels of the channels you're downmixing - taking 100% left + 50% right 
for example).

It does the very basic part of what you want tho' (stereo->mono) and 
perhaps others can suggest if there is a way to do the controlled mixing?

It would (IMO) be quite hard to present a multi channel mixer for this 
sink in the GUI...

Although (just thinking out load), perhaps you can hack this up.....

Perhaps create your mono sink with module-remap-sink using your alsa 
device as the master and then create another rempapped sink to upmix 
your previous mono remap back to two channels. In pavucontrol you should 
then see three output devices. Your alsa one, the mono remap and the 
stereo upmixed remap. If you play something and output it to the upmixed 
stereo sink, I think you'll get independent left+right sliders that will 
affect how this ultimately comes out of the left channel of your alsa 
sink :)


load-module module-remap-sink sink_name=mono master=<ALSA SINK NAME> 
channels=1 master_channel_map=front-left channel_map=mono

load-module module-remap-sink sink_name=fakestereo master=mono 
channels=2 master_channel_map=mono,mono channel_map=front-left,front-right


That should work! (note that with newer pulse you can also pass 
sink_properties="device.description='My Name'"
to set nice names in pavucontrol.

I did just try this and while it appeared to work I didn't really have 
any suitable test tracks. It should also point out that I do seem to get 
some distortion of the sound after adjusting the volumes, so I think 
there is a bug somewhere too....


HTHs tho' :)

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
   Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
   Mandriva Linux Contributor [http://www.mandriva.com/]
   PulseAudio Hacker [http://www.pulseaudio.org/]
   Trac Hacker [http://trac.edgewall.org/]




More information about the pulseaudio-discuss mailing list