I have this code.
private static Map> alternativeMethod(AudioFormat audioformat,
List listChu
Does this work for you?
public static Map<Long, List<TimePitchValue>> alternativeMethodme(
AudioFormat audioformat, List<ChunkDTO> listChunkDTO,
long index, int sizeChunk) {
int numBytesPerSample = audioformat.getSampleSizeInBits() / 8;
int quantitySamples = sizeChunk / numBytesPerSample;
long baseTime = quantitySamples * index;
return IntStream.range(0, quantitySamples).boxed()
.collect(Collectors.toMap(time -> baseTime + time,
time -> listChunkDTO.stream()
.map(chunkDTO -> new TimePitchValue(
chunkDTO.getPitch(),
baseTime + time,
extractValue(
chunkDTO.getChunk(),
numBytesPerSample,
time)))
.sorted(Comparator.comparingInt(
TimePitchValue::getValue)
.reversed())
.collect(Collectors.toList()),
(a,b)->a,
LinkedHashMap::new));
}
I think I finally figure this out. I had to do some rearanging of methods and such.
Updated. I added the sort and returned the map as a LinkedHashMap