Coder Social home page Coder Social logo

ryanheise / just_waveform Goto Github PK

View Code? Open in Web Editor NEW
79.0 4.0 15.0 201 KB

A Flutter plugin to extract waveform data from an audio file suitable for visual rendering.

License: MIT License

Java 35.17% Objective-C 24.73% Ruby 9.40% Dart 29.39% Swift 1.32%
flutter audio waveform

just_waveform's Introduction

just_waveform

This plugin extracts waveform data from an audio file that can be used to render waveform visualisations.

waveform screenshot

Usage

final progressStream = JustWaveform.extract(
  audioInFile: '/path/to/audio.mp3',
  waveOutFile: '/path/to/waveform.wave',
  zoom: const WaveformZoom.pixelsPerSecond(100),
);
progressStream.listen((waveformProgress) {
  print('Progress: %${(100 * waveformProgress.progress).toInt()}');
  if (waveformProgress.waveform != null) {
    // Use the waveform.
  }
});

just_waveform's People

Contributors

alexsmirnov9107 avatar ryanheise avatar volskaya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

just_waveform's Issues

Support 8 bit resolution

When parsing the waveform data, we should do this:

    final data = flags == 0
        ? Int16List.view(bytes, headerLength ~/ 2)
        : Int8List.view(bytes, headerLength);

When painting the data, we should do this:

  double normalise(int s, double height) {
    if (waveform.flags == 0) {
      final y = 32768 + (scale * s).clamp(-32768.0, 32767.0).toDouble();
      return height - 1 - y * height / 65536;
    } else {
      final y = 128 + (scale * s).clamp(-128.0, 127.0).toDouble();
      return height - 1 - y * height / 256;
    }
  }

Attempt to invoke virtual method 'int java.lang.Integer.intValue()'

For starters, thanks for this great plugin.

I'm encountering a problem on Android only, when i extract the data from the audio file I get this error

PlatformException(Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference, null, null, null)

I'm using the same code from the example with a few modifications

final audioFile = File(widget.audioFilePath);

    try {
      final dir = await getApplicationDocumentsDirectory();
      final waveFile = File('${dir.path}/waveform.wave');

      JustWaveform.extract(
        audioInFile: audioFile,
        waveOutFile: waveFile,
        zoom: WaveformZoom.pixelsPerSecond(
          pixelPerSecond.ceil(),
        ),
      ).listen(_progressStream.add, onError: _progressStream.addError);
    } catch (err) {
      _progressStream.addError(e);
    }

I'm having this problem on an Android device on 9.0.

Many thanks.

is the library working today

iam trying to use with just audio library of yours

  1. the combination of both will work?
  2. iam trying to run your example code but giving error :T
    arget of URI doesn't exist: 'package:just_waveform/just_waveform.dart'.
    Try creating the file referenced by the URI, or try using a URI for a file that does

Web support

Hi 👋🏼. Great plugin. Do you have in mind add web support?

Add cancel method to cancel the ongoing extraction

Thanks for this awesome plugin.

Also add the method to cancel the ongoing extraction. If it is possible to cancel the extraction without adding any new method then please mention it in the documentation.

extract audio via url

is it possible to extract audio and generate wave from that url I want to use it in chatting app

Is it possible to extract audio from Stream?

Hello,

Thanks a lot for your nice plugin. One question: Is it possible to render the waveform for an audio-stream that is being recorded? I use your package just_audio and the package record: ^3.0.3 to do recordings.

Best regards,
MapperMalte

add support window

Hello,

Thank you for this plugin.

We create an app of meditation and sound relaxing named Evolum (4.9 stars in stores).
We wanted to add audio wave in our app.
As you know we can't get the audiowave file on the file directly in the app when an user want to relax.

We have a dashboard where internal user can upload audio to be available in the app.

This dashboard is web so we can't generate the audiowave file so we wanted to do by deploying our dashboard in macOS but some of our internal user have only window...

We try to doc something with Google Cloud function when a file is uploaded in our storage with that

https://github.com/bbc/audiowaveform

but we didn't successed...

So if adding window support is not a big challenge maybe that can be usefull for us.

Thanks,

how to implements a proper WaveformZoom?

