pitch_capture 0.0.1 copy "pitch_capture: ^0.0.1" to clipboard
pitch_capture: ^0.0.1 copied to clipboard

this package intended for capture pitch

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:capture/capture.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final Capture _plugin = Capture();

  @override
  void initState() {
    super.initState();
    // Need to initialize before use note that this is async!
    _plugin.init();
  }

  Future<void> _startCapture() async {
    await _plugin.start(listener, onError, sampleRate: 16000, bufferSize: 3000);
  }

  Future<void> _stopCapture() async {
    await _plugin.stop();
  }

  void listener(dynamic obj) {
    debugPrint('$obj');
  }

  void onError(Object e) {
    debugPrint('$e');
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Flutter Audio Capture Plugin')),
        body: Column(
          children: [
            Expanded(
              child: Row(
                children: [
                  Expanded(
                    child: Center(
                      child: FloatingActionButton(
                        onPressed: _startCapture,
                        child: Text("Start"),
                      ),
                    ),
                  ),
                  Expanded(
                    child: Center(
                      child: FloatingActionButton(
                        onPressed: _stopCapture,
                        child: Text("Stop"),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
140
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

this package intended for capture pitch

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on pitch_capture

Packages that implement pitch_capture