Bugfix: if the prediction is too weak, scale the fallback properly.
This was a problem when doing large pitch-shifts, because the pitch-map ends up folding back on itself, causing sections of the spectrum to have 0 energy. This was fine for the max-energy channel, but dependent channels would then have a zero prediction, and would quote their input without energy-scaling.
This commit is contained in:
parent
ec3c6a253f
commit
f72fa99cfa
@ -318,7 +318,10 @@ private:
|
|||||||
|
|
||||||
Complex makeOutput(Complex phase) {
|
Complex makeOutput(Complex phase) {
|
||||||
Sample phaseNorm = std::norm(phase);
|
Sample phaseNorm = std::norm(phase);
|
||||||
if (phaseNorm <= noiseFloor) return input;
|
if (phaseNorm <= noiseFloor) {
|
||||||
|
phase = input; // prediction is too weak, fall back to the input
|
||||||
|
phaseNorm = std::norm(input) + noiseFloor;
|
||||||
|
}
|
||||||
return phase*std::sqrt(energy/phaseNorm);
|
return phase*std::sqrt(energy/phaseNorm);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user