Skip to main content
Version: 2.x

Class OdinMicrophoneReader

Handles microphone input data and sends input to ODIN

This convenient class gathers input audio data from Unity managed Microphone to pass the data with OdinNative.Unity.Audio.OdinMicrophoneReader.OnAudioData event to other components.

Declaration
[AddComponentMenu("Odin/Audio/OdinMicrophoneReader")]
[DisallowMultipleComponent]
public class OdinMicrophoneReader : MonoBehaviour

Inheritance: System.Object -> UnityEngine.Object -> UnityEngine.Component -> UnityEngine.Behaviour -> UnityEngine.MonoBehaviour

Properties

HasPermission

Check if the user has authorized use of the microphone

Declaration
public bool HasPermission { get; }

IsInputDeviceConnected

True while a capture device was found and set up.

Declaration
public bool IsInputDeviceConnected { get; }

MicrophoneSamplerate

Declaration
public int MicrophoneSamplerate { get; }

MicrophoneChannels

Declaration
public int MicrophoneChannels { get; }

Fields

RedirectCapturedAudio

Redirect the captured audio to the OdinNative.Unity.Audio.OdinMicrophoneReader.OnAudioData event

Declaration
[Tooltip("Redirect the captured audio to all rooms.")]
[SerializeField]
public bool RedirectCapturedAudio

SilenceCapturedAudio

Zero out the event audio buffer for PushAudio.

Declaration
[Tooltip("Silence the captured audio to all rooms.")]
[SerializeField]
public bool SilenceCapturedAudio

ContinueRecording

Declaration
[Tooltip("Indicates whether the recording should continue when the 3 second AudioClip buffer is full, wrapping around and recording from the beginning of the AudioClip.")]
[SerializeField]
public bool ContinueRecording

Samplerate

Declaration
[Header("AudioClip Settings")]
public int Samplerate

CustomInputDevice

Enable/Disable the use of OdinNative.Unity.Audio.OdinMicrophoneReader.InputDevice as a new/fixed device name

Declaration
public bool CustomInputDevice

InputDevice

The device name to use as microphone in Unity. (i.e Microphone.Start)

Declaration
public string InputDevice

AutostartListen

Use UnityEngine.Microphone.Start (Microphone.Start) in OdinNative.Unity.Audio.OdinMicrophoneReader.Start

Declaration
[SerializeField]
[Tooltip("Automatic microphone start on Start()")]
public bool AutostartListen

CustomMicVolumeScale

Declaration
public bool CustomMicVolumeScale

MicVolumeScale

Declaration
[SerializeField]
[Tooltip("Automatic microphone volume boost")]
public float MicVolumeScale

OnAudioData

Declaration
[SerializeField]
public UnityAudioData OnAudioData

OnMicrophoneData

Event is fired if raw microphone data is available

Declaration
public OdinMicrophoneReader.MicrophoneCallbackDelegate OnMicrophoneData

Methods

StartListen()

Start Unity microphone capture

Declaration
public bool StartListen()
Returns

System.Boolean

StopListen()

Stop Unity Microphone capture if this AudioSender created the recording

Declaration
public void StopListen()