搜尋套件、儲存庫與 APP 分類

套件詳情v1.1.2

flutter_voice_processor

一個專為即時語音音訊處理設計的Flutter音訊錄製外掛。

AndroidiOS
近 30 天下載
7430
喜歡數
33
Pub 分數
150

安裝套件

flutter pub add flutter_voice_processor

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個用於即時語音音訊處理的 Flutter 插件,可無縫整合語音助理功能。由 picovoice.ai 所開發,支援 Android 與 iOS 平台,提供低延遲的音訊擷取與處理,非常適合需要對語音輸入立即回應的應用程式。此套件專為希望在裝置上實作語音轉文字(STT)與語音指令辨識、且延遲極低、準確度高的開發者設計。它運用針對邊緣裝置優化的先進聲學模型,確保隱私與效能,無需依賴雲端服務。

適用情境

  • 即時語音指令
  • 設備端語音辨識
  • 語音控制應用
  • 互動式語音助理
  • 移動應用中的音頻分析
  • 注重隱私的語音處理

主要特色

  • 即時音訊處理
  • 設備端語音辨識功能
  • 低延遲性能
  • 跨平台支援(Android、iOS)
  • 隱私保護設計
  • 與 Picovoice 唤醒詞引擎的整合

適合對象

  • 開發語音功能移動應用的開發者
  • 重視用戶隱私的團隊
  • 需要快速響應時間的應用程式
  • 基於邊緣的語音處理專案
  • 移動語音助手原型

使用建議

  • 需要理解音訊串流
  • 僅限Picovoice生態系統
  • 商業使用可能需要額外的許可
  • 性能取決於設備硬體
  • 不適用於大規模基於雲端的語音辨識

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Flutter Voice Processor

GitHub release GitHub

Pub Version

Made in Vancouver, Canada by Picovoice

Twitter URL

YouTube Channel Views

The Flutter Voice Processor is an asynchronous audio capture library designed for real-time audio processing on mobile devices. Given some specifications, the library delivers frames of raw audio data (16-bit, mono PCM) to the user via listeners.

Table of Contents

Requirements

Compatibility

  • Flutter 1.20.0+
  • Android 5.0+ (API 21+)
  • iOS 13.0+

Installation

Flutter Voice Processor is available via pub.dev. To import it into your Flutter project, add the following line to your pubspec.yaml:

dependencies:
  flutter_voice_processor: ^<version>

Permissions

To enable recording with the hardware's microphone, you must first ensure that you have enabled the proper permission on both iOS and Android.

On iOS, open the Info.plist file and add the following line:

<key>NSMicrophoneUsageDescription</key>
<string>[Permission explanation]</string>

On Android, open the AndroidManifest.xml and add the following line:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

See our example app for how to properly request this permission from your users.

Usage

Access the singleton instance of VoiceProcessor:

import 'package:flutter_voice_processor/flutter_voice_processor.dart';

VoiceProcessor? _voiceProcessor = VoiceProcessor.instance;

Add listeners for audio frames and errors:

VoiceProcessorFrameListener frameListener = (List<int> frame) {
    // use audio
}

VoiceProcessorErrorListener errorListener = (VoiceProcessorException error) {
    // handle error
}

_voiceProcessor?.addFrameListener(frameListener);
_voiceProcessor?.addErrorListener(errorListener);

Ask for audio record permission and start recording with the desired frame length and audio sample rate:

final int frameLength = 512;
final int sampleRate = 16000;
if (await _voiceProcessor?.hasRecordAudioPermission() ?? false) {
    try {
        await _voiceProcessor?.start(frameLength, sampleRate);
    } on PlatformException catch (ex) {
        // handle start error
    }
} else {
    // user did not grant permission
}

Stop audio capture:

try {
    await _voiceProcessor?.stop();
} on PlatformException catch (ex) {
    // handle stop error
}

Once audio capture has started successfully, any frame listeners assigned to the VoiceProcessor will start receiving audio frames with the given frameLength and sampleRate.

Capturing with Multiple Listeners

Any number of listeners can be added to and removed from the VoiceProcessor instance. However, the instance can only record audio with a single audio configuration (frameLength and sampleRate), which all listeners will receive once a call to start() has been made. To add multiple listeners:

VoiceProcessorFrameListener listener1 = (frame) { }
VoiceProcessorFrameListener listener2 = (frame) { }
List<VoiceProcessorFrameListener> listeners = [listener1, listener2];
_voiceProcessor?.addFrameListeners(listeners);

_voiceProcessor?.removeFrameListeners(listeners);
// or
_voiceProcessor?.clearFrameListeners();

Example

The Flutter Voice Processor app demonstrates how to ask for user permissions and capture output from the VoiceProcessor.

Releases

v1.1.0 - August 4, 2023
  • Numerous API improvements
  • Error handling improvements
  • Allow for multiple listeners instead of a single callback function
  • Upgrades to testing infrastructure and example app
v1.0.0 - December 8, 2020
  • Initial public release.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。