Class VoiceRecognition

The VoiceRecognition class provides functionalities for performing voice recognition.

Constructors

Properties

apiTokens: {
    Deepgram: string;
    Google: string;
}

The API tokens for accessing the Deepgram and Google APIs.

logger: boolean

A boolean flag indicating whether logger are enabled.

Methods

  • Fetch transcript from the Deepgram Speech-to-Text API.

    Parameters

    • components: DeepgramSpeechComponents

      Object containing Deepgram components.

    Returns Promise<null | SyncPrerecordedResponse>

    • Returns the transcribed result or null if an error occurs.
    • Throws an error if there's an issue with the API key or transcription process.
  • Fetch transcript from the Google Speech-to-Text API.

    Parameters

    • components: SpeechComponents

      Object containing Google Speech components.

    Returns Promise<null | TranscriptResult>

    • Promise containing the transcription result or null if an error occurs.
  • Performs voice recognition on the audio file specified by the filename.

    Parameters

    • player: Player

      The player type.

    • filename: string

      The temp filename of the audio file for voice recognition.

    • callback: ((result: string | void) => void)

      The callback function to handle the result.

        • (result): void
        • Parameters

          • result: string | void

          Returns void

    Returns void