Hi there,

I was wondering how can I evaluate a proper zoom value? Sometimes, I dont need that accurate wave such as pixelsPerSecond(100). Even 2 to 3 pixelsPerSecond is enough for me. But it extracts a null waveform. Well, if the audio is long enough, it works.

Thanks

Example code load asset error

Hi, I am first tring flutter develop and just_waveform.
I tried to run example but it got error message: Unable to load asset: audio/waveform.mp3.
Can help me to know where I got wrong?
pic

Question: Cant follow along with example code

I am trying to get a visualization bar in my app for audio. I am checking out your plugin and in the example page you have a line..

final progressStream = BehaviorSubject<WaveformProgress>();

Where does BehaviourSubject come from? I searched the page and that was the only reference to the name anywhere

extract from ipod-library

I'm gettings songs with flutter plugin on_audio_query which returns song.uri likes ipod-library://item/item.flac?id=4724756324520404040, how can I extract wavefrom from this.

Thanks.

just_audio integration

Sorry if it looks like a dumb question, but is there anyway to integrate this with just_audio player? I wanna use it as progress indicator.

Just audio wavefrom

You took and immediately closed my problem. And the Internet does not have any information about how to connect these two plugins. There is no such question on Stackoverflow and ChatGpt doesn't know your plugin. Can you share the code? I don't think it's that much of a problem for you. There is no documentation about it at all. Yes, I'm new to programming. And how to deal with this issue?
Screenshot_2023-07-21-18-51-20-784_fambox pro-edit

Frozen on 99% while generating.

I just added that package on my flutter project. Awesome package.
But I met to frozen waveform generate on 99% while creating.
If anyone has some solutions for that, Please let me know.

=== My flutter doctor ===

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.6-0.0.pre.2, on macOS 12.5.1 21G83 darwin-x64, locale en-LA)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.71.0)
[✓] VS Code (version 1.54.2)
[✓] Connected device (3 available)
    ! Error: JinYZ’s iPhone has recently restarted. Xcode will continue when JinYZ’s iPhone is unlocked. (code -14)
[✓] HTTP Host Availability

=== My Test Device ===
Samgsung A20

Thanks.

Extract waveform from audio as uint8list

First thanks for the awesome package , i see that the package extract the wave form audio to a wave file . i wonder if there is a way to extract the wave as (uint8list ) format .
Kind regards

large mp3 file size error

When I try to load an mp3 file around 3mb it returns the error
PlatformException(ExtAudioOpenURL error, ExtAudioOpenURL error, null, null)

Have you tested with any max large files?

PlatformException(ExtAudioOpenURL error, ExtAudioOpenURL error, null, null)

Hi. I get this error when try extract file from audio.

PlatformException(ExtAudioOpenURL error, ExtAudioOpenURL error, null, null).

This is only in the iOS version. Everything works fine on android.

Thera are my files path:

file:///Users/user/Library/Developer/CoreSimulator/Devices/DAB4C89D-6849-460A-A4C7-C1E2D7A81125/data/Containers/Data/Application/D7974DA8-ED71-480B-B289-36CE72899032/tmp/BDC72317-B389-4F46-8CE3-1A24A37172A9.m4a

file:///Users/user/Library/Developer/CoreSimulator/Devices/DAB4C89D-6849-460A-A4C7-C1E2D7A81125/data/Containers/Data/Application/D7974DA8-ED71-480B-B289-36CE72899032/tmp/BDC72317-B389-4F46-8CE3-1A24A37172A9.wave

I am working on a simulator, can this be the problem?

Hide logs in console

How can we hide logs?

Example:
wave length = 1712
waveHeader[0] = 1
waveHeader[1] = 0
waveHeader[2] = 16000
waveHeader[3] = 160
waveHeader[4] = 651
Total scaled samples: 1302
waveHeader[0] = 1
waveHeader[1] = 0
waveHeader[2] = 16000
waveHeader[3] = 160
waveHeader[4] = 856

How to cancel the waveform processing before done?

I have added that package to my flutter project.
But when move before and next page, I met a issue for percent change one.
The percent value is return the previous and current ones.
Could you help me for that issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.