Path: blob/main/files/en-us/web/api/analysernode/getbytetimedomaindata/index.md
6538 views
------{{ APIRef("Mountain View APIRef Project") }}
The getByteTimeDomainData() method of the {{ domxref("AnalyserNode") }} Interface copies the current waveform, or time-domain, data into a {{jsxref("Uint8Array")}} (unsigned byte array) passed into it.
If the array has fewer elements than the {{domxref("AnalyserNode.fftSize")}}, excess elements are dropped. If it has more elements than needed, excess elements are ignored.
Syntax
Parameters
array: The {{jsxref("Uint8Array")}} that the time domain data will be copied to. If the array has fewer elements than the {{domxref("AnalyserNode.fftSize")}}, excess elements are dropped. If it has more elements than needed, excess elements are ignored.
Return value
None ({{jsxref("undefined")}}).
Examples
The following example shows basic usage of an {{domxref("AudioContext")}} to create an AnalyserNode, then {{domxref("window.requestAnimationFrame()","requestAnimationFrame")}} and {{htmlelement("canvas")}} to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js lines 108–193 for relevant code).relevant code).
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}