Calculating RMS/Crest Factor for a Stereo Signal I'm doing some MIR related work with stereo audio and am a little unsure on how to proceed with some basic tasks.  All my academic work prior to this has involved forcing audio to "mono" to perform analysis, and I'm trying to avoid that as much as possible here.

So, for example, I have a crest factor function in python that looks like this for an array of audio data (either mono, left, or right channel):

def get_cf(data, win_size):
    """
    data: audio array in mono, left, or right channel only
    win_size: size in samples for the block analysis (created in calc_crest_factor)

    calc_crest_factor passes mono style data to this function to get the crest factor.

    returns: the crest factor for each window"""
    # Buffer the signal matrix-style (input, block-size, hop-size)
    data_matrix = librosa.util.frame(data, win_size, win_size)

    peaks = np.amax(np.absolute(data_matrix), axis=0)

    # Get the mean-square over each window
    RMS = np.sqrt(np.mean(np.square(data_matrix), axis=0))

    # Get crest factor for each window
    return np.divide(peaks, RMS)


In another function, I call the function above like so for stereo audio:

 if len(data) == 2:
    crest_factor_l = get_cf(data[0,:], win_size)
    crest_factor_r = get_cf(data[1,:], win_size)


And here I now have a crest factor for the right channel and one for the left channel, but am unsure on how to proceed on getting a final "crest factor" value for the audio.  Do I just choose the greater of the two values for each window?  Or is it more correct to keep both values?

This same question goes for RMS too.  I know in my pro audio applications, stereo audio gets passed to some RMS calculator and a single value gets pumped out.  How do the two separate channels with two separate values for either Crest Factor or RMS become 1 value while honoring the "stereoness" of the data?
Conceptually you can think of it as creating one mono signal by concatenating the left and the right channel signals, and then computing the RMS and the Crest factor of that mono signal. With $N$ the number of samples in the current frame, and $x_l[n]$ and $x_r[n]$ the left and right channel signals, respectively, you get the following formulas:

$$\begin{align}x_{\text{rms}}&amp;=\sqrt{\frac{1}{2N}\left[\sum_{n=0}^{N-1}x^2_l[n]+\sum_{n=0}^{N-1}x^2_r[n]\right]}=\sqrt{\frac12\left(x^2_{l,\text{rms}}+x^2_{r,\text{rms}}\right)}\\
C&amp;=\frac{\max\{|x_l[n]|,|x_r[n]|\}}{x_{\text{rms}}}\end{align}$$

where $x_{l,\text{rms}}$ and $x_{r,\text{rms}}$ are the RMS values of the left and right channel, respectively.