liubaiji commited on
Commit
df653f1
1 Parent(s): c901a12

[refator] modify fade_in_out func to a commom form

Browse files
Files changed (1) hide show
  1. cosyvoice/utils/common.py +3 -2
cosyvoice/utils/common.py CHANGED
@@ -139,6 +139,7 @@ def fade_in_out(fade_in_mel, fade_out_mel, window):
139
  device = fade_in_mel.device
140
  fade_in_mel, fade_out_mel = fade_in_mel.cpu(), fade_out_mel.cpu()
141
  mel_overlap_len = int(window.shape[0] / 2)
142
- fade_in_mel[:, :, :mel_overlap_len] = fade_in_mel[:, :, :mel_overlap_len] * window[:mel_overlap_len] + \
143
- fade_out_mel[:, :, -mel_overlap_len:] * window[mel_overlap_len:]
 
144
  return fade_in_mel.to(device)
 
139
  device = fade_in_mel.device
140
  fade_in_mel, fade_out_mel = fade_in_mel.cpu(), fade_out_mel.cpu()
141
  mel_overlap_len = int(window.shape[0] / 2)
142
+
143
+ fade_in_mel[..., :mel_overlap_len] = fade_in_mel[..., :mel_overlap_len] * window[:mel_overlap_len] + \
144
+ fade_out_mel[..., -mel_overlap_len:] * window[mel_overlap_len:]
145
  return fade_in_mel.to(device)