audio_meta: Leightweight Audio Information Extraction

License GitHub code size in bytes GitHub commit activity Free PS

 

Notice

This package DOES NOT extract audio metadata like ID3 tags (e.g. Label, Release Year). This package DOES extract information about the audio stream, like duration or bit rate.

⚠️ This package is still in ACTIVE DEVELOPMENT and currently serves more as a preview. First stable, thoroughly tested version will be 2.0.0. You have been warned.

Content

  • 💯 100% cross-platform
  • 💯 100% pure dart
  • 🙅‍♂️ 0 dependencies
  • ✅ Uniform audio information for all file types
  • ✅ No need for external tools like ffprobe

Current Support For:

  • ✅ mp3
  • ✅ wav
  • ✅ aac
  • ✅ ogg
  • ✅ flac
  • ✅ opus
  • 🚧 m4a

Metadata Available Through This Package:

  • 🔊 Track Duration
  • 🔊 Sample Rate
  • 🔊 Bit Rate
  • 🔊 Bit Depth
  • 🔊 Channel Count
  • 🔊 Encoding

Getting Started

Get from pub.dev

dart pub add audio_meta

Include in Project

import 'package:audio_meta/audio_meta.dart';

Constructors

// sync

// unsupported on web
AudioMeta.fromFile(File file)
AudioMeta.fromPath(String path)

// supported on web
AudioMeta.fromBytes(Uint8list bytes)

// async

// unsupported on web
AudioMeta.fromFileAsync(File file)
AudioMeta.fromPathAsync(String path)

// supported on web
AudioMeta.fromBytesAsync(Uint8list bytes)

Basic Example

import 'dart:io';
import 'package:audio_meta/audio_meta.dart';

final meta = AudioMeta.fromFile(File('audio.mp3'));
print(meta.type); // AudioType.mp3
print(meta.sampleRate); // 44100
print(meta.bitRate); // 128000
print(meta.duration); // Duration(seconds: 180)

Example Project

An example project can be found in the example folder of the repository.

FAQ

Nothing here yet!

Contribution

Feel free to support me by working on open issues, or making a feature request / opening an issue.