Accurate Automatic Channel Balancing - Possible? |
![]() ![]() |
Accurate Automatic Channel Balancing - Possible? |
May 7 2013, 03:29
Post
#1
|
|
|
Group: Members Posts: 16 Joined: 13-February 13 Member No.: 106606 |
Let's say you have a source stereo track with unbalanced channels. (It's actually amazing how many CD's are like this.)
Using MasVis, here's an example track: ![]() What I have been trying so far, is to use Sox + batch files, to split the tracks into separate .l.wav and .r.wav mono files, then running WaveGain on the individual files, then once again using Sox + batch files to join the .l.wav and .r.wav files back into a stereo track. However, this isn't accurate, as the histograms are often off by a noticeable degree. Using Audacity, I can open the file, split the stereo track, then apply a "guess" to one channel, make the track stereo again, export, then load it into MasVis and see how I did, then use that result to undo and try again in Audacity until I get a result where the histogram in MasVis matches. Sometimes I can get it in one try, sometimes two, sometimes... several. It seems like there should be some way to do this automatically. Does anyone know of such a tool, or know if it would be possible to create one? |
|
|
|
May 7 2013, 03:50
Post
#2
|
|
|
Group: Members Posts: 2030 Joined: 31-August 05 Member No.: 24222 |
Its STEREO. The channels are NOT SUPPOSED to be "balanced" in the sense of being the same level.
|
|
|
|
May 7 2013, 04:00
Post
#3
|
|
![]() Group: Members Posts: 476 Joined: 22-December 03 From: Malmö, Sweden Member No.: 10615 |
Some programs come to mind. For the sake of discussion could you provide a 30 sec clip of a problematic recording?
|
|
|
|
May 7 2013, 06:56
Post
#4
|
|
![]() Group: Members Posts: 172 Joined: 22-March 09 Member No.: 68263 |
I can think of multiple reasons why a recording shouldn't be in on average in the center of the stereo image. Furthermore, looking at the graphs it seems you're only concerned about intensity stereo, but there's something called time-of-arrival stereophony too. This can either compensate for some offset in intensity stereo or create an offset itself, so there is probably no way to compensate for this automatically.
-------------------- Music: sounds arranged such that they construct feelings.
|
|
|
|
May 7 2013, 08:13
Post
#5
|
|
|
Group: Members Posts: 16 Joined: 13-February 13 Member No.: 106606 |
Some programs come to mind. For the sake of discussion could you provide a 30 sec clip of a problematic recording? Sure! Here's a commercial example (right click - save as): ChannelBalanceTest.wav Its STEREO. The channels are NOT SUPPOSED to be "balanced" in the sense of being the same level. They are if it's an effect I desire to achive for my own stuff and/or for my own reasons / own use. I can think of multiple reasons why a recording shouldn't be in on average in the center of the stereo image. Furthermore, looking at the graphs it seems you're only concerned about intensity stereo, but there's something called time-of-arrival stereophony too. This can either compensate for some offset in intensity stereo or create an offset itself, so there is probably no way to compensate for this automatically. That doesn't seem logical to me. The data for the histograms can surely be used to calculate an amount of amplification for one channel. If I can do it manually it should be able to be done automatically. This post has been edited by J.Fleming: May 7 2013, 08:14 |
|
|
|
May 7 2013, 08:18
Post
#6
|
|
|
Group: Members Posts: 16 Joined: 13-February 13 Member No.: 106606 |
Oh! Also, just to be clear, when I said:
Using Audacity, I can open the file, split the stereo track, then apply a "guess" to one channel... I meant to say, "apply an amplification guess to one channel..." (This board only allows edits for a short time after posting... which is good actually. |
|
|
|
May 7 2013, 12:51
Post
#7
|
|
|
Group: Members Posts: 16 Joined: 13-February 13 Member No.: 106606 |
Here is the sample wav file I posted above in MasVis:
![]() Here is the result from splitting the left and right channels with Sox to two individual mono files, applying "Radio" or track gain in WaveGain to both files (default 89 dB), then rejoining them with Sox (-1.85 dB to the left channel, -1.04 to the right channel): ![]() Here is the result from manual adjustment in Audacity. It took 6 tries for me to get the best result... apply amplification to the left channel, export, load in MasVis, try again until best result, which was +2.10 dB to the left channel: ![]() I was hoping for some kind of way to do this automatically. Yes, I'm aware that this isn't applicable 100% of the time. Yes, I'm aware of the reasons not to do this. That doesn't stop me from wanting some kind of way to do it, in some cases, for my own reasons, so it isn't really constructive or helpful to tell me I shouldn't be doing this or wanting a way to do it automatically. But I do understand the reasoning. Thanks very much for the replies so far! |
|
|
|
May 7 2013, 13:31
Post
#8
|
|
|
Group: Members Posts: 16 Joined: 13-February 13 Member No.: 106606 |
By the way, Audacity has a "Normalize" effect that does have a "Normalize Stereo Channels Independently" check box that attempts to do what I'm describing, it just doesn't do it accurately; here's the test .wav file with Audacity's "Normalize" effect set to -3 dB and the "Normalize Stereo Channels Independently" check box checked:
![]() |
|
|
|
May 7 2013, 14:16
Post
#9
|
|
|
Group: Members Posts: 4129 Joined: 2-September 02 Member No.: 3264 |
If I understand correctly you're basically asking for software that can simulate your personal preference for stereo balance automatically? I don't think that's going to be possible without a lot of trial and error tuning on your part.
|
|
|
|
May 7 2013, 14:18
Post
#10
|
|
![]() Group: Members Posts: 172 Joined: 22-March 09 Member No.: 68263 |
I can think of multiple reasons why a recording shouldn't be in on average in the center of the stereo image. Furthermore, looking at the graphs it seems you're only concerned about intensity stereo, but there's something called time-of-arrival stereophony too. This can either compensate for some offset in intensity stereo or create an offset itself, so there is probably no way to compensate for this automatically. That doesn't seem logical to me. The data for the histograms can surely be used to calculate an amount of amplification for one channel. If I can do it manually it should be able to be done automatically. Then I'll try to explain it. Stereo is a illusion, in which we try to trick the human mind into hearing a wide 'soundstage' while using only two speakers. This can be done in several ways, but the best known one is intensity stereo, where a sound source is louder on the left channel than it is on the right channel, which creates the illusion of the sound source coming from somewhere left of the middle, depending on the difference between left and right. So far so good. However, there is a second way to trick the mind into thinking it hears something somewhere, which is called time-of-arrival or phase stereo. This is what you hear exaggerated when you connect one speaker the wrong way. If you delay the left channel by a tiny amount, the human mind will think the source of the sound is right of the middle. For more information, you can take a look here: https://en.wikipedia.org/wiki/Stereophonic_...val_stereophony What I'm trying to say is that making both channels the same loudness might not be enough to get the stereo image in the middle, because time-of-arrival stereo (which is AFAIK hard to measure, if it is possible at all) can get in the way. Because you got it working on a few test cases doesn't mean it will work on all music. I don't know what kind of music you're trying to do this on, but most classical music and some jazz recordings rely as much on time-of-arrival stereo as they do on intensity stereo. Most music recorded using overdubbing only have been panpotted and therefore do not use time-of-arrival stereo. Time-of-arrival stereo is also used for creating a surround illusion with only two speakers, so if a recording was multichannel but has been mastered to stereo, time-of-arrival stereo might be in there too. Even if it is only intensity stereo, getting 'the average' might not be suiting your needs. For example, if I take a recording with a continuous sound (synth or something) exactly in the middle and a occasional drum beat on the left, averaging this will shift the synth to the right while it probably should stay in the middle. I'm not sure whether an automated process can do this right all the time, because stereo placement is something subjective. I hope that was clear. This post has been edited by ktf: May 7 2013, 14:20 -------------------- Music: sounds arranged such that they construct feelings.
|
|
|
|
May 7 2013, 17:00
Post
#11
|
|
|
Group: Members Posts: 16 Joined: 13-February 13 Member No.: 106606 |
Well, Okay then. I thought I was illustrating a simple issue involving channel gain.
It's clear I probably won't get any help here. But I do appreciate the replies, especially the time ktf took. While there is a lot of great info there, it doesn't really help me. Sorry if I ruffled any feathers. |
|
|
|
May 7 2013, 18:37
Post
#12
|
|
|
Group: Members Posts: 2114 Joined: 24-August 07 From: Silicon Valley Member No.: 46454 |
GoldWave ($50 USD after free trial) has a tool called MaxMatch. It maximizes (normalizes the peak to 0dB) while balancing (matching) the average left & right volume. Since the difference between peak & average is different in each channel, only one channel will have a 0dB peak, after running MaxMatch.
The only way to match both the peaks and the average is to use dynamic compression. Of course, that reduces the musical dynamics (at least in one channel), and it would probably require trial & error because you typically can't predict precisely what a compressor/limiter is going to do to the average. As others have suggested, pro mixing & mastering engineers do it by ear. I've only used MaxMatch on my own analog recordings (usually digitized LPs). Sometimes I've had to reduce the analog gain and the left & right gains might be a couple of dB off or my phono cartridge might not be perfectly balanced... Basically, I'm trying to correct something in my system. I'm usually not second-guessing the mixing/mastering engineer. I've never noticed a problem on a CD (by listening). If you can measure the peak & average of both channels (I think SOX can do those measurements) you can do all of that "manually" by making some calculations and adjusting the left & right channels separately, If you want to simplify the math: - Normalize each channel separately. (Adjust the peaks to 0dB, or near 0dB) . - After normalizing, adjust-down the volume of the channel with the higher average volume to match average of the other channel. WAVgain might give you a slightly better loudness indication than a simple average, but I wouldn't expect a significantly different end-result, since the left & right channels should have similar "character". |
|
|
|
May 8 2013, 20:45
Post
#13
|
|
|
Group: Developer (Donating) Posts: 2040 Joined: 19-October 01 From: Finland Member No.: 322 |
It seems you picked bad volume normalizers to do your tests with, J.Fleming. I separated the channels of your linked test file and ran them both through EBU R128-based ReplayGain scanner in foobar2000 and made new files with 3dB gain boost (to negate the level loss from ReplayGain) and dither. After combining the channels MasVis gives me this result, which to my eyes looks much closer than your manual adjustments:
![]() |
|
|
|
May 9 2013, 05:00
Post
#14
|
|
|
Group: Members Posts: 16 Joined: 13-February 13 Member No.: 106606 |
Hey Case! THANK YOU!! I wasn't even aware of the new R128 standard. This is exactly the kind of info I was after. Thanks so much for this!!
DVDdoug, thanks for the tip. I do have GoldWave, and I did go in there and try that, but it's pretty much the same as Audacity's "Normalize" filter with the separate stereo channels ticked. Not sure what you mean by dynamic compression as the "only way." I'm not talking about forcing anything other than gain on a single channel, as shown by my MasVis pics it works in the cases I'm talking about. Thanks again for the info you posted ktf. I was already aware of it (but reading it was a good refresher, I needed it). In this case I'm pretty much talking about instances where the channel levels are SUPPOSED to be balanced, but aren't. This post has been edited by J.Fleming: May 9 2013, 05:02 |
|
|
|
May 9 2013, 05:28
Post
#15
|
|
|
Group: Members Posts: 16 Joined: 13-February 13 Member No.: 106606 |
By the way Case, is there any reason you recommend dithering on 16 bit wav files?
|
|
|
|
May 9 2013, 06:24
Post
#16
|
|
|
Group: Members Posts: 2030 Joined: 31-August 05 Member No.: 24222 |
Doing transforms results in quantization errors. This shows up in the audio as distortion and noise. Dithering eliminates the distortion.
Working in 24 bit reduces the size of each error considerably. Floating point is better still. You do not need to dither the operations if you work in floating point format. If you are going to do more than one operation, results will be cleaner if you first convert to floating point format, then leave it there until you are absolutely finished. Convert the final result back to 16 bit -- with dither. My original comment was because your post seemed to strongly express ignorance of what stereo is It's actually amazing how many CD's are like this. It isn't amazing or even the slightest bit strange or unexpected. The content of the two channels is very often, nay, normally and almost always, different. Sometimes only a little different, sometimes greatly different. There is no reason you shouldn't try to match levels or distribution, if you want to, but to not understand that you are trying to make two different things come out the same in certain measurements which intrinsically display those inherent differences, could lead to a lot of frustration and wrong thinking. |
|
|
|
May 9 2013, 18:04
Post
#17
|
|
|
Group: Members Posts: 2114 Joined: 24-August 07 From: Silicon Valley Member No.: 46454 |
QUOTE DVDdoug, thanks for the tip. I do have GoldWave, and I did go in there and try that, but it's pretty much the same as Audacity's "Normalize" filter with the separate stereo channels ticked. No.... Normalizing (what GoldWave calls "Maximize") uses the peaks as a reference, and by normalizing separately you are matching the peaks. MaxMatch, matches the average levels. QUOTE Not sure what you mean by dynamic compression as the "only way." It's the only way to match both the peaks and the average. By using compression you can boost the average level without boosting or clipping the peaks. I not recommending that you use compression... For example, say you have a file that's normalized with 0dB peaks in both channels, but the average in one channel is -18dB, and the other channel's average is -22dB. If you reduce the "louder" channel down to -22dB, that channel will now have a peak of -4dB. Or, let's say you have the opposite situation where the channels are matched & balanced with an average of -18dB, but one channel has a maximum peak of 0dB and the other channel has a maximum peak of -4dB. If you normalize separately, one channel will be boosted by +4dB, it's average will now be -14dB, and the channels will be out-of-balance. Of course, you can also have a situation where both the peaks & averages are different in both channels, yet it sounds perfectly balanced. On a modern CD, the most common situation is th have both channels normalized to 0dB, slightly different averages in both channels, and balanced sound. This post has been edited by DVDdoug: May 9 2013, 18:12 |
|
|
|
May 13 2013, 04:14
Post
#18
|
|
|
Group: Members Posts: 78 Joined: 16-June 11 Member No.: 91562 |
Not sure that you really want either peak normalization or use dynamic compression. But, you might look at the file with AudioLEAK (http://www.channld.com/audioleak/) which will return data on the channel levels using the Leq algorithm, which comes much closer to a "loudness" measurement than peak or average. You'll get better channel balance data that way, but it's still not an automatic corrector.
This post has been edited by db1989: May 13 2013, 13:39
Reason for edit: deleting pointless full quote of previous post
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 19th May 2013 - 00:31 |