extreme value filtering

This commit is contained in:
RVC-Boss 2023-06-18 15:30:56 +08:00 committed by GitHub
parent a9a77f2556
commit cbd29350fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -53,7 +53,11 @@ class PreProcess:
os.makedirs(self.wavs16k_dir, exist_ok=True)
def norm_write(self, tmp_audio, idx0, idx1):
tmp_audio = (tmp_audio / np.abs(tmp_audio).max() * (self.max * self.alpha)) + (
tmp_max=np.abs(tmp_audio).max()
if(tmp_max>2.5):
print("%s-%s-%s-filtered"%(idx0,idx1,tmp_max))
return
tmp_audio = (tmp_audio / tmp_max * (self.max * self.alpha)) + (
1 - self.alpha
) * tmp_audio
wavfile.write(