Class AfpGenerator

  • All Implemented Interfaces:

    
    public final class AfpGenerator
    
                        

    AfpGenerator is responsible for handling audio recording from the microphone, and generating AFP (Audio Fingerprint) data.

    This class manages the lifecycle of audio recording, including starting and stopping the recording process, buffering audio data, detecting silence, and invoking callbacks to notify listeners of recording events and AFP generation results.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static Integer HOP_PER_SEC
      public final static Integer LEVEL_COUNT
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Unit setAudioParams(Integer rate, Integer nchannels, Integer nsamplebytes) Sets audio parameters for recording.
      final Unit setRecordingDuration(Double sec) Sets the recording duration in seconds.
      final Unit setRecordingInterval(Double sec) Sets the recording interval in seconds.
      final Unit setSilenceRate(Double sr) Sets the silence rate threshold.
      final Unit setSilenceThreshold(Double st) Sets the silence threshold value.
      final Unit startGen() Starts AFP generation from the microphone.
      final Unit stopGen() Stops AFP generation and releases resources.
      • Methods inherited from class java.lang.Object

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

      • setAudioParams

         final Unit setAudioParams(Integer rate, Integer nchannels, Integer nsamplebytes)

        Sets audio parameters for recording.

        Parameters:
        rate - The sample rate in Hz.
        nchannels - The number of audio channels.
        nsamplebytes - The number of bytes per audio sample.
      • setRecordingDuration

         final Unit setRecordingDuration(Double sec)

        Sets the recording duration in seconds.

        Parameters:
        sec - The duration in seconds.
      • setRecordingInterval

         final Unit setRecordingInterval(Double sec)

        Sets the recording interval in seconds.

        Parameters:
        sec - The interval in seconds.
      • setSilenceRate

         final Unit setSilenceRate(Double sr)

        Sets the silence rate threshold.

        Parameters:
        sr - The silence rate threshold.
      • setSilenceThreshold

         final Unit setSilenceThreshold(Double st)

        Sets the silence threshold value.

        Parameters:
        st - The silence threshold value.
      • startGen

         final Unit startGen()

        Starts AFP generation from the microphone.

      • stopGen

         final Unit stopGen()

        Stops AFP generation and releases resources.