Yiwen Zhao commited on
Commit
b20ddc7
·
1 Parent(s): 4e0d427

add jp example

Browse files
Files changed (1) hide show
  1. svs_utils.py +9 -4
svs_utils.py CHANGED
@@ -279,14 +279,20 @@ if __name__ == "__main__":
279
  cache_dir="cache",
280
  device="cuda", # "cpu"
281
  melody_source="random_generate", # "random_select.take_lyric_continuation"
282
- lang="zh",
283
  speaker="resource/singer/singer_embedding_ace-2.npy",
284
  )
285
 
286
  # load model
287
  model = svs_warmup(config)
288
 
289
- answer_text = "天气真好\n空气清新\n气温温和\n风和日丽\n天高气爽\n阳光明媚"
 
 
 
 
 
 
290
 
291
  sample_rate = 44100
292
 
@@ -300,7 +306,6 @@ if __name__ == "__main__":
300
  )
301
 
302
  # then, phrase_length info should be added to llm prompt, and get the answer lyrics from llm
303
- # e.g. answer_text = "天气真好\n空气清新"
304
  additional_kwargs = {"song_db": song_db, "metadata": metadata}
305
  else:
306
  additional_kwargs = {}
@@ -309,4 +314,4 @@ if __name__ == "__main__":
309
 
310
  # write wav to output_retrieved.wav
311
  save_name = config.melody_source
312
- sf.write(f"{save_name}.wav", wav_info, samplerate=sample_rate)
 
279
  cache_dir="cache",
280
  device="cuda", # "cpu"
281
  melody_source="random_generate", # "random_select.take_lyric_continuation"
282
+ lang="jp",
283
  speaker="resource/singer/singer_embedding_ace-2.npy",
284
  )
285
 
286
  # load model
287
  model = svs_warmup(config)
288
 
289
+ if config.lang=="zh":
290
+ answer_text = "天气真好\n空气清新\n气温温和\n风和日丽\n天高气爽\n阳光明媚"
291
+ elif config.lang=="jp":
292
+ answer_text = "せ か い で い ち ば ん お ひ め さ ま\nそ う い う あ つ か い\nこ こ ろ え て よ ね" #
293
+ else:
294
+ print(f'Currently system does not support {config.lang}')
295
+ exit(1)
296
 
297
  sample_rate = 44100
298
 
 
306
  )
307
 
308
  # then, phrase_length info should be added to llm prompt, and get the answer lyrics from llm
 
309
  additional_kwargs = {"song_db": song_db, "metadata": metadata}
310
  else:
311
  additional_kwargs = {}
 
314
 
315
  # write wav to output_retrieved.wav
316
  save_name = config.melody_source
317
+ sf.write(f"{save_name}_{config.lang}.wav", wav_info, samplerate=sample_rate)