From 85ed5d9e861ec01d4e90f839ccb6b554d8132adf Mon Sep 17 00:00:00 2001 From: Katsuya Iida Date: Sat, 14 Oct 2023 08:37:07 +0900 Subject: [PATCH] Add doc comments (#24) --- NeMoOnnxSharp.Example/Program.cs | 37 +++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/NeMoOnnxSharp.Example/Program.cs b/NeMoOnnxSharp.Example/Program.cs index 55fe82f..866ba20 100644 --- a/NeMoOnnxSharp.Example/Program.cs +++ b/NeMoOnnxSharp.Example/Program.cs @@ -18,23 +18,23 @@ static async Task Main(string[] args) if (task == "transcribe") { - await Transcribe(); + await TranscribeAsync(); } else if (task == "speak") { - await Speak(); + await SpeakAsync(); } else if (task == "vad") { - await FramePredict(false); + await FramePredictAsync(false); } else if (task == "mbn") { - await FramePredict(true); + await FramePredictAsync(true); } else if (task == "streamaudio") { - await StreamAudio(); + await StreamAudioAsync(); } else { @@ -42,7 +42,11 @@ static async Task Main(string[] args) } } - static async Task Transcribe() + /// + /// Using EncDecCTCModel with QuartzNet to transcribe texts from speech audio. + /// + /// + static async Task TranscribeAsync() { string appDirPath = AppDomain.CurrentDomain.BaseDirectory; string modelPath = await DownloadModelAsync("stt_en_quartznet15x5"); @@ -68,7 +72,12 @@ static async Task Transcribe() } } - static async Task Speak() + /// + /// Use high level API SpeechSynthesizer with FastSpeech and HifiGAN + /// + /// + /// + static async Task SpeakAsync() { string appDirPath = AppDomain.CurrentDomain.BaseDirectory; string phonemeDict = await DownloadModelAsync("cmudict-0.7b_nv22.10"); @@ -106,7 +115,12 @@ static async Task Speak() } } - static async Task FramePredict(bool mbn) + /// + /// Use EncDecClassficationModel with MarbleNet for VAD or speech classification + /// + /// + /// + static async Task FramePredictAsync(bool mbn) { string appDirPath = AppDomain.CurrentDomain.BaseDirectory; string modelPath = await DownloadModelAsync( @@ -135,13 +149,16 @@ static async Task FramePredict(bool mbn) } } - static async Task StreamAudio() + /// + /// Use high level API SpeechRecognizer with MarbleNet and QuartzNet + /// + /// + static async Task StreamAudioAsync() { string appDirPath = AppDomain.CurrentDomain.BaseDirectory; string vadModelPath = await DownloadModelAsync("vad_marblenet"); string asrModelPath = await DownloadModelAsync("stt_en_quartznet15x5"); string inputDirPath = Path.Combine(appDirPath, "..", "..", "..", "..", "test_data"); - string inputPath = Path.Combine(inputDirPath, "transcript.txt"); var config = new SpeechConfig {