Neocortex
IntegrationsUnity SDKAPI Reference

Neocortex Audio Receivers

Reference for the Neocortex Audio Receiver components in Unity

The Neocortex SDK provides audio receiver components to record audio data from the microphone via loudness of the sound, allowing for a hands-free chat experience with the smart agent.

Neocortex Audio Receiver Component

The NeocortexAudioReceiver component is used for standard Unity builds.

On this component you can:

  • Pick the microphone device to use
  • Set the amplitude threshold for when to start and stop recording
  • Set the max wait time for the recording to automatically stop if no sound is detected

Methods

StartMicrophone

Starts recording audio from the microphone.

StartMicrophone Example
var audioReceiver = GetComponent<NeocortexAudioReceiver>();
audioReceiver.StartMicrophone();

StopMicrophone

Stops recording audio from the microphone

StopMicrophone Example
var audioReceiver = GetComponent<NeocortexAudioReceiver>();
audioReceiver.StopMicrophone();

Events

OnAudioRecorded

Event that is triggered when audio data is recorded from the microphone.

  • Arguments:
    • audioClip: The recorded audio clip.
    OnAudioRecorded Example
    var audioReceiver = GetComponent<NeocortexAudioReceiver>();
    audioReceiver.OnAudioRecorded.AddListener((audioClip) =>
    {
        Debug.Log($"Audio Data Length: {audioClip.samples}");
    });

Neocortex Web Audio Receiver Component

The NeocortexWebAudioReceiver component is used to receive audio data from the browser in WebGL builds. This component is used in conjunction with the NeocortexSmartAgent component to send audio data to the Neocortex project.

On this component you can:

  • Pick the microphone device to use
  • Set the amplitude threshold for when to start and stop recording
  • Set the max wait time for the recording to automatically stop if no sound is detected

Methods

StartMicrophone

Starts recording audio from the microphone.

StartMicrophone Example
var audioReceiver = GetComponent<NeocortexWebAudioReceiver>();
audioReceiver.StartMicrophone();

StopMicrophone

Stops recording audio from the microphone

StopMicrophone Example
var audioReceiver = GetComponent<NeocortexWebAudioReceiver>();
audioReceiver.StopMicrophone();

Events

OnAudioRecorded

Event that is triggered when audio data is recorded from the microphone.

  • Arguments:
    • audioClip: The recorded audio clip.
    OnAudioRecorded Example
    var audioReceiver = GetComponent<NeocortexWebAudioReceiver>();
    audioReceiver.OnAudioRecorded.AddListener((audioClip) =>
    {
        Debug.Log($"Audio Data Length: {audioClip.samples}");
    });

On this page