test-rtechs commited on
Commit
31c69b4
1 Parent(s): d79952a

Update voice_main.py

Browse files
Files changed (1) hide show
  1. voice_main.py +10 -4
voice_main.py CHANGED
@@ -17,7 +17,11 @@ from lib.audio import load_audio
17
  import soundfile as sf
18
  import edge_tts
19
  import asyncio
20
- from soni_translate.utils import remove_directory_contents, create_directories
 
 
 
 
21
  from scipy import signal
22
  from time import time as ttime
23
  import faiss
@@ -437,10 +441,12 @@ class ClassVoices:
437
  output_audio_path = new_path
438
 
439
  # Save file
440
- sf.write(
441
  file=output_audio_path,
442
  samplerate=final_sr,
443
- data=audio_opt
 
 
444
  )
445
 
446
  self.model_config[task_id]["result"].append(output_audio_path)
@@ -729,4 +735,4 @@ class ClassVoices:
729
  ):
730
  final_result.extend(self.model_config[tag]["result"])
731
 
732
- return final_result
 
17
  import soundfile as sf
18
  import edge_tts
19
  import asyncio
20
+ from soni_translate.utils import (
21
+ remove_directory_contents,
22
+ create_directories,
23
+ write_chunked,
24
+ )
25
  from scipy import signal
26
  from time import time as ttime
27
  import faiss
 
441
  output_audio_path = new_path
442
 
443
  # Save file
444
+ write_chunked(
445
  file=output_audio_path,
446
  samplerate=final_sr,
447
+ data=audio_opt,
448
+ format="ogg",
449
+ subtype="vorbis",
450
  )
451
 
452
  self.model_config[task_id]["result"].append(output_audio_path)
 
735
  ):
736
  final_result.extend(self.model_config[tag]["result"])
737
 
738
+ return final_result