sergree / matchering

🎚️ Open Source Audio Matching and Mastering

Home Page:https://pypi.org/project/matchering/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mono vs stereo output

RoyJames opened this issue · comments

Hi,

Great repo! Just had one question: when both target and reference are stereo I think everything makes sense. But if both of them are mono, current code converts the target to stereo on loading by duplicating its channel. After all the matching process, the output is a stereo file containing two identical channels, which is essentially mono. Would there be any issue if we don't convert the input/target to stereo in the beginning?

Thanks,
Zhenyu

Hey, Zhenyu!
Current matchering can only handle stereo internally.
In any case, it will try to calculate the mid and side channels, even if the target / reference audio was previously in mono.

Basically, this step will fail:

mid, side = lr_to_ms(array)

Because the code assumes that there are exactly 2 channels:

def lr_to_ms(array: np.ndarray) -> (np.ndarray, np.ndarray):
array = np.copy(array)
array[:, 0] += array[:, 1]
array[:, 0] *= 0.5
mid = np.copy(array[:, 0])
array[:, 0] -= array[:, 1]
side = np.copy(array[:, 0])
return mid, side

And of course thank you for your kind words, @RoyJames.
They inspire. 😇

Thank you for the explanation. I'll do some changes on its output then.