@langwatch/scenario
    Preparing search index...

    Class VoiceRecordingRuntime

    Runtime implementation of VoiceRecording. Stores PCM16 segments and lets callers serialize them as WAV / MP3 / OGG / FLAC or as a segment directory with a JSON manifest.

    Construction is cheap — the executor creates an empty instance at the start of a voice scenario and appends segments + timeline events as the conversation unfolds.

    Implements

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    segments: AudioSegment[]
    timeline: VoiceEvent[]

    Accessors

    Methods

    • Save the full conversation to a file.

      Format is inferred from the path suffix or overridden by format. .wav is written natively; non-WAV formats transcode via the bundled ffmpeg subprocess (see resolveFfmpegPath).

      path is resolved before writing; format is validated against an allowlist so callers can't pass arbitrary ffmpeg muxer names.

      Parameters

      • path: string
      • Optionalformat: string

      Returns string

    • Write each segment as its own WAV file plus the full mixed conversation, optionally with a JSON manifest pairing files to transcripts/timestamps.

      Layout:

      <dir>/
          segments/
              00-user-0000ms.wav
              01-agent-0312ms.wav
              ...
          full.wav
          manifest.json   # iff manifest=true
      

      Segment file names: zero-padded index, role, start_time in milliseconds. Existing files inside dir are NOT cleared — caller decides retention.

      Parameters

      • dir: string
      • options: { manifest?: boolean } = {}

      Returns string