wav_io 1.0.0 copy "wav_io: ^1.0.0" to clipboard
wav_io: ^1.0.0 copied to clipboard

Wave audio files IO for dart

Simple reader and writer for WAVE files.

It reads the ByteData of the contents, and create a list of channels. Each channel is Int16List.

Features #

  • Can read 16bit & 24bit PCM files.
  • Can read 32bit float files.
  • Can write to 16bit PCM file.

Getting started #

Add wav_io package to your pubspec.yaml file.

Usage #

This example can be found in /example folder.


import 'dart:io';

import 'package:wav_io/wav_io.dart';

void main() {
  var f = File("example/hello_float.wav").openSync(); 
  var buf = f.readSync(f.lengthSync());
  f.closeSync();
  // loads
  var wav = WavContent.fromBytes(buf.buffer.asByteData());

  print(wav.numChannels);
  print(wav.numSamples);
  print(wav.sampleRate);
  print(wav.bitsPerSample);
  // actual samples store in wav.samplesForChannel
  f = File("example/hello2.wav").openSync(mode: FileMode.writeOnly);
  f.writeFromSync(wav.toBytes().buffer.asInt8List());
  f.flushSync();
  f.closeSync();
}

Additional information #

WavContent stores each sample in 16 bit pcm format.

4
likes
140
pub points
81%
popularity

Publisher

unverified uploader

Wave audio files IO for dart

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on wav_io