Home / Function/ createAudioAnalyser() — ui Function Reference

createAudioAnalyser() — ui Function Reference

Architecture documentation for the createAudioAnalyser() function in elevenlabs.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  2dd97ecc_39fb_a7c1_bcf4_a1089eb7be33["createAudioAnalyser()"]
  a1a6ebaf_3f49_5bb2_b404_b9f06dce2cab["elevenlabs.tsx"]
  2dd97ecc_39fb_a7c1_bcf4_a1089eb7be33 -->|defined in| a1a6ebaf_3f49_5bb2_b404_b9f06dce2cab
  4c497de2_f90a_34cb_b3cc_cbc11ec78ceb["useAudioVolume()"]
  4c497de2_f90a_34cb_b3cc_cbc11ec78ceb -->|calls| 2dd97ecc_39fb_a7c1_bcf4_a1089eb7be33
  e44c6358_72b2_3916_b4f2_57dd5af079e2["useMultibandVolume()"]
  e44c6358_72b2_3916_b4f2_57dd5af079e2 -->|calls| 2dd97ecc_39fb_a7c1_bcf4_a1089eb7be33
  style 2dd97ecc_39fb_a7c1_bcf4_a1089eb7be33 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/bases/base/blocks/elevenlabs.tsx lines 154–181

function createAudioAnalyser(
  mediaStream: MediaStream,
  options: AudioAnalyserOptions = {}
) {
  const audioContext = new (window.AudioContext ||
    (window as unknown as { webkitAudioContext: typeof AudioContext })
      .webkitAudioContext)()
  const source = audioContext.createMediaStreamSource(mediaStream)
  const analyser = audioContext.createAnalyser()

  if (options.fftSize) analyser.fftSize = options.fftSize
  if (options.smoothingTimeConstant !== undefined) {
    analyser.smoothingTimeConstant = options.smoothingTimeConstant
  }
  if (options.minDecibels !== undefined)
    analyser.minDecibels = options.minDecibels
  if (options.maxDecibels !== undefined)
    analyser.maxDecibels = options.maxDecibels

  source.connect(analyser)

  const cleanup = () => {
    source.disconnect()
    audioContext.close()
  }

  return { analyser, audioContext, cleanup }
}

Subdomains

Frequently Asked Questions

What does createAudioAnalyser() do?
createAudioAnalyser() is a function in the ui codebase, defined in apps/v4/registry/bases/base/blocks/elevenlabs.tsx.
Where is createAudioAnalyser() defined?
createAudioAnalyser() is defined in apps/v4/registry/bases/base/blocks/elevenlabs.tsx at line 154.
What calls createAudioAnalyser()?
createAudioAnalyser() is called by 2 function(s): useAudioVolume, useMultibandVolume.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free