wave_generator 0.1.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 62

wave_generator #

A dart package to generate audio wave data on the fly.

Usage #

To use this plugin, add wave_generator as a dependency in your pubspec.yaml file.

Example #

import 'package:wave_generator/wave_generator.dart';

() async {

    var generator = WaveGenerator(
        /* sample rate */ 44100,
        BitDepth.Depth8bit);

    var note = Note(
        /* frequency */ 220,
        /* msDuration */ 3000,
        /* waveform */ Waveform.Triangle,
        /* volume */ 0.5);

    var file = new File('output.wav');

    List<int> bytes = List<int>();
    await for (int byte in generator.generate(note)) {
      bytes.add(byte);
    }

    file.writeAsBytes(bytes, mode: FileMode.append);
  });

Or string together a sequence of Notes


 await for (int byte in generator.generateSequence([note1, note2, note3 /* etc */])) {
   // ...
 }

Features #

  • Sin, Square, Triangle waves
  • 8 Bit depth

[0.1.0] - Initial open source version

  • Generate 8 bit audio
  • Sin / Square / Triangle waves

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  wave_generator: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:wave_generator/wave_generator.dart';
  
Version Uploaded Documentation Archive
0.1.0 Mar 22, 2019 Go to the documentation of wave_generator 0.1.0 Download wave_generator 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
95
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
83
Overall:
Weighted score of the above. [more]
62
Learn more about scoring.

We analyzed this package on Apr 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/data_chunk32.dart. (-1.99 points)

Analysis of lib/src/data_chunk32.dart reported 4 hints:

line 1 col 8: Unused import: 'dart:typed_data'.

line 7 col 16: The value of the field '_sGroupId' isn't used.

line 8 col 7: The value of the field '_dwChunkSize' isn't used.

line 9 col 16: The value of the field '_data' isn't used.

Fix lib/src/data_chunk16.dart. (-1.49 points)

Analysis of lib/src/data_chunk16.dart reported 3 hints:

line 7 col 16: The value of the field '_sGroupId' isn't used.

line 8 col 7: The value of the field '_dwChunkSize' isn't used.

line 9 col 13: The value of the field '_data' isn't used.

Fix lib/src/chunk.dart. (-0.50 points)

Analysis of lib/src/chunk.dart reported 1 hint:

line 2 col 8: Unused import: 'dart:typed_data'.

Fix additional 6 files with analysis or formatting issues. (-1 points)

Additional issues in the following files:

  • lib/src/format_chunk.dart (1 hint)
  • lib/wave_generator.dart (1 hint)
  • lib/src/byte_helpers.dart (Run flutter format to format lib/src/byte_helpers.dart.)
  • lib/src/data_chunk8.dart (Run flutter format to format lib/src/data_chunk8.dart.)
  • lib/src/generator_function.dart (Run flutter format to format lib/src/generator_function.dart.)
  • lib/src/wave_header.dart (Run flutter format to format lib/src/wave_header.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and wave_generator.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The package description is too short. (-7 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test