i want to split my audio file(.wav format) in frames of 32 milliseconds each sampling frequn-16khz,number of channels-1(mono),pcm signal, sample size=93638. I am using the following code for reading my wave file which give an array which is stored in data2 array.Can some one tell me how to proceed from this -:
import java.io.ByteArrayOutputStream;
import java.io.File;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
public class AudioFiles
{
public static void main(String[] args)
{
String file = "D:/p.wav";
int i;
AudioFiles afiles = new AudioFiles();
byte[] data2 = afiles.readWAVAudioFileData(file);
for(i=0;i<data2.length;i++)
{
System.out.format("\t"+data2[i]);
}
System.out.printf("\n%d",data2.length);
}
public byte[] readWAVAudioFileData(final String filePath)
{
byte[] data = null;
try {
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
final AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File(filePath));
AudioSystem.write(audioInputStream, AudioFileFormat.Type.WAVE, baout);
audioInputStream.close();
baout.close();
data = baout.toByteArray();
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
}