Stereo sound manipulation

Questions about codecs, DVD playback, web plugins...
Forum rules
Before you post please read how to get help
Post Reply
ma343
Level 1
Level 1
Posts: 1
Joined: Tue Jan 07, 2020 2:44 pm

Stereo sound manipulation

Post by ma343 »

I wonder if there is any way to manipulate all sound currently playing the following way before output to headphones:

First step: If, for example, there's a sound in the left channel, it should be played at 75% in the left channel and 25% in the right channel. If there's a sound in the right channel, it should be played at 75% in the right channel and 25% in the left channel. (don't know the name for this)

Second step: Stereo balance should be adjusted so you can have louder sound in the left channel than in the right channel or vice versa. (I know that you can adjust this in sound settings but this must step must be after the first step in the sound processing)

There should be sliders for both these so that you can adjust the percentages in real-time.
User avatar
MrEen
Level 20
Level 20
Posts: 11788
Joined: Mon Jun 12, 2017 8:39 pm

Re: Stereo sound manipulation

Post by MrEen »

Hi ma343, and welcome to the forum.

I don't think that's doable although I could be wrong. I certainly have no idea how to split a single channel's output like you're asking about.

You could have mono output to each side, which your question is moving in the direction of but not all the way there. I rather doubt that's what you're trying to achieve though.
User avatar
powerwagon75
Level 4
Level 4
Posts: 277
Joined: Sun Feb 28, 2016 4:05 pm
Location: USA

Re: Stereo sound manipulation

Post by powerwagon75 »

Welcome! I second MrEen's comments, as I can't think of anything that will automatically adjust individual channel sound level, based on what channel the sound is coming through (I think that's what you wanted in Step 1?)

For your second step, you could try QasHctl from the Software Manager. If you play around with it you can find a setting that will allow a manual set of each channel. It persists through multiple sound inputs, and through reboots.

Don't know if it will help you at all in what you're trying to accomplish, but here's what I did:
QasHctl_channel_split.png
It's an oldie, but still works with ALSA.
Image
Custom tower w/Mint 18
HP laptop w/Mint 18
Acer w/W10/Mint 18.3
Macbook w/El Capitan/Mint 18.3
Optiplex 960 "Frankenbox" w/Fedora 30/Mint 18.3/Mint 19.2
Acer C720 Chromebook w/GalliumOS
Mac PPC G4 w/Lubuntu
Hoser Rob
Level 16
Level 16
Posts: 6243
Joined: Sat Dec 15, 2012 8:57 am

Re: Stereo sound manipulation

Post by Hoser Rob »

ma343 wrote:
Wed Jan 08, 2020 4:51 pm
... If, for example, there's a sound in the left channel, it should be played at 75% in the left channel and 25% in the right channel. ....
Really, who told you that? It's nonsense. There are no hard and fast rules for that.
rene
Level 16
Level 16
Posts: 6613
Joined: Sun Mar 27, 2016 6:58 pm

Re: Stereo sound manipulation

Post by rene »

ma343 wrote:
Wed Jan 08, 2020 4:51 pm
First step: If, for example, there's a sound in the left channel, it should be played at 75% in the left channel and 25% in the right channel. If there's a sound in the right channel, it should be played at 75% in the right channel and 25% in the left channel. (don't know the name for this)
That is basically halfway to a mono down-mix. I'm pretty certain that Jack would be able to do this in real-time but I've little hands-on experience with it. Pulseaudio might be able or might not, but the only way that I know is static and direct ALSA. I.e., if you create a file ~/.asoundrc containing e.g.

Code: Select all

pcm.monoish {
	slave.pcm	hw:0	
	slave.channels	2
	type route
	ttable {
		0.0	0.75
		1.0	0.25
		0.1	0.25
		1.1	0.75
	}
}

ctl.monoish {
	type hw
	card 0
}
in which you'd replace the 0 in "hw:0" and "card 0" with the actual card number you want to attach this to (as obtained from aplay -l) the "monoish" PCM does what you want here:

Code: Select all

speaker-test -D monoish -c 2
Note that if your card does not support S16_LE like some higher-end ones you need e.g. -F S32_LE to select a with your hardware compatible sample format.
ma343 wrote:
Wed Jan 08, 2020 4:51 pm
Second step: Stereo balance should be adjusted so you can have louder sound in the left channel than in the right channel or vice versa. (I know that you can adjust this in sound settings but this must step must be after the first step in the sound processing)
This part would at this point seem to be a general balance. I.e., alsamixer -D monoish, select the control and adjust left channel with Q/Z, right channel with E/C (F1 in alsamixer for help).
ma343 wrote:
Wed Jan 08, 2020 4:51 pm
There should be sliders for both these so that you can adjust the percentages in real-time.
As said, doing step 1 dynamically I would not know how, but expect that Jack could be configured, perhaps Pulseaudio...
Post Reply

Return to “Sound, Multimedia, & Codecs”