mp3_info 0.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 66

MP3 Info #

Processes an MP3 file to extract key meta information such as MPEG version, MPEG layer version, bitrate, sample rate and duration.

Usage #

A simple usage example:

import 'dart:io';

import 'package:mp3_info/mp3_info.dart';

main() {
  MP3Info mp3 = MP3Processor.fromFile(File("test_files/test_128kpbs_441khz_stereo_10s.mp3"));

  print('MP3: test_128kpbs_441khz_stereo_10s.mp3');

  switch(mp3.sampleRate) {
    case SampleRate.rate_32000:
      print('Sample rate: 32KHz');
      break;
    case SampleRate.rate_44100:
      print('Sample rate: 44.1KHz');
      break;
    case SampleRate.rate_48000:
      print('Sample rate: 48KHz');
      break;
  }

  print('Bit rate: ${mp3.bitrate}bps');
  print('Duration: ${mp3.duration}');
}

Task list #

  • [x] MP3 Key fields
    • [x] MPEG version
    • [x] MPEG layer version
    • [x] Sample rate
    • [x] Bitrate
    • [x] Duration
    • [x] CRC check
    • [x] Channel mode
    • [ ] Mode extension
    • [ ] Copyright flag
    • [ ] Origin (original/copy))
    • [ ] Emphasis
  • [x] CBR (Constant Bitrate) support
  • [ ] VBR (Variable Bitrate) support
  • [ ] ID3 Tag support
  • [ ] ID1 Tag support

0.1.3 #

  • Fix new lints in Pedantic 1.9.0

0.1.2 #

  • Corrected package description.

0.1.1 #

  • Add option to call processor with bytes.
  • Improved documentation.

0.1.0 #

  • Initial version.

example/mp3_info_example.dart

import 'dart:io';

import 'package:mp3_info/mp3_info.dart';

void main() {
  final mp3 = MP3Processor.fromFile(
      File('test_files/test_128kpbs_441khz_stereo_10s.mp3'));

  print('MP3: test_128kpbs_441khz_stereo_10s.mp3');

  switch (mp3.sampleRate) {
    case SampleRate.rate_32000:
      print('Sample rate: 32KHz');
      break;
    case SampleRate.rate_44100:
      print('Sample rate: 44.1KHz');
      break;
    case SampleRate.rate_48000:
      print('Sample rate: 48KHz');
      break;
  }

  print('Bit rate: ${mp3.bitrate}bps');
  print('Duration: ${mp3.duration}');
}

Use this package as a library

1. Depend on it

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


dependencies:
  mp3_info: ^0.1.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:mp3_info/mp3_info.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
32
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
Dev dependencies
pedantic ^1.9.0
test ^1.9.4