Microphone control in Power Apps
A control that enables app users to record sounds from their device.
Use the Microphone control to capture audio with a device's microphone. The device must have a microphone and the user must authorize the app to use the microphone.
The most recently recorded audio clip is available through the Audio property. With this property, recorded audio can be:
- Played back with the Audio control. Use the Audio control to listen to the recording. For more information, see the examples.
- Temporarily put in a variable or a collection. Use the Set or Collect functions to store audio clips in a variable or a collection. Use caution with multiple audio clips in a collection at the same time with device's limited memory. Use the SaveData and LoadData functions to move audio clips to the local storage on the device and for offline scenarios.
- Stored in a database. Use the Patch function to store audio clips in a database.
- Transmitted as a base64 encoded text string. Use the JSON function to base64 encode audio clips.
Format of the recorded audio:
- 3gp format for Android.
- AAC format for iOS.
- OGG format for web browsers.
Captured media is referenced by a text string URI. For more information, read the data type documentation.
The microphone control is supported only on Microsoft Edge based on Chromium, Chrome, and Firefox browsers; and Android and iOS devices. All other browsers and platforms will show a warning that some features of the app won't work.
Audio – The audio clip captured when the user records with the device's microphone.
Mic – Numeric ID of the microphone on a device that has more than one microphone.
OnStop – Actions to perform when the user stops recording with a microphone control.
AccessibleLabel – Label for screen readers. Should describe the purpose of the microphone.
BorderColor – The color of a control's border.
BorderStyle – Whether a control's border is Solid, Dashed, Dotted, or None.
BorderThickness – The thickness of a control's border.
Color – The color of text in a control.
DisplayMode – Whether the control allows user input (Edit), only displays data (View), or is disabled (Disabled).
Fill – The background color of a control.
FocusedBorderColor – The color of a control's border when the control is focused.
FocusedBorderThickness – The thickness of a control's border when the control is focused.
Height – The distance between a control's top and bottom edges.
HoverBorderColor – The color of a control's border when the user keeps the mouse pointer on that control.
HoverColor – The color of the text in a control when the user keeps the mouse pointer on it.
HoverFill – The background color of a control when the user keeps the mouse pointer on it.
Image – The name of the image that appears in an image, audio, or microphone control.
ImagePosition – The position (Fill, Fit, Stretch, Tile, or Center) of an image in a screen or a control if it isn't the same size as the image.
OnSelect – Actions to perform when the user selects a control.
OnStart – Actions to perform when the user starts to record with a microphone control.
PressedBorderColor – The color of a control's border when the user selects that control.
PressedColor – The color of text in a control when the user selects that control.
PressedFill – The background color of a control when the user selects that control.
Reset – Whether a control reverts to its default value.
TabIndex – Keyboard navigation order compared to other controls.
Tooltip – Explanatory text that appears when the user hovers over a control.
Visible – Whether a control appears or is hidden.
Width – The distance between a control's left and right edges.
X – The distance between the left edge of a control and the left edge of its parent container or screen.
Y – The distance between the top edge of a control and the top edge of the parent container or screen.
Simple direct playback
In this example, we'll directly connect a Microphone control with an Audio control for immediate playback:
Add a Microphone control to your app.
Authorize the app to use device's microphone if prompted.
Add an Audio control to your app.
Set the Audio control's Media property to the formula:
Replace microphone control name Microphone1 as appropriate.
Preview the app.
Select the Microphone control to begin recording.
Speak to record audio.
Select the Microphone control again to end the recording.
Select the Audio control to hear the recording.
Add sounds to a Gallery control
In this example, we'll create a gallery of audio clips stored in a collection that can be individually selected for playback:
Add a Microphone control.
Set its OnStop property to this formula using the Collect function:
Collect( MySounds, MyMic.Audio )
Add a Gallery control, move it below MyMic.
Set the Items property for the gallery to this formula:
In the template for the Custom gallery control, add an Audio control.
Set the audio control's Media property to this formula:
Press F5 to preview the app.
Select MyMic to start recording, and then select it again to stop recording.
In the Gallery control, select the play button in the Audio control to play back your recording.
Add as many recordings as you want, and then return to the default workspace by pressing the Esc key.
(optional) In the template for the Gallery control, add a Button control.
Set its OnSelect property to the formula:
Remove( MySounds, ThisItem )
Press F5, and then remove a recording by selecting the corresponding Button control.
The same guidelines for Button apply because Microphone is just a specialized button. Also, consider:
Consider adding an alternative form of input for users with speech disabilities or without a microphone. For example, Text input to allow users to enter text.
- Read the standard color contrast requirements.
- Ensure adequate color contrast between Image and the button text and icon (if applicable).
Screen reader support
- AccessibleLabel must be present.