FirstModulAR 0.1.0
Loading...
Searching...
No Matches
Whisper.WhisperManager Class Reference

Manages Whisper model lifecycle in Unity scene. More...

Inheritance diagram for Whisper.WhisperManager:

Public Member Functions

async Task InitModel ()
 Load model and default parameters. Prepare it for text transcription.
 
bool IsMultilingual ()
 Checks if currently loaded whisper model supports multilingual transcription.
 
async Task< WhisperResultGetTextAsync (AudioClip clip)
 Start async transcription of audio clip.
 
async Task< WhisperResultGetTextAsync (float[] samples, int frequency, int channels)
 Start async transcription of audio buffer.
 
async Task< WhisperStreamCreateStream (int frequency, int channels)
 Create a new instance of Whisper streaming transcription.
 
async Task< WhisperStreamCreateStream (MicrophoneRecord microphone)
 Create a new instance of Whisper streaming transcription from microphone input.
 

Public Attributes

LogLevel logLevel = LogLevel.Log
 
string language = "en"
 
bool translateToEnglish
 
bool noContext = true
 
bool singleSegment
 
bool enableTokens
 
string initialPrompt
 
float stepSec = 3f
 
float keepSec = 0.2f
 
float lengthSec = 10f
 
bool updatePrompt = true
 
bool dropOldBuffer
 
bool useVad = true
 
bool tokensTimestamps
 
bool speedUp
 
int audioCtx
 

Properties

string ModelPath [get, set]
 
bool IsModelPathInStreamingAssets [get, set]
 
bool IsLoaded [get]
 Checks if whisper weights are loaded and ready to be used.
 
bool IsLoading [get]
 Checks if whisper weights are still loading and not ready.
 

Events

OnNewSegmentDelegate OnNewSegment
 Raised when whisper transcribed a new text segment from audio.
 
OnProgressDelegate OnProgress
 Raised when whisper made some progress in transcribing audio. Progress changes from 0 to 100 included.
 

Detailed Description

Manages Whisper model lifecycle in Unity scene.

Member Function Documentation

◆ CreateStream() [1/2]

async Task< WhisperStream > Whisper.WhisperManager.CreateStream ( int frequency,
int channels )
inline

Create a new instance of Whisper streaming transcription.

Parameters
frequencyAudio sample rate.
channelsAudio channels count.
Returns
New streaming transcription. Null if failed.

◆ CreateStream() [2/2]

async Task< WhisperStream > Whisper.WhisperManager.CreateStream ( MicrophoneRecord microphone)
inline

Create a new instance of Whisper streaming transcription from microphone input.

Returns
New streaming transcription. Null if failed.

◆ GetTextAsync() [1/2]

async Task< WhisperResult > Whisper.WhisperManager.GetTextAsync ( AudioClip clip)
inline

Start async transcription of audio clip.

Returns
Full audio transcript. Null if transcription failed.

◆ GetTextAsync() [2/2]

async Task< WhisperResult > Whisper.WhisperManager.GetTextAsync ( float[] samples,
int frequency,
int channels )
inline

Start async transcription of audio buffer.

Parameters
samplesRaw audio buffer.
frequencyAudio sample rate.
channelsAudio channels count.
Returns
Full audio transcript. Null if transcription failed.

◆ InitModel()

async Task Whisper.WhisperManager.InitModel ( )
inline

Load model and default parameters. Prepare it for text transcription.

◆ IsMultilingual()

bool Whisper.WhisperManager.IsMultilingual ( )
inline

Checks if currently loaded whisper model supports multilingual transcription.

Member Data Documentation

◆ audioCtx

int Whisper.WhisperManager.audioCtx

◆ dropOldBuffer

bool Whisper.WhisperManager.dropOldBuffer

◆ enableTokens

bool Whisper.WhisperManager.enableTokens

◆ initialPrompt

string Whisper.WhisperManager.initialPrompt

◆ keepSec

float Whisper.WhisperManager.keepSec = 0.2f

◆ language

string Whisper.WhisperManager.language = "en"

◆ lengthSec

float Whisper.WhisperManager.lengthSec = 10f

◆ logLevel

LogLevel Whisper.WhisperManager.logLevel = LogLevel.Log

◆ noContext

bool Whisper.WhisperManager.noContext = true

◆ singleSegment

bool Whisper.WhisperManager.singleSegment

◆ speedUp

bool Whisper.WhisperManager.speedUp

◆ stepSec

float Whisper.WhisperManager.stepSec = 3f

◆ tokensTimestamps

bool Whisper.WhisperManager.tokensTimestamps

◆ translateToEnglish

bool Whisper.WhisperManager.translateToEnglish

◆ updatePrompt

bool Whisper.WhisperManager.updatePrompt = true

◆ useVad

bool Whisper.WhisperManager.useVad = true

Property Documentation

◆ IsLoaded

bool Whisper.WhisperManager.IsLoaded
get

Checks if whisper weights are loaded and ready to be used.

◆ IsLoading

bool Whisper.WhisperManager.IsLoading
get

Checks if whisper weights are still loading and not ready.

◆ IsModelPathInStreamingAssets

bool Whisper.WhisperManager.IsModelPathInStreamingAssets
getset

◆ ModelPath

string Whisper.WhisperManager.ModelPath
getset

Event Documentation

◆ OnNewSegment

OnNewSegmentDelegate Whisper.WhisperManager.OnNewSegment

Raised when whisper transcribed a new text segment from audio.

◆ OnProgress

OnProgressDelegate Whisper.WhisperManager.OnProgress

Raised when whisper made some progress in transcribing audio. Progress changes from 0 to 100 included.


The documentation for this class was generated from the following file: