Calculate frames based on AudioFormat - Java javax.sound.sampled

Java examples for javax.sound.sampled:Audio

Description

Calculate frames based on AudioFormat

Demo Code


//package com.java2s;

import javax.sound.sampled.AudioFormat;

public class Main {
    public static int frames(AudioFormat format, int dataLength) {
        int frameSize = format.getFrameSize();
        return dataLength / frameSize;
    }/*from w  w w.j ava  2  s.  c o m*/
}

Related Tutorials