MCPcopy
hub / github.com/OpenBMB/VoxCPM / _run_single

Function _run_single

src/voxcpm/cli.py:244–271  ·  view source on GitHub ↗
(args, parser, *, text: str, output: str, prompt_text: str | None)

Source from the content-addressed store, hash-verified

242
243
244def _run_single(args, parser, *, text: str, output: str, prompt_text: str | None):
245 output_path = validate_output_path(output)
246
247 if args.prompt_audio:
248 require_file_exists(args.prompt_audio, parser, "prompt audio file")
249 if args.reference_audio:
250 require_file_exists(args.reference_audio, parser, "reference audio file")
251
252 model = load_model(args)
253
254 audio_array = model.generate(
255 text=text,
256 prompt_wav_path=args.prompt_audio,
257 prompt_text=prompt_text,
258 reference_wav_path=args.reference_audio,
259 cfg_value=args.cfg_value,
260 inference_timesteps=args.inference_timesteps,
261 normalize=args.normalize,
262 denoise=args.denoise
263 and (args.prompt_audio is not None or args.reference_audio is not None),
264 )
265
266 import soundfile as sf
267
268 sf.write(str(output_path), audio_array, model.tts_model.sample_rate)
269
270 duration = len(audio_array) / model.tts_model.sample_rate
271 print(f"Saved audio to: {output_path} ({duration:.2f}s)", file=sys.stderr)
272
273
274def cmd_design(args, parser):

Callers 2

cmd_designFunction · 0.85
cmd_cloneFunction · 0.85

Calls 4

validate_output_pathFunction · 0.85
require_file_existsFunction · 0.85
load_modelFunction · 0.70
generateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…