wav

pub package Build Status Coverage Status

用于读取和写入WAV文件的简单工具。

此包当前支持读取和写入8、16、24和32位PCM。可以根据需要添加其他格式(只需提交bug)。

用法

// 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);

GitHub

查看 Github