Package 

Object AudioUtils


  • 
    public class AudioUtils
    
                        

    Created by Georgiy Konovalov on 7/18/2023.

    AudioUtils is a utility class that provides various functions to work with audio data in different formats. It contains static methods that facilitate audio data conversions, processing, and manipulation. This class aims to simplify common audio-related tasks and ensure reusability of audio processing logic across the application.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static AudioUtils INSTANCE
    • Method Summary

      Modifier and Type Method Description
      final ShortArray toShortArray(ByteArray audio) Convert audio data from ByteArray to ShortArray.
      final ShortArray toShortArray(FloatArray audio) Convert audio data from FloatArray to ShortArray.
      final Integer getFramesCount(Integer sampleRate, Integer frameSize, Integer durationMs) Calculates the frame count based on the duration in milliseconds, frequency and frame size.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toShortArray

         final ShortArray toShortArray(ByteArray audio)

        Convert audio data from ByteArray to ShortArray.

        Parameters:
        audio - is audio data for conversion.
      • toShortArray

         final ShortArray toShortArray(FloatArray audio)

        Convert audio data from FloatArray to ShortArray.

        Parameters:
        audio - is audio data for conversion.
      • getFramesCount

         final Integer getFramesCount(Integer sampleRate, Integer frameSize, Integer durationMs)

        Calculates the frame count based on the duration in milliseconds, frequency and frame size.

        Parameters:
        durationMs - duration in milliseconds.