Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/web/api/audiodecoder/decode/index.md
6510 views
---
title: AudioDecoder.decode() slug: Web/API/AudioDecoder/decode page-type: web-api-instance-method status: - experimental browser-compat: api.AudioDecoder.decode
---

{{securecontext_header}}{{APIRef("WebCodecs API")}}{{SeeCompatTable}}

The decode() method of the {{domxref("AudioDecoder")}} interface enqueues a control message to decode a given chunk of audio.

Syntax

decode(chunk)

Parameters

  • chunk

    • : An {{domxref("EncodedAudioChunk")}} object representing a chunk of encoded audio.

Return value

None ({{jsxref("undefined")}}).

Exceptions

  • InvalidStateError {{domxref("DOMException")}}

    • : Thrown if the {{domxref("AudioDecoder.state","state")}} is not "configured".

  • DataError {{domxref("DOMException")}}

    • : Thrown if the chunk is unable to be decoded due to relying on other frames for decoding.

Examples

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}