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

套件詳情v0.0.3

waveform_fft

一個用於使用 FFT(快速傅立葉變換)進行即時音訊視覺化以及使用麥克風資料進行音訊擷取的 Flutter 套件

AndroidiOSLinux
近 30 天下載
27
喜歡數
32
Pub 分數
150

安裝套件

flutter pub add waveform_fft

套件介紹

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

Waveform_FFT 是一個 Flutter 套件,透過使用快速傅立葉變換(FFT)處理麥克風輸入,實現音訊的即時視覺化。它從裝置麥克風擷取音訊資料,並轉換為波形與頻譜圖,非常適合音樂應用、音訊分析器或互動式聲音專案。此套件支援 Android、iOS 與 Linux 平台,適用於跨平台音訊應用。透過 pub add 進行最少設定,開發者即可將即時音訊分析整合至其 Flutter 應用中。

適用情境

  • 即時音頻可視化
  • 音樂應用開發
  • 音頻頻譜分析
  • 互動聲音裝置
  • 基於語音的使用者介面回饋

主要特色

  • 即時FFT處理
  • 麥克風音訊捕獲
  • 跨平台支援(Android、iOS、Linux)
  • 與 Flutter 的簡單整合
  • 視覺波形和頻率顯示

適合對象

  • 音頻可視化應用
  • 音樂和節奏遊戲
  • 聲控互動介面
  • 用於音訊分析的教育工具
  • 現場演出應用

使用建議

  • 需要目標設備的麥克風權限
  • 效能可能在低階硬體上有所差異
  • 某些平台上的背景音訊處理受到限制
  • 可能需要額外設定才能獲得最佳音訊品質
  • 不適用於高精度音頻錄製

原始 README

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

waveform_fft

A Flutter package for real-time audio visualization using FFT (Fast Fourier Transform). This package captures audio input and displays it as an animated waveform using fl_chart.

Features

  • Real-time audio capture and frequency analysis
  • Customizable frequency spectrum ranges
  • Smooth animated waveform visualization
  • Support for different sample rates and buffer sizes
  • Easy-to-use API

Getting Started

Installation

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

dependencies:
  waveform_fft: ^0.0.1
Platform Setup
Android

Add the following permissions to your android/app/src/main/AndroidManifest.xml:

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

Add the following keys to your ios/Runner/Info.plist:

<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to microphone to visualize audio.</string>
Customizing the Waveform

The WaveFormWidgetEq widget accepts several parameters for customization:

WaveFormWidgetEq(
  data: data,                                           // Frequency data
  animationDuration: Duration(milliseconds: 200),       // Animation speed
  updateInterval: Duration(milliseconds: 48),           // Update frequency
  barWidth: 5.0,                                       // Width of each bar
  maxY: 80.0,                                          // Maximum Y value
  minY: -80.0,                                         // Minimum Y value
  barColor: Colors.white,                              // Color of bars
  barAlpha: 0.5,                                       // Opacity of bars
);
Audio Capture Service

The AudioCaptureService can be customized with different sample rates and buffer sizes:

final service = AudioCaptureService(
  sampleRate: 44100,    // Default: 44100 Hz
  bufferSize: 256,      // Default: 256 samples
);

Note: The AudioCaptureService is a singleton and should be initialized once in your application.

Example

Here's a demo of the audio visualization in action:

Audio Visualization Demo

The example above demonstrates:

  • Real-time audio capture from device microphone
  • FFT processing of audio data
  • Animated waveform visualization
  • Responsive UI with start/stop recording controls

Check out the complete example code in the /example directory to see how to implement this in your app.

Frequency Spectrum

The package includes predefined frequency spectrum ranges from 0Hz to 22kHz, following standard audio frequency bands. You can customize these ranges by modifying the AudioWaveFormConstants.defaultFrequencySpectrum.

Performance Considerations
  • Higher sample rates provide better frequency resolution but require more processing power
  • Smaller buffer sizes reduce latency but may cause performance issues
  • Consider device capabilities when adjusting these parameters

Compatibility

  • Android: API 21+
  • iOS: iOS 13.0+
  • If you do not want to use raw audio data by microphone then you can use any other flutter package like record or flutter_sound etc for audio recording purpose.

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Inspiration

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。