Gets the number of samples in a frame of the given length in milliseconds and the given sample rate. - Java java.lang

Java examples for java.lang:float

Description

Gets the number of samples in a frame of the given length in milliseconds and the given sample rate.

Demo Code


//package com.java2s;

public class Main {
    /**//from  w  w w.  jav a 2s  .  c o m
     * Gets the number of samples in a frame of the given length in milliseconds and the given sample rate.
     * @param msPerFrame
     * @param sampleRate
     * @return
     */
    public static int getFrameSize(int msPerFrame, int sampleRate) {
        float seconds = (float) msPerFrame / 1000;
        return (int) (seconds * sampleRate);
    }
}

Related Tutorials