Skip to content

Bindings for native miniaudio features into Dart code

License

Notifications You must be signed in to change notification settings

leontappe/miniaudio-dart

 
 

Repository files navigation

A Flutter plug-in for multi platform simple audio stream playback with real-time generated audio data streams

Features

  • Plays buffered audio data in 44.1kHz continuously until the buffer becomes empty
  • Supported format: float32 single-channel
  • Suppots all flutter platforms: Android, iOS, macOS, Linux, Windows and Web platforms
    • Web platform is based on WebAudio and AudioWorkletProcessor
    • Other platforms are based on miniaudio, an amazing multi-platform audio library

Getting started

flutter pub add mp_audio_stream

Usage

import 'dart:math' as math;
import 'dart:async';
import 'dart:typed_data';

import 'package:mp_audio_stream/mp_audio_stream.dart';

void main() async {
  final audioStream = getAudioStream();

  audioStream.init();

  const freq = 440;
  const rate = 44100;
  final sineWave = List.generate(
      rate * 1, (i) => math.sin(2 * math.pi * ((i * freq) % rate) / rate));

  audioStream.push(Float32List.fromList(sineWave));

  await Future.delayed(const Duration(seconds: 2));

  audioStream.uninit();
}

For more API Documents, visit pub.dev.

About

Bindings for native miniaudio features into Dart code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 36.7%
  • CMake 29.0%
  • Dart 15.5%
  • Ruby 6.5%
  • JavaScript 3.8%
  • HTML 3.6%
  • Other 4.9%