Java Milliseconds samplesToMilliseconds(int sampleRate, int samples)

Here you can find the source of samplesToMilliseconds(int sampleRate, int samples)

Description

Calculates how many milliseconds samples are with sampleRate.

License

Open Source License

Parameter

Parameter Description
sampleRate The sample rate.
samples The number of samples.

Return

Samples in milliseconds.

Declaration

public static int samplesToMilliseconds(int sampleRate, int samples) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**// w  w w .  ja  va 2  s .co m
     * Calculates how many milliseconds <code>samples</code> are with
     * <code>sampleRate</code>.
     * 
     * @param sampleRate The sample rate.
     * @param samples The number of samples.
     * @return Samples in milliseconds.
     */
    public static int samplesToMilliseconds(int sampleRate, int samples) {
        return Math.round((float) samples / sampleRate * 1000);
    }
}

Related

  1. roundMicrosToMillis(String micros)
  2. roundMillisWithSecondPrecision(long l)
  3. roundTimeToTheNearestSecondInMilliseconds(long timeInMilliseconds)
  4. safeSleepMillis(long milliseconds)
  5. samples2millis(long samples, double sampleRate)
  6. setGlobalDebugMillis(int millis)
  7. setMilliseconds(Date date, int amount)
  8. setMilliSecondsFromSeconds(int seconds)
  9. setThreadSleepTimeInMillis(long inThreadSleepTimeInMillis)