Recording real-time in Unity
To record voice in real-time within your Unity project, you can utilize the AudioRecorder class to accomplish this task.
var recorder = new AudioRecorder();
recorder.StartRecording(); // Start recording the voice
// Wait until the recording is done
var audioClip = recorder.StopRecording(); // Stop recording and get the audio clip
// Now you can use the audio clip to request transcription or translation
// For example:
var request = new TranscriptionRequest.Builder()
.SetModel(WhisperModel.Whisper1)
.SetFile(audioClip)
.Build();
var result = await request.ExecuteAsync();
Debug.Log(result.Text);
Debug.Log(result.Language);
Debug.Log(result.Duration);MonoBehaviour Example
Last updated