元编程参考文档

语音模型

5 个节点

本页内容 5

加载语音识别器

函数

Loads a speech recognizer, its feature extractor and its tokenizer from a Hub repository or a folder.

签名
加载语音识别器 -> Speech Recognizer
    模型: 文本
    设备: Compute Device
    精度: Precision
    后端: Model Backend
SpeechRecognizer LoadSpeechRecognizer(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    ModelBackend backend = ModelBackend.TorchSharp)

参数

名称类型默认值说明
模型文本—A repository id such as openai/whisper-tiny or facebook/wav2vec2-base-960h, or for the ONNX backend onnx-community/whisper-tiny (onnx-community/whisper-tiny_timestamped for word times) or Xenova/wav2vec2-base-960h; or a folder.
设备Compute Device自动Where it runs on TorchSharp.
精度Precision自动The number format of its weights on TorchSharp.
后端Model BackendTorchSharpWhat runs it: TorchSharp, or the ONNX backend on the CPU, which reads the repository's ONNX files or builds a graph from its checkpoint.

返回

识别器Speech Recognizer
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
语音模型
所属包
机器学习

转写

函数

What is said in a clip, as text.

签名
转写 -> 文本
    识别器: Speech Recognizer
    音频: WAVAudioPayload
    语言: 文本
    设置: Transcription Settings
string Transcribe(
    SpeechRecognizer recognizer,
    WAVAudioPayload audio,
    string language,
    TranscriptionSettings settings)

参数

名称类型默认值说明
识别器Speech Recognizer—A speech recognizer.
音频WAVAudioPayload—The clip, at the recognizer's sample rate (16000 Hz for Whisper); Resample converts one that is not. Stereo is mixed to mono.
语言文本—For Whisper, the language spoken, such as en or english; empty to let it tell.
设置Transcription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

返回

文本文本
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
语音模型
所属包
机器学习

转写文件

函数

What is said in a WAV file, as text.

签名
转写文件 -> 文本
    识别器: Speech Recognizer
    路径: 文本
    语言: 文本
    设置: Transcription Settings
string TranscribeFile(
    SpeechRecognizer recognizer,
    string path,
    string language,
    TranscriptionSettings settings)

参数

名称类型默认值说明
识别器Speech Recognizer—A speech recognizer.
路径文本—A WAV file at the recognizer's sample rate.
语言文本—For Whisper, the language spoken; empty to let it tell.
设置Transcription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

返回

文本文本
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
语音模型
所属包
机器学习

带时间转写

函数

What is said in a clip, in the segments the recognizer heard, with when each starts and ends.

签名
带时间转写 -> (片段: 文本数组, 起始: 数字数组, 结束: 数字数组)
    识别器: Speech Recognizer
    音频: WAVAudioPayload
    语言: 文本
    设置: Transcription Settings
string[] TranscribeWithTimes(
    SpeechRecognizer recognizer,
    WAVAudioPayload audio,
    string language,
    out double[] starts,
    out double[] ends,
    TranscriptionSettings settings)

参数

名称类型默认值说明
识别器Speech Recognizer—A speech recognizer.
音频WAVAudioPayload—The clip, at the recognizer's sample rate.
语言文本—For Whisper, the language spoken; empty to let it tell.
设置Transcription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

返回

片段文本数组
起始数字数组
结束数字数组
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
语音模型
所属包
机器学习

逐词转写

函数

What is said in a clip, word by word, with when each word starts and ends: for subtitles that follow the voice, or to find where a word was said.

签名
逐词转写 -> (词语: 文本数组, 起始: 数字数组, 结束: 数字数组)
    识别器: Speech Recognizer
    音频: WAVAudioPayload
    语言: 文本
    设置: Transcription Settings
string[] TranscribeWords(
    SpeechRecognizer recognizer,
    WAVAudioPayload audio,
    string language,
    TranscriptionSettings settings,
    out double[] starts,
    out double[] ends)

参数

名称类型默认值说明
识别器Speech Recognizer—A speech recognizer. Whisper on the ONNX backend needs files with cross-attention outputs, such as onnx-community/whisper-tiny_timestamped.
音频WAVAudioPayload—The clip, at the recognizer's sample rate.
语言文本—For Whisper, the language spoken; empty to let it tell.
设置Transcription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

返回

词语文本数组
起始数字数组
结束数字数组
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
语音模型
所属包
机器学习