Class EmbeddedAudioSource

    • Constructor Detail

      • EmbeddedAudioSource

        EmbeddedAudioSource(DataProvider audioDataProvider, AudioEncoding audioEncoding, int sampleRate, int sampleSize, int channels, String description)
        Constructs an embedded audio source with data served from a DataProvider.
        Parameters:
        audioDataProvider - Provider for audio data that should be saved in the document.
        sampleRate - Sample rate of the audio data in Hz.
        channels - Number of channels in the audio data.
        description - The optional description of the audio data.
      • EmbeddedAudioSource

        EmbeddedAudioSource(Array<byte> audioData, AudioEncoding audioEncoding, int sampleRate, int sampleSize, int channels, String description)
        Constructs an embedded audio source with data served from memory.
        Parameters:
        audioData - Audio data that should be saved in the document.
        sampleRate - Sample rate of the audio data in Hz.
        channels - Number of channels in the audio data.
        description - The optional description of the audio data.
    • Method Detail

      • getDataProvider

        @NonNull() DataProvider getDataProvider()

        Returns data provider with audio data in ENCODING_PCM_16BIT format.

        This will always return non-null even if sound source was created from in-memory data - wrapping the in-memory audio data in MemoryDataProvider.

        Returns:

        An instance of DataProvider which serves the audio data.

      • getSampleRate

         int getSampleRate()

        The sampling rate, in samples per second.

        Returns:

        Sampling rate of the audio data.

      • getSampleSize

         int getSampleSize()

        The number of bits per sample value per channel.

        Returns:

        Number of bits per sample value in the audio data.

      • getChannels

         int getChannels()

        The number of audio channels.

        Returns:

        Number of audio channels.

      • getDuration

         long getDuration()

        Audio duration in millisecond.

        Returns:

        Audio clip duration in milliseconds, or DURATION_UNKNOWN if duration is unknown.