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

flutter_audio_waveforms 封面
套件詳情v1.2.1+8

flutter_audio_waveforms

一個用於輕鬆在您的應用中加入音頻波形的 UI 庫,具備多種自定義選項。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
26
喜歡數
251
Pub 分數
140

安裝套件

flutter pub add flutter_audio_waveforms

套件介紹

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

一個 Flutter 套件,可簡化將音頻波形整合至應用程式中的過程,提供可自訂的音樂與音頻播放視覺化效果。它支援多個平台,包括 Android、iOS、Web、macOS、Windows 與 Linux,非常適合跨平台音頻應用。開發者可輕鬆顯示即時或預載入的波形資料,並具備多種樣式選項。此函式庫設計簡潔且效能優異,即使處理大型音頻檔案也能實現流暢渲染。特別適用於音樂播放器、語音錄製應用與音頻分析工具。

適用情境

  • 音樂播放器介面
  • 語音錄製可視化
  • 音頻分析工具
  • 即時音頻監控
  • 聲波教育應用
  • 播客播放介面

主要特色

  • 可自訂波形外觀
  • 支援即時音訊渲染
  • 跨平台相容性
  • 與音訊播放器輕鬆整合
  • 可設定的線條粗細和顏色
  • 所有平台上的流暢性能

適合對象

  • 開發以音訊為中心的應用程式開發者
  • 需要動態波形視覺效果的UI設計師
  • 用於聲學物理的教育軟體
  • 行動和桌面音訊應用
  • 需要即時音頻反饋的應用程式

使用建議

  • 需要對非即時使用進行音頻數據預處理
  • 可能影響非常長的音頻檔案的效能
  • 僅限波形可視化(無音訊處理)
  • 最適合中等至高音頻資料頻率的應用程式
  • 未針對極高解析度波形進行優化

原始 README

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

Pub.dev Badge MIT License Badge

A UI library for easily adding audio waveforms to your apps, with several customization options.

Web Demo - Flutter Audio Waveforms Web Demo

Features

You can use the following available waveform types.

  • Polygon
  • Rectangle
  • Squiggly
  • Curved Polygon


Need to add some gradient to your waveform? Say no more! You get it along with other customization options.


Want an active track for your audio out of the box? You get that too!


Check out the short demo of what package offers here

Getting started

The package gives you the ability to add waveforms and customize them. It's mostly like a UI library for waveforms with an additional ability to show active track for playing audio.

So it relies on you to provide the necessary audio data which it needs to draw the waveform. The data we need is basically a list of points/samples that represents that audio.

You can use this audiowaveform program to get the audio json file which will provide us the samples. After installing this program on your machine, generate the json file for an audio by using this command in your terminal.

audiowaveform -i test.mp3 -o test.json

The generated data needs to be processed following some rules which are necessary to get the waveforms drawn properly. To process the data use this processor.

Once you have the processed data points list then you can just pass it down to any of the waveforms available and get started using them.

Check out this article for detailed introduction on this section.

Usage

Usage of all waveforms available is the same with only exception of having more/less customization options for different waveforms.

 // For a regular waveform
 PolygonWaveform( 
   samples: [],
   height: height,
   width: width, 
 )

 // If you want active track for playing audio, pass [maxDuration] and [elapsedDuration]
 PolygonWaveform( 
   samples: [],
   height: height,
   width: width,
   maxDuration: maxDuration,
   elapsedDuration: elapsedDuration, 
 )

Find detailed example here.

Properties

maxDuration:

Maximum duration of the audio.

elapsedDuration:

Elapsed Duration of the audio.

samples:

List of the audio data samples.

Check the Getting Started section on how to generate this.

height :

Waveform height.

width :

Waveform width.

Customization Options

inactiveColor :

Color of the inactive waveform.

activeColor :

Color of the active waveform.

inactiveGradient :

Gradient of the inactive waveform.

activeGradient :

Gradient of the active waveform.

absolute :

Waveform drawn is one sided either above x-axis or below it depending on what invert is set to.

Defaults to false.

invert :

Flips/inverts the waveform upside down.

Defaults to false.

borderWidth :

Width of the border around waveform.

Available only for RectangleWaveform.

isRoundedRectangle :

If true then rounded rectangles are drawn instead of regular rectangles.

Available only for RectangleWaveform.

isCentered :

If true then rectangles are centered along the Y-axis with respect to their center along their height.
If [absolute] is true then this would've no effect.

Available only for RectangleWaveform.

strokeWidth :

Waveform stroke width.

Available only for SquigglyWaveform, CurvedPolygonWaveform.

inactiveBorderColor:

Border color for inactive waveform.

Available only for RectangleWaveform.

activeBorderColor:

Border color for active waveform.

Available only for RectangleWaveform.

showActiveWaveform:

Whether to show active waveform or not.

Defaults to true.

More customization options coming soon!

Contributing Guide

  • Feature request :
    If you have any new feature in mind from which this package can benefit then please let me know by filing an issue here.

  • Improvements :
    Got any suggestions on improving the package, anything from API to performance then let me know by filing the issue here.

  • Bugs:
    If you happen to come across anything that shoudln't be happening then please file an issue here describing what the bug is and how to reproduce it with attached code and preview if possible.

Additional information

What started as a challenge out of curiosity, is now a package that I hope will be helpful to many of you and it was actually really fun building it.

Learned some good stuff while working on it and I hope to make it much more going forward.

If this package helped you then I would appreciate if you ⭐️ the repo which would be enough for me to keep continue working on it 🤓 and feel free to drop by and say hi anytime.

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案