Skip to content

AnalyserNode requires connection to AudioContext.destination, causing unnecessary memory usage #860

@JonasHiltl

Description

@JonasHiltl

Feature Request

I’m using an AnalyserNode for real-time pitch and volume analysis on short audio buffers. I don’t need to record or store the full audio stream.

However, it seems that the AnalyserNode only produces usable data (e.g. getFloatTimeDomainData) when it is ultimately connected to AudioContext.destination. This forces me to route the audio to a (silent) destination, which results in the full audio being recorded and kept in memory, causing linearly increasing memory usage over time.

Current setup
To make the AnalyserNode usable, I currently have to connect the graph like this:

recorder -> adapter -> analyser -> silentGain -> destination

The silentGain node sets the audio to zero so nothing is audible, but the audio still flows to destination.

Expected behavior
It should be possible to use an AnalyserNode for analysis only, without connecting it to AudioContext.destination, for example:

recorder -> adapter -> analyser

Is this a known limitation of the Web Audio API?
Or is there a recommended way to perform analysis without routing audio to AudioContext and incurring the associated memory overhead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions