> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # createMicrophoneAnalyzer > createMicrophoneAnalyzer function in the WebRTC namespace. ### createMicrophoneAnalyzer * `Const` **createMicrophoneAnalyzer**(`options`): `Promise` Initializes a microphone analyzer. You can use a `MicrophoneAnalyzer` to track the input audio volume. To stop the analyzer, call the `destroy()` method on the returned object. The returned object emits the following events: * `volumeChanged`: Instantaneous volume from 0 to 100. * `destroyed`: The object has been destroyed. The parameter describes the reason: `null` (if you called `destroy()`), `"error"` (in case of errors), or `"disconnected"` (if the device was disconnected). #### Parameters **`options`** `string | MediaStream | MediaTrackConstraints` — required Either the id of the device to analyze, a [MediaStreamConstraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints) object, or a [MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream). --- #### Returns `Promise` #### Example ```js const micAnalyzer = await createMicrophoneAnalyzer("device-id"); micAnalyzer.on("volumeChanged", (vol) => { console.log("Volume: ", vol); }); micAnalyzer.on("destroyed", (reason) => { console.log("Microphone analyzer destroyed", reason); }); micAnalyzer.destroy(); ``` > createMicrophoneAnalyzer function in the WebRTC namespace.