wave_builder 1.0.4

Dart native js
Flutter Android iOS web

A utility for building a wave file by concatenating wave files and periods of silence.

A builder for Wave files. This utility can create the byte list to write a wave file, concatenating other wave files and periods of silence.

This utility is designed specifically to make metronome files (click tracks), but can be used for other applications as well.

Created from templates made available by Stagehand under a BSD-style license.

Usage #

A simple usage example:

import 'package:wave_builder/wave_builder.dart';

/// Create 1 bar of a 4/4 metronome at 60 BPM
main() {
  var fileOut = File('./example/assets/out/test.wav');
  var primary = File('./example/assets/wav/primary.wav');
  var secondary = File('./example/assets/wav/secondary.wav');
  var silenceType = WaveBuilderSilenceType.BeginningOfLastSample;

  var primaryBytes = await primary.readAsBytes();
  var secondaryBytes = await secondary.readAsBytes();

  await fileOut.create();

  var waveBuilder = WaveBuilder();

  waveBuilder.appendFileContents(primaryBytes);
  waveBuilder.appendSilence(1000, silenceType);
  waveBuilder.appendFileContents(secondaryBytes);
  waveBuilder.appendSilence(1000, silenceType);
  waveBuilder.appendFileContents(secondaryBytes);
  waveBuilder.appendSilence(1000, silenceType);
  waveBuilder.appendFileContents(secondaryBytes);
  waveBuilder.appendSilence(1000, silenceType);
  await fileOut.writeAsBytes(waveBuilder.fileBytes);
}
0
likes
110
pub points
45%
popularity

A utility for building a wave file by concatenating wave files and periods of silence.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

timkellypa@gmail.com

License

BSD (LICENSE)

More

Packages that depend on wave_builder