搜索插件、代码仓与 APP 分类

GitHub 代码仓Djsmk123/waveform_fft

waveform_fft

一个用于使用 FFT(快速傅里叶变换)进行实时音频可视化以及使用麦克风数据进行音频捕获的 Flutter 包

waveform_fft 项目封面
星标
9
复刻
1
最近推送(UTC)
2025年3月17日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

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

MD Mobin GitHub avatar
GitHub 作者

MD Mobin ↗

Experienced Flutter Developer adept in all stages of advanced Flutter development.

Delhi,India官方网站 ↗
语言C++CMakeDartRubySwiftCHTMLKotlinObjective-C

此仓库发布的插件

使用的依赖

依赖清单 6 项

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