My Friends,
This is just amazing! OpenAI has released software that makes Googles, subscription, Speech to Text Service, obsolete!
Whisper is a Python based AI, Transformer Model, that can take any source, Audio Text, Singing, almost anything, and it converts it to Text:
This is the best, most powerful software I have ever seen! The old fashioned Mouse and Keyboard may become obsolete sooner rather than later!
If one wants to use C# to run this, there are some options:
From Python:
import whisper
model = whisper.load_model("base")
result = model.transcribe("audio.mp3")
print(result["text"])
In C#:
Run("Path/To/Python.3.9.9.exe", "PythonScript.py");
/// <summary>
/// Run an Executable.
/// </summary>
/// <param name="filename"></param>
/// <param name="arguments"></param>
/// <returns></returns>
public static string Run(string filename, string arguments = null)
{
// The stdError Output:
string stdError = null;
// Th stdOutput:
var stdOutput = new StringBuilder();
// Check Args:
if (arguments == null)
{
arguments = "";
}
// Init a new Process:
Process process = new Process
{
StartInfo =
{
FileName = filename,
Arguments = arguments,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true
}
};
// OutputDataReceived:
process.OutputDataReceived += (sender, args) => stdOutput.AppendLine(args.Data);
// ErrorDataReceived:
process.ErrorDataReceived += (sender, args) => { stdError += args.Data; };
try
{
// Start the Process:
process.Start();
// Asynchronous Reading of the Output Data:
process.BeginOutputReadLine();
process.BeginErrorReadLine();
// Wait for the Process to Exit:
process.WaitForExit();
}
catch (Exception e)
{
throw new Exception("Error: " + e.Message, e);
}
// Check Exit Code:
if (process.ExitCode == 0)
{
// Return Output Data:
return stdOutput.ToString().Replace("\r\n", "").Trim();
}
else
{
throw new Exception("Perhaps a corrupt Input File?\r\n\r\n" + filename + ". Exit code = " + process.ExitCode + ": " + stdError.Replace("\r\n", "").Trim());
}
}
Or if you want to, you can use IronPython.
Best Wishes
Chris