android - Dividing in frames a .wav file having a 50% of overlapping in java -
i have read interesting post calculate fft audio file , have downloaded audio.analysis library suggested in 1 of last comment having trouble in doing this:
- dividing in frames .wav file
- having 50 % overlapping of frames
actually have customized class "read example" taken from: http://www.labbookpages.co.uk/audio/javawavfiles.html#methods , had customized follow in order float[] containing frames getted .wav file:
package com.example.audioanalysis; import java.io.file; import java.net.url; import java.util.arraylist; import android.os.environment; import com.example.genderrecognitionapp.mainactivity; public class readexample { public static float[] bufferfromwavfile() { final string path = "example"; final string file_name = "audiorecorder.wav"; arraylist<integer> framesread = new arraylist<integer>(); try { url defaultaudio = mainactivity.class.getresource(environment.getexternalstoragedirectory() + "/" + path + "/" + file_name); final decoder decoder = null; file soundfile = new file(defaultaudio.touri()); // open wav file specified first argument wavfile wavfile = wavfile.openwavfile(soundfile); // number of audio channels in wav file int numchannels = wavfile.getnumchannels(); // create buffer of 100 frames double[] buffer = new double[100 * numchannels]; { // read frames buffer framesread.add(wavfile.readframes(buffer, 100)); } while (framesread != null); // close wavfile wavfile.close(); } catch (exception e) { system.err.println(e); } float[] arrayofframes = new float[framesread.size()]; for(int = 0; i<framesread.size(); i++) { arrayofframes[i] = framesread.get(i); } return arrayofframes; } } my problems resolved class spectrum provider belonging audio.analysis constructor of spectrum provider require decoder object object not in input frames. how wiring 2 part?
could me? thank in advantage.
Comments
Post a Comment