com.adrenak.unimic
v1.2.0
Published
Convenience wrapper over Unity's Microphone class.
Downloads
312
Readme
UniMic
A wrapper for Unity's Microphone class.
API
Mic
class in the Adrenak.UniMic
namespace is a singleton and is accessed using Mic.Instance
Properties
IsRecording
Returns if the Mic instance is recording audioFrequency
The frequency of the Microphone AudioClipSample
The last populated sample of the audio dataSampleDurationMS
The duration of the sample segment in milliseconds that the instance maintains and fires in events.SampleLength
The number of samples in the sample segmentAudioClip
The innerAudioClip
of the instanceDevices
The recording devices that are connected to the machine running the codeCurrentDeviceIndex
The index of the active device in theDevices
listCurrentDeviceName
The name of the active device
Events
OnStartRecording
Event fired when the instance starts to record the audioOnStopRecording
Event fired when the instance stops recording the audioOnSampleReady
Event fired when a sample ofSampleLength
has been populated by the instance. Includes the sample count.OnTimestampedSampleReady
Event fired when a sample ofSampleLength
has been populated by the instance. Includes the timestamp from when the sample was captured.
Methods
SetDeviceIndex
changes the recording device. The method internally restarts the recording processArguments
int index
the index of the device in theDevices
list
Returns
void
StartRecording
starts the microphone recordingArguments
int frequency=16000
the frequency of the innerAudioClip
int sampleDurationMS
the duration of a single sample segment in milliseconds that the instance keeps and fires on event
Returns
void
ResumeRecording
resumes the microphone recording at the frequency and sampleDurationMSStopRecording
stops the microphone recordingReturns
void
Tips
Just open the Unity project in Unity 2017.4.40f1+ and try the sample scene.