sergree / matchering

🎚️ Open Source Audio Matching and Mastering
https://pypi.org/project/matchering/
GNU General Public License v3.0
1.29k stars 151 forks source link

mono vs stereo output #42

Closed RoyJames closed 2 years ago

RoyJames commented 2 years ago

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

sergree commented 2 years ago

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: https://github.com/sergree/matchering/blob/a05b1a8f429222b9179f3d476e6488a1b5915e31/matchering/stage_helpers/match_levels.py#L139

Because the code assumes that there are exactly 2 channels: https://github.com/sergree/matchering/blob/a05b1a8f429222b9179f3d476e6488a1b5915e31/matchering/dsp.py#L57-L64

sergree commented 2 years ago

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

RoyJames commented 2 years ago

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