Skip to content

Audio Feature Cache

This cache collects and stores all available audio features for you, such that you can easily request them from your effect at any time. You can create it by calling CreateAudioFeatureCache() from the effect API.

The audio feature cache implements the following interface.

public interface IAudioFeatureCache
{
    // Spectral audio features

    /// <summary>
    /// Returns current and normed spectral roll-off frequency.
    /// </summary>
    /// <returns>Spectral roll-off frequency</returns>
    float GetSpectralRollOff();

    /// <summary>
    /// Returns current and normed spectral strong peak. 
    /// </summary>
    /// <returns>Spectral strong peak</returns>
    float GetSpectralStrongPeak();

    /// <summary>
    /// Returns current and normed spectral centroid. 
    /// </summary>
    /// <returns>Spectral centroid</returns>
    float GetSpectralCentroid();

    /// <summary>
    /// Returns current and normed spectral flatness.
    /// </summary>
    /// <returns>Spectral flatness</returns>
    float GetSpectralFlatness();

    /// <summary>
    /// Returns current and normed spectral spread. 
    /// </summary>
    /// <returns>Spectral spread</returns>
    float GetSpectralSpread();

    /// <summary>
    /// Returns current and normed spectral flux. 
    /// </summary>
    /// <returns>Spectral flux</returns>
    float GetSpectralFlux();

    /// <summary>
    /// Returns current and normed spectral decrease.
    /// </summary>
    /// <returns>Spectral decrease</returns>
    float GetSpectralDecrease();

    /// <summary>
    /// Returns current and normed spectral crest.
    /// </summary>
    /// <returns>Spectral crest</returns>
    float GetSpectralCrest();

    // Temporal audio features

    /// <summary>
    /// Returns current and normed temporal RMS. 
    /// </summary>
    /// <returns>Temporal RMS</returns>
    float GetTemporalRms();

    /// <summary>
    /// Returns current and normed temporal zero crossing rate. 
    /// </summary>
    /// <returns>Temporal zero crossing rate</returns>
    float GetTemporalZeroCrossingRate();

    // Beat audio features

    /// <summary>
    /// Did we detect a beat? Resets on request. 
    /// </summary>
    /// <returns>True, if a beat has been detected recently, false otherwise.</returns>
    bool IsBeat();

    /// <summary>
    /// Returns current and normed beat confidence. 
    /// </summary>
    /// <returns>Beat confidence</returns>
    float GetBeatConfidence();

    /// <summary>
    /// Returns current number of beats per minute. 
    /// </summary>
    /// <returns>Beats per minute</returns>
    int GetBeatsPerMinute();

    /// <summary>
    /// Returns current beat period in seconds.
    /// </summary>
    /// <returns>Beat period in seconds</returns>
    float GetBeatPeriod();

    //  Chroma audio features

    /// <summary>
    /// Returns current and normed chroma features (12).
    /// </summary>
    /// <returns>Chroma features</returns>
    float[] GetChromas();
}