@bevyl-ai/live-audio

中文文档
0.1.3发布于 2026/08/03MITTypeScriptES Module构建来源已验证近 30 天下载 6205

Realtime browser audio recording, waveform capture, transcription, and upload lifecycle hooks.

原始使用文档
文档目录7 节
  1. Install
  2. Quick Start
  3. Plugins
  4. Waveform Helpers
  5. Package Shape
  6. Development
  7. License

@bevyl-ai/live-audio

Realtime browser audio recording primitives from Bevyl.

@bevyl-ai/live-audio provides React hooks, waveform utilities, and lifecycle ports for microphone capture, PCM waveform generation, realtime transcription, and upload plugins. It is browser-first and keeps app transport details outside the package.

The package does not send audio to Bevyl. Audio leaves the browser only through plugins or callbacks that your application provides.

Install

bun add @bevyl-ai/live-audio

React is a peer dependency. The package uses browser microphone APIs, Blob, File, MediaRecorder, and WebSocket, so it should run in a browser client component or equivalent client-only runtime.

Quick Start

'use client';

import { useLiveAudioRecordingSession } from '@bevyl-ai/live-audio';

export function Recorder() {
  const session = useLiveAudioRecordingSession({
    objectPath: 'recordings/demo',
    plugins: [],
    onCaptureUploaded(capture) {
      console.log('capture uploaded', capture);
    },
  });

  return (
    <div>
      <button disabled={session.isStarting} onClick={session.startCapture}>
        Start
      </button>
      <button onClick={session.stopCapture}>Stop</button>
      <p>{session.intakeState}</p>
    </div>
  );
}

Plugins

Plugins own side effects such as transcription providers or uploads. The core recorder calls lifecycle methods; your app decides where tokens, files, and URLs come from.

import type { LiveAudioUploadPlugin } from '@bevyl-ai/live-audio';

export function createUploadPlugin(): LiveAudioUploadPlugin {
  return {
    id: 'upload',
    kind: 'upload',
    start() {
      return {
        async onCaptureComplete({ file, objectName }) {
          const url = await uploadFile({ file, objectName });

          return {
            audio: {
              objectName,
              url,
            },
          };
        },
      };
    },
  };
}

Waveform Helpers

The package also exports the small zero-dependency waveform JSON helpers used by the recorder.

import {
  AudioWaveformAccumulator,
  cropAudioWaveform,
} from '@bevyl-ai/live-audio/audio-waveform';

const accumulator = new AudioWaveformAccumulator(48_000);

accumulator.addMonoSamples(Float32Array.from([0, 0.5, -0.5, 1]));

const waveform = accumulator.toWaveformJson();
const firstSecond = cropAudioWaveform(waveform, 0, 1);

Package Shape

  • src/session contains useLiveAudioRecordingSession and useLiveAudioRecorder.
  • src/audio-waveform contains the dependency-free waveform JSON primitives.
  • src/hooks contains lower-level capture, transcription, upload, and waveform hooks.
  • src/plugins/contracts.ts contains the LiveAudioPlugin lifecycle port.

Development

bun install
bun test
bun run typecheck

License

MIT

版本与发布记录

@bevyl-ai/live-audio 共发布 4 个版本,首次发布于 2026/06/21;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.3latest2026/08/033 个月前
0.1.22026/06/264 个月前
0.1.12026/06/214 个月前
0.1.02026/06/214 个月前

关于 @bevyl-ai/live-audio 的常见问题

@bevyl-ai/live-audio 是什么?

Realtime browser audio recording, waveform capture, transcription, and upload lifecycle hooks.

如何安装 @bevyl-ai/live-audio?

在项目目录运行 npm install @bevyl-ai/live-audio,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18.2.0 <20)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bevyl-ai/live-audio 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bevyl-ai/live-audio 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@bevyl-ai/live-audio 可以商用吗?

@bevyl-ai/live-audio 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bevyl-ai/live-audio 的下载量有多少?

根据 npm 官方下载统计,@bevyl-ai/live-audio 在 2026/10/08 – 2026/11/06 这 30 天内被下载 6,205 次,日均约 207 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bevyl-ai/live-audio 还在维护吗?

最新版本 0.1.3 发布于 2026/08/03(3 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/06/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。