EZAudioFFTRolling

@interface EZAudioFFTRolling : EZAudioFFT

The EZAudioFFTRolling, a subclass of EZAudioFFT, provides a class to calculate an FFT for an incoming audio signal while maintaining a history of audio data to allow much higher resolution FFTs. For instance, the EZMicrophone typically provides 512 frames at a time, but you would probably want to provide 2048 or 4096 frames for a decent looking FFT if you’re trying to extract precise frequency components. You will typically be using this class for variable length FFTs instead of the EZAudioFFT base class.

  • Initializes an EZAudioFFTRolling instance with a window size and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT and a float representing the sample rate of the incoming audio (can be 0 if you don’t care about the maxFrequency property). The history buffer size in this case is the windowSize * 8, which is pretty good for most cases. - parameter: windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT). - parameter: sampleRate A float representing the sample rate of the incoming audio signal. - returns: A newly created EZAudioFFTRolling instance.

    Declaration

    Objective-C

    - (instancetype)initWithWindowSize:(vDSP_Length)windowSize
                            sampleRate:(float)sampleRate;

    Swift

    init!(windowSize: vDSP_Length, sampleRate: Float)

    Parameters

    windowSize

    A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).

    sampleRate

    A float representing the sample rate of the incoming audio signal.

    Return Value

    A newly created EZAudioFFTRolling instance.

  • Initializes an EZAudioFFTRolling instance with a window size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a float representing the sample rate of the incoming audio (can be 0 if you don’t care about the maxFrequency property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated. The history buffer size in this case is the windowSize * 8, which is pretty good for most cases. - parameter: windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT). - parameter: sampleRate A float representing the sample rate of the incoming audio signal. - parameter: delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated. - returns: A newly created EZAudioFFTRolling instance.

    Declaration

    Objective-C

    - (instancetype)initWithWindowSize:(vDSP_Length)windowSize
                            sampleRate:(float)sampleRate
                              delegate:(id<EZAudioFFTDelegate>)delegate;

    Swift

    init!(windowSize: vDSP_Length, sampleRate: Float, delegate: EZAudioFFTDelegate!)

    Parameters

    windowSize

    A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).

    sampleRate

    A float representing the sample rate of the incoming audio signal.

    delegate

    An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.

    Return Value

    A newly created EZAudioFFTRolling instance.

  • Initializes an EZAudioFFTRolling instance with a window size, a history buffer size, and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window’s underlying circular buffer, and a float representing the sample rate of the incoming audio (can be 0 if you don’t care about the maxFrequency property). - parameter: windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT). - parameter: historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the windowSize argument. - parameter: sampleRate A float representing the sample rate of the incoming audio signal. - returns: A newly created EZAudioFFTRolling instance.

    Declaration

    Objective-C

    - (instancetype)initWithWindowSize:(vDSP_Length)windowSize
                     historyBufferSize:(vDSP_Length)historyBufferSize
                            sampleRate:(float)sampleRate;

    Swift

    init!(windowSize: vDSP_Length, historyBufferSize: vDSP_Length, sampleRate: Float)

    Parameters

    windowSize

    A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).

    historyBufferSize

    A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the windowSize argument.

    sampleRate

    A float representing the sample rate of the incoming audio signal.

    Return Value

    A newly created EZAudioFFTRolling instance.

  • Initializes an EZAudioFFTRolling instance with a window size, a history buffer size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window’s underlying circular buffer, a float representing the sample rate of the incoming audio (can be 0 if you don’t care about the maxFrequency property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated. - parameter: windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT). - parameter: historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the windowSize argument. - parameter: sampleRate A float representing the sample rate of the incoming audio signal. - parameter: delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated. - returns: A newly created EZAudioFFTRolling instance.

    Declaration

    Objective-C

    - (instancetype)initWithWindowSize:(vDSP_Length)windowSize
                     historyBufferSize:(vDSP_Length)historyBufferSize
                            sampleRate:(float)sampleRate
                              delegate:(id<EZAudioFFTDelegate>)delegate;

    Swift

    init!(windowSize: vDSP_Length, historyBufferSize: vDSP_Length, sampleRate: Float, delegate: EZAudioFFTDelegate!)

    Parameters

    windowSize

    A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).

    historyBufferSize

    A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the windowSize argument.

    sampleRate

    A float representing the sample rate of the incoming audio signal.

    delegate

    An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.

    Return Value

    A newly created EZAudioFFTRolling instance.

  • Class method to initialize an EZAudioFFTRolling instance with a window size and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT and a float representing the sample rate of the incoming audio (can be 0 if you don’t care about the maxFrequency property). The history buffer size in this case is the windowSize * 8, which is pretty good for most cases. - parameter: windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT). - parameter: sampleRate A float representing the sample rate of the incoming audio signal. - returns: A newly created EZAudioFFTRolling instance.

    Declaration

    Objective-C

    + (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
                           sampleRate:(float)sampleRate;

    Swift

    class func fft(withWindowSize windowSize: vDSP_Length, sampleRate: Float) -> Self!

    Parameters

    windowSize

    A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).

    sampleRate

    A float representing the sample rate of the incoming audio signal.

    Return Value

    A newly created EZAudioFFTRolling instance.

  • Class method to initialize an EZAudioFFTRolling instance with a window size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a float representing the sample rate of the incoming audio (can be 0 if you don’t care about the maxFrequency property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated. The history buffer size in this case is the windowSize * 8, which is pretty good for most cases. - parameter: windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT). - parameter: sampleRate A float representing the sample rate of the incoming audio signal. - parameter: delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated. - returns: A newly created EZAudioFFTRolling instance.

    Declaration

    Objective-C

    + (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
                           sampleRate:(float)sampleRate
                             delegate:(id<EZAudioFFTDelegate>)delegate;

    Swift

    class func fft(withWindowSize windowSize: vDSP_Length, sampleRate: Float, delegate: EZAudioFFTDelegate!) -> Self!

    Parameters

    windowSize

    A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).

    sampleRate

    A float representing the sample rate of the incoming audio signal.

    delegate

    An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.

    Return Value

    A newly created EZAudioFFTRolling instance.

  • Class method to initialize an EZAudioFFTRolling instance with a window size, a history buffer size, and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window’s underlying circular buffer, and a float representing the sample rate of the incoming audio (can be 0 if you don’t care about the maxFrequency property). - parameter: windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT). - parameter: historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the windowSize argument. - parameter: sampleRate A float representing the sample rate of the incoming audio signal. - returns: A newly created EZAudioFFTRolling instance.

    Declaration

    Objective-C

    + (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
                    historyBufferSize:(vDSP_Length)historyBufferSize
                           sampleRate:(float)sampleRate;

    Swift

    class func fft(withWindowSize windowSize: vDSP_Length, historyBufferSize: vDSP_Length, sampleRate: Float) -> Self!

    Parameters

    windowSize

    A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).

    historyBufferSize

    A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the windowSize argument.

    sampleRate

    A float representing the sample rate of the incoming audio signal.

    Return Value

    A newly created EZAudioFFTRolling instance.

  • Class method to initialize an EZAudioFFTRolling instance with a window size, a history buffer size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window’s underlying circular buffer, a float representing the sample rate of the incoming audio (can be 0 if you don’t care about the maxFrequency property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated. - parameter: windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT). - parameter: historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the windowSize argument. - parameter: sampleRate A float representing the sample rate of the incoming audio signal. - parameter: delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated. - returns: A newly created EZAudioFFTRolling instance.

    Declaration

    Objective-C

    + (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
                    historyBufferSize:(vDSP_Length)historyBufferSize
                           sampleRate:(float)sampleRate
                             delegate:(id<EZAudioFFTDelegate>)delegate;

    Swift

    class func fft(withWindowSize windowSize: vDSP_Length, historyBufferSize: vDSP_Length, sampleRate: Float, delegate: EZAudioFFTDelegate!) -> Self!

    Parameters

    windowSize

    A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).

    historyBufferSize

    A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the windowSize argument.

    sampleRate

    A float representing the sample rate of the incoming audio signal.

    delegate

    An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.

    Return Value

    A newly created EZAudioFFTRolling instance.

  • A vDSP_Length (unsigned long) representing the length of the FFT window.

    Declaration

    Objective-C

    @property (readonly, nonatomic) vDSP_Length windowSize;

    Swift

    var windowSize: vDSP_Length { get }
  • A float array representing the audio data in the internal circular buffer used to perform the FFT. This will increase as more data is appended to the internal circular buffer via the computeFFTWithBuffer:withBufferSize: method. The length of this array is the timeDomainBufferSize property.

    Declaration

    Objective-C

    @property (readonly, nonatomic) float *timeDomainData;

    Swift

    var timeDomainData: UnsafeMutablePointer
  • A UInt32 representing the length of the audio data used to perform the FFT.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UInt32 timeDomainBufferSize;

    Swift

    var timeDomainBufferSize: UInt32 { get }