搜索插件、代码仓与 APP 分类

插件详情v1.5.0

wav

超简单的纯 Dart 包,用于读取和写入 WAV 和原始音频文件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1.4万
喜欢数
36
Pub 分数
160

安装插件

flutter pub add wav

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个轻量级的纯 Dart 包,用于读取和写入 WAV 和原始音频文件。它提供了简单的 API 来处理音频数据,无需外部依赖,非常适合在 Flutter 应用中进行音频处理任务。该包支持多种平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,确保广泛的兼容性。设计简洁,专注于核心音频文件操作,开销极小。

适合场景

  • 音频文件解析
  • 原始音频数据操作
  • 跨平台音频输入输出
  • 简单的音频录制播放
  • 在应用程序中嵌入音频

主要特点

  • 纯 Dart 实现
  • 支持 WAV 和原始音频格式
  • 无原生依赖
  • 多平台兼容性
  • 最小 API 表面
  • 与 Flutter 的轻松集成

适合对象

  • 需要基本音频文件处理的开发者
  • 需要音频数据提取或创建的应用程序
  • 项目避免使用平台特定代码
  • 原型音频功能
  • 轻量级音频处理

使用建议

  • 仅限 WAV 和原始格式
  • 不支持压缩或高级音频编解码器
  • 不适用于高性能音频流
  • 需要手动处理采样率和位深度
  • 无内置音频播放功能

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

wav

pub package Build Status Coverage Status

Simple tools for reading and writing WAV and raw audio files. Written in pure Dart, with no dependencies.

This package currently supports reading and writing 8/16/24/32 bit PCM, and 32/64 bit float formats. Other formats can be added as needed (just file a bug).

This package also supports WAVE_FORMAT_EXTENSIBLE, but only for reading. Extensible WAVs are essentially treated as ordinary WAV files, because wValidBitsPerSample and dwChannelMask are ignored. Please file a bug if you have a use case for either of these metadata fields, or for writing extensible WAV files.

Usage

// Read a WAV file.
final wav = await Wav.readFile(filename);

// Look at its metadata.
print(wav.format);
print(wav.samplesPerSecond);

// Mess with its audio data.
for (final chan in wav.channels) {
  for (int i = 0; i < chan.length; ++i) {
    chan[i] /= 2;  // Decrease the volume.
  }
}

// Write to another WAV file.
await wav.writeFile(otherFilename);

所属分类

源码仓库

使用此插件的项目