Saturday, 8 September 2018

Flutter/Java Plot Mp3 Frequency intensity

I don't really properly know how to explain the exact thing I'm achieving. I need to track down the intensity of certain frequencies from an mp3 file for a certain number of times on android (Java) (or if it's possible on Dart (Flutter)). This is an image explaining what I mean:

I made this screenshot in Blender using Bake Sound to f-Curve Modifier, which is exactly what I'm trying to achieve, but it's written in C++, so the first thing I did was trying to get some hints from the source code but I couldn't manage to find anything.

As You can see it's not real-time but it's the value of a certain frequency (frequency Range in this case: 80-255Hz) over time.

zoomed Version As you can see it's just a graph of the intensity of that frequency over time. and the "divions" on X axis in this case are of about 180s/600 frames.

For what concerns the file format: The input files are mp3s or wav.

For What Concerns the Language:

My main goal is to achieve this in java, but if it's possible, it would be nice to be done in Flutter (so Dart). I'm asking one of the two. If Flutter is impossible or too difficult, a java implementation is good anyway, I'm using a platform channel already on the application so isn't that much of a problem.

I've looked up online but the only tutorials I could find were real time examples that used FFT.

Better Explanation Of what I need: I have a number of frames: Let's Say 300. I need a function that is something like this:

List<Integer> calculateFrequencies(int number_of_frames, double freq_low, 
freq_high, String FilePath){
List<Integer> result = new ArrayList<>();
double length = //Here I need to obtain the length of the song in units as small as possible, for example, milliseconds or nanoseconds

for(int v = 0, v < number_of_frames; v++){

    double currFrame = lenght/300 * v;
    double intensity = get_intensity(currFrame, freq_low, freq_high) //How Could I do this?? 


    result.add(intensity);
 }

return result;

}

How could I do this?

Is that possible? And if it is, is it possible in android too?



from Flutter/Java Plot Mp3 Frequency intensity

No comments:

Post a Comment