Microphone Class (Microsoft.Xna.Framework.Audio)

Provides microphones capture features.

Namespace: Microsoft.Xna.Framework.Audio
Assembly: MonoGame.Framework (MonoGame.Framework.dll
  • C#
  • VB
  • F#
public sealed class Microphone

Syntax for VB is not yet implemented.

Syntax for F# is not yet implemented.

The Microphone type exposes the following members.

  Platforms Name Description
Name Returns the friendly name of the microphone. 
  Platforms Name Description
All Returns all compatible microphones. 
BufferDuration Gets or sets the capture buffer duration. This value must be greater than 100 milliseconds, lower than 1000 milliseconds, and must be 10 milliseconds aligned (BufferDuration % 10 == 10). 
Default Returns the default microphone. 
IsHeadset Determines if the microphone is a wired headset. Note: XNA could know if a headset microphone was plugged in an Xbox 360 controller but MonoGame can't. Hence, this is always true on mobile platforms, and always false otherwise. 
SampleRate Returns the sample rate of the captured audio. Note: default value is 44100hz 
State Returns the state of the Microphone. 
  Platforms Name Description
GetData(Byte[]) Gets the latest available data from the microphone. 
GetData(Byte[], int, int) Gets the latest available data from the microphone. 
GetSampleDuration Returns the duration based on the size of the buffer (assuming 16-bit PCM data). 
GetSampleSizeInBytes Returns the size, in bytes, of the array required to hold the specified duration of 16-bit PCM data. 
Start Starts microphone capture. 
Stop Stops microphone capture. 
  Platforms Name Description
BufferReady Event fired when the audio data are available. 
Supported in:

 Windows DirectX Desktop
 Linux Desktop
 Windows OpenGL Desktop