spark-tts commited on
Commit
aaaf9fd
·
1 Parent(s): 42e86e8

fix prompt audio length bug

Browse files
Files changed (1) hide show
  1. sparktts/models/audio_tokenizer.py +2 -2
sparktts/models/audio_tokenizer.py CHANGED
@@ -65,11 +65,11 @@ class BiCodecTokenizer:
65
 
66
  if ref_segment_length > wav_length:
67
  # Repeat and truncate to handle insufficient length
68
- wav = np.tile(wav, (1 + ref_segment_length) // wav_length)
69
 
70
  return wav[:ref_segment_length]
71
 
72
- def process_audio(self, wav_path: Path) -> Tuple[torch.Tensor, torch.Tensor]:
73
  """load auido and get reference audio from wav path"""
74
  wav = load_audio(
75
  wav_path,
 
65
 
66
  if ref_segment_length > wav_length:
67
  # Repeat and truncate to handle insufficient length
68
+ wav = np.tile(wav, ref_segment_length // wav_length + 1)
69
 
70
  return wav[:ref_segment_length]
71
 
72
+ def process_audio(self, wav_path: Path) -> Tuple[np.ndarray, torch.Tensor]:
73
  """load auido and get reference audio from wav path"""
74
  wav = load_audio(
75
  wav_path,