Reply by Jerry Avins November 20, 20072007-11-20
Rock Lobster wrote:
> Hello, > > I know this isn't very DSP related ;) but I think you can help me here. > > I've got two different approaches for programming a balance control, and > I'm not sure which one to take. I tried examining other audio programs but > there were also differences. > > Let's say I load a WAV file and treat the left and right channel as two > entirely DIFFERENT audio tracks, but when played back, it should sound > exactly like it would when you played back the WAV file with a normal > player, and the balance control should also behave like that. > > Now the the two different solutions: > > 1) When balance is ranging from -1 to 0, the left channel remains > untouched, only the right channel is affected. When balance is ranging > from 0 to +1, it's of course the other way round. Let's say balance would > be on -0.5, then the left channel would still be played at 100% volume, > but the right channel only at 50% volume. > > 2) When balance is centered (0), both channels remain untouched. When > balance is on the left (-1), the left channel is played back twice as loud > and the right channel is completely silent. When balance is on the right > (+1), it's also the other way round. Now, when the balance is on -0.5, the > left channel is 150% as loud as normal, while the right channel is only > played back at 50% volume. > > What would be the better way? I think somehow the first one... but I'm not > sure. I played back a WAV file and directly recorded it, then played with > the balance control of the playback program, and it got me the first > result. I also tried a software synthesizer and let it play a sustained > synth tone, and then played with the balance control of that program while > recording, and it got me the second result. > > What do you think?
Start with the idea that a good balance control should be able to move a sound from left to right and anywhere between without changing the overall volume. Work that out using a file that has identical left and right channels. The balance control should distribute the audio power between left and right speakers in a way that keeps the sum of their powers constant. Work out the formulas for the gain settings that accomplish that and you'll have a good balance control. The methods you described can be seen as approximations to that design goal that give up accuracy for reduced computation. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by Rock Lobster November 20, 20072007-11-20
Hello,

I know this isn't very DSP related ;) but I think you can help me here.

I've got two different approaches for programming a balance control, and
I'm not sure which one to take. I tried examining other audio programs but
there were also differences.

Let's say I load a WAV file and treat the left and right channel as two
entirely DIFFERENT audio tracks, but when played back, it should sound
exactly like it would when you played back the WAV file with a normal
player, and the balance control should also behave like that.

Now the the two different solutions:

1) When balance is ranging from -1 to 0, the left channel remains
untouched, only the right channel is affected. When balance is ranging
from 0 to +1, it's of course the other way round. Let's say balance would
be on -0.5, then the left channel would still be played at 100% volume,
but the right channel only at 50% volume.

2) When balance is centered (0), both channels remain untouched. When
balance is on the left (-1), the left channel is played back twice as loud
and the right channel is completely silent. When balance is on the right
(+1), it's also the other way round. Now, when the balance is on -0.5, the
left channel is 150% as loud as normal, while the right channel is only
played back at 50% volume.

What would be the better way? I think somehow the first one... but I'm not
sure. I played back a WAV file and directly recorded it, then played with
the balance control of the playback program, and it got me the first
result. I also tried a software synthesizer and let it play a sustained
synth tone, and then played with the balance control of that program while
recording, and it got me the second result.

What do you think?