wave_builder 1.0.5 copy "wave_builder: ^1.0.5" to clipboard
wave_builder: ^1.0.5 copied to clipboard

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);
}
4
likes
140
pub points
15%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

More

Packages that depend on wave_builder