Java examples for javax.sound.sampled:Audio
split Audio Bytes
//package com.java2s; import java.util.Arrays; public class Main { public static byte[] splitAudioBytes(byte[] source, int audioSampleSizeInBits, double fromTimeMillis, double toTimeMillis, double totalLengthMillis) { int sampleSizeInBytes = audioSampleSizeInBits / 8; int divisionPointFrom = (int) Math .floor((fromTimeMillis * source.length) / totalLengthMillis); int divisionPointTo = (int) Math .floor((toTimeMillis * source.length) / totalLengthMillis); divisionPointFrom += divisionPointFrom % sampleSizeInBytes; divisionPointTo += divisionPointTo % sampleSizeInBytes; return Arrays.copyOfRange(source, divisionPointFrom, divisionPointTo);//from ww w.j a va2 s . co m } }