Giter Club home page Giter Club logo

libresample_flutter's Introduction

libresample_flutter

An implementation of libresample as a Flutter plugin using dart:ffi.

Usage

Firstly, import the package:

import 'package:libresample_flutter/libresample_flutter.dart';

You don't need to interact with the plugin class directly. (All its members are private anyway.) Instead, use the Dart wrapper classes Resampler or ResamplerStream.

Using Resampler

    // create a 2:1 upsampler
    var resampler = Resampler(true, 2, 2);

    // process a block of 160 floats
    resampler.process(2, Float32List(160), false);
    // etc

    // process the last block of 160 floats
    resampler.process(2, Float32List(160), true);

    // and free the native resources 
    resampler.close();

Using ResamplerStream

    // create a resampler node upsampling from 16kHz to the native sound card rate
    // and set its input to a previous processing block's output iterator
    var upsamplerStream = ResamplerStream(nativeRate / 16000.0, true)
      ..setInputStream(helper.getOutputStream().iterator);

    // and grab its iterator for use by the next block
    // (in the case of the ressmpler, the next block is typically the sound card,
    // perhaps using the companion project audio_worklet
    stream = upsamplerStream.getOutputStream().iterator;

See audio_worklet fo the companion project.

libresample_flutter's People

Contributors

richardheap avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.