Skip to content

createAudioAnalyser cloneTrack option doesn't behave as expected with KrispNoiseFilter #1811

@mdanilakis

Description

@mdanilakis

Describe the bug

What I'm expecting

Under normal circumstances, without the KrispNoiseFilter we can do this:

const { calculateVolume, cleanup } = createAudioAnalyser(audioTrack, {
  cloneTrack: true
});

Which works great when we want to implement a "seems like you're muted, but trying to speak" feature as documented (even if track is muted we can call calculateVolume()):

 /**
   * If set to true, the analyser will use a cloned version of the underlying mediastreamtrack, which won't be impacted by muting the track.
   * Useful for local tracks when implementing things like "seems like you're muted, but trying to speak".
   * Defaults to false
   */
  cloneTrack?: boolean;

We would expect this to work even with the KrispNoiseFilter.

What happens instead

When using the KrispNoiseFilter (Cloud), there's something weird going on with clone() internally, which results in the analyzer producing 0 output when using calculateVolume(). It only works when unmuted.

Reproduction

Create a test using createAudioAnalyser and cloneTrack: true without the KrispNoiseFilter, this works as expected (calculateVolume produces non-zero output even if track is muted).

Create a test using createAudioAnalyser and cloneTrack: true with the KrispNoiseFilter, (calculateVolume produces non-zero output only when unmuted - we would expect this work even if microphone track is muted!)

Logs

System Info

Web, Chrome 145.0.7632.46, LiveKit Cloud subscription

livekit-client (js): 2.17.1
@livekit/krisp-noise-filter: 0.4.1
MacOS 15.7.1

Severity

annoyance

Additional Information

No response

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