Class AudioAnalyzerCore

Nested Relationships

Nested Types

Class Documentation

class AudioAnalyzerCore

Audio Analyzer Core.

This class uses raw wave data to apply an amplitude, spectrum, and/or beat tracking analysis

Public Types

typedef TArray<TArray<float>> FChannelTArray

TArray Channel Container (float) type

typedef TArray<TArray<int32>> IChannelTArray

TArray Channel Container (int32) type

typedef TArray<TArray<bool>> BChannelTArray

TArray Channel Container (bool) type

Public Functions

template<class T, class Compare>
inline int32 binarySearch(const TArray<T> &ArrayToSearch, int32 FirstIndex, int32 LastIndex, const T &Value, Compare Comp)

Bynary search function for TArray container

Template Parameters:
  • T – Type of the buffer elements

  • Compare – Function to compare order

Parameters:
  • ArrayToSearch – TArray reference to be used

  • FirstIndex – Index of the low bound

  • LastIndex – Index of the high bound

  • Value – Value to search

  • Comp – Function to compare

Returns:

Index of the found element, if not present returns the first index

AudioAnalyzerCore()

Constructor

~AudioAnalyzerCore()

Destructor

AudioAnalyzerCore(AudioAnalyzerCore const &x) = delete

Disable copy constructor

Parameters:

x – &#8212;

void operator=(AudioAnalyzerCore const &x) = delete

Disable copy assignment

Parameters:

x – &#8212;

void setAudioSource(AudioAnalyzerSource *audioSourcePtr)

Sets the audio input source

Parameters:

audioSourcePtr – A pointer to an AudioAnalyzerSource instance

inline bool hasValidAudio() const

Returns if the core has an audio source with a valid loaded audio

Returns:

Core has a valid audio info

inline bool hasAmplitudeConfig() const

Returns if the core has been correctly initializated to calculate frequency spectrum

Returns:

Core has a valid frequency spectrum configuration

inline bool hasFrequencySpectrumConfig() const

Returns if the core has been correctly initializated to calculate frequency spectrum

Returns:

Core has a valid frequency spectrum configuration

inline bool hasBeatTrackingConfig() const

Returns if the core has been correctly initializated to calculate beat tracking

Returns:

Core has a valid beat tracking configuration

inline bool hasPitchTrackingConfig() const

Returns if the core has been correctly initializated to calculate pitch tracking

Returns:

Core has a valid pitch tracking configuration

bool isAConfigSplitChannel() const

Return if amplitude configuration is set on Split mode

Returns:

Amplitude configuration is set on Split mode

bool isSConfigSplitChannel() const

Return if spectrum configuration is set on Split mode

Returns:

Spectrum configuration is set on Split mode

bool isBTConfigSplitChannel() const

Return if beat tracking configuration is set on Split mode

Returns:

Beat tracking configuration is set on Split mode

bool isPTConfigSplitChannel() const

Return if pitch tracking configuration is set on Split mode

Returns:

Pitch tracking configuration is set on Split mode

void initializeAConfig(FChannelTArray &outputValues, int channelMode, int channel, int numTimeBands, float timeWindow)

Initializes the amplitude analysis configuration

Parameters:
  • outputValues[out] Output container

  • channelMode – Channel selection mode

  • channel – Number of channel

  • numTimeBands – Number of bars

  • timeWindow – Window to calculate the spectrum (in seconds)

void initializeSConfig_Linear(FChannelTArray &outputValues, FChannelTArray &outputAverageValues, FChannelTArray &outputPeaksValues, FChannelTArray &outputPeaksEnergyValues, int channelMode, int channel, int numFreqBands, float timeWindow, int historySize, bool usePeakValues, int numPeaks)

Initializes the linear spectrum configuration

Parameters:
  • outputValues[out] Output container

  • outputAverageValues[out] Output average container

  • outputPeaksValues[out] Output peak container

  • outputPeaksEnergyValues[out] Output peak energy container

  • channelMode – Channel selection mode

  • channel – Number of channel

  • numFreqBands – Number of bars

  • timeWindow – Window to calculate the spectrum (in seconds)

  • historySize – History size

  • usePeakValues – Returns peak value of the band instead of average values

  • numPeaks – Number of peaks to be calculated

void initializeSConfig_Log(FChannelTArray &outputValues, FChannelTArray &outputAverageValues, FChannelTArray &outputPeaksValues, FChannelTArray &outputPeaksEnergyValues, int channelMode, int channel, int numFreqBands, float timeWindow, int historySize, bool usePeakValues, int numPeaks)

Initializes the logarithmic spectrum configuration

Parameters:
  • outputValues[out] Output container

  • outputAverageValues[out] Output average container

  • outputPeaksValues[out] Output peak container

  • outputPeaksEnergyValues[out] Output peak energy container

  • channelMode – Channel selection mode

  • channel – Number of channel

  • numFreqBands – Number of bars

  • timeWindow – Window to calculate the spectrum (in seconds)

  • historySize – History size

  • usePeakValues – Returns peak value of the band instead of average values

  • numPeaks – Number of peaks to be calculated

void initializeSConfig_Custom(FChannelTArray &outputValues, FChannelTArray &outputAverageValues, FChannelTArray &outputPeaksValues, FChannelTArray &outputPeaksEnergyValues, int channelMode, int channel, const TArray<FVector2D> &bandLimits, float timeWindow, int historySize, bool usePeakValues, int numPeaks)

Initializes the custom limits spectrum configuration

Parameters:
  • outputValues[out] Output container

  • outputAverageValues[out] Output average container

  • outputPeaksValues[out] Output peak container

  • outputPeaksEnergyValues[out] Output peak energy container

  • channelMode – Channel selection mode

  • channel – Number of channel

  • bandLimits – TArray of frequency bounds for each bar

  • timeWindow – Window to calculate the spectrum (in seconds)

  • historySize – History size

  • usePeakValues – Returns peak value of the band instead of average values

  • numPeaks – Number of peaks to be calculated

void initializeBTConfig(BChannelTArray &beatOnSet, FChannelTArray &frequencyValues, FChannelTArray &averageFrequencyValues, FChannelTArray &varianceFrequencyValues, IChannelTArray &bpmCurrentValues, IChannelTArray &bpmTotalValues, int channelMode, int channel, float timeWindow, int historySize, float threshold, bool calculateBPM, int BPMHistorySize)

Initializes the defaut beat tracking configuration

Parameters:
  • beatOnSet[out] Output beat states container

  • frequencyValues[out] Output beat frequency container

  • averageFrequencyValues[out] Output beat average frequency container

  • varianceFrequencyValues[out] Output beat variance frequency container

  • bpmCurrentValues[out] Output bpm current container

  • bpmTotalValues[out] Output bpm total container

  • channelMode – Channel selection mode

  • channel – Number of channel

  • timeWindow – Window to calculate the spectrum (in seconds)

  • historySize – Spectrum History size

  • threshold – Beat detection threshold

  • calculateBPM – Enable BPM calculator

  • BPMHistorySize – BPM History size

void initializeBTConfig_Custom(BChannelTArray &beatOnSet, FChannelTArray &frequencyValues, FChannelTArray &averageFrequencyValues, FChannelTArray &varianceFrequencyValues, IChannelTArray &bpmCurrentValues, IChannelTArray &bpmTotalValues, int channelMode, int channel, const TArray<FVector2D> &bandLimits, float timeWindow, int historySize, float threshold, bool calculateBPM, int BPMHistorySize)

Initializes the custom limits beat tracking configuration

Parameters:
  • beatOnSet[out] Output beat states container

  • frequencyValues[out] Output beat frequency container

  • averageFrequencyValues[out] Output beat average frequency container

  • varianceFrequencyValues[out] Output beat variance frequency container

  • bpmCurrentValues[out] Output bpm current container

  • bpmTotalValues[out] Output bpm total container

  • channelMode – Channel selection mode

  • channel – Number of channel

  • bandLimits – TArray of frequency bounds for each bar

  • timeWindow – Window to calculate the spectrum (in seconds)

  • historySize – Spectrum History size

  • threshold – Beat detection threshold

  • calculateBPM – Enable BPM calculator

  • BPMHistorySize – BPM History size

void initializePTConfig(FChannelTArray &outputPitchTrackingValues, int channelMode, int channel, float timeWindow, float threshold)

Initializes the pitch tracking configuration

Parameters:
  • outputPitchTrackingValues[out] Output pitch tracking container

  • channelMode – Channel selection mode

  • channel – Number of channel

  • timeWindow – Window to calculate the spectrum (in seconds)

  • threshold – Yin threshold

void getAmplitude(FChannelTArray &amplitude)

Returns amplitude for a sample for a window of time (seconds) centered on current playback position and group it into bars

Parameters:

amplitude[out] Amplitude result by channel

void getSpectrum(FChannelTArray &frequencySpectrum)

Returns frequency spectrum data centered on current playback position using the configuration spectrum parameters

Parameters:

frequencySpectrum[out] Spectrum data array by channel

void getSpectrum_Average(FChannelTArray &averageSpectrum)

Returns average data for history spectrum using the configuration spectrum parameters

Parameters:

averageSpectrum[out] Average spectrum by channel

void getSpectrumPeaks(FChannelTArray &frequencyPeaks, FChannelTArray &frequencyPeaksEnergy)

Returns frequency spectrum peak data centered on current playback position using the configuration spectrum parameters

Parameters:
  • frequencyPeaks[out] Frequency peaks array by channel

  • frequencyPeaksEnergy[out] Frequency peaks energy array by channel

void getBeatTracking(BChannelTArray &beatResult, FChannelTArray &spectrumValues, IChannelTArray &averageBPM, IChannelTArray &totalBPM, const TArray<float> &overrideThreshold)

Returns the beat tracking analysis result for current playback position

Parameters:
  • beatResult[out] Beat result for custom bands by channel

  • spectrumValues[out] Current frequency spectrum values by channel

  • averageBPM[out] Return BPM partial result by channel

  • totalBPM[out] Return BPM total result by channel

  • overrideThreshold – Overrides Beat detection configuration threshold for each band

void getBeatTracking_Average(FChannelTArray &averageSpectrum)

Returns average data for history frequency spectrum using the configuration beat tracking parameters

Parameters:

averageSpectrum[out] Average frequency spectrum data array

void getBeatTracking_AverageAndVariance(FChannelTArray &averageBeatTracking, FChannelTArray &varianceSpectrum)

Returns variance data for history frequency spectrum using the configuration beat tracking parameters

Parameters:
  • varianceSpectrum[out] Variance frequency spectrum data array

  • averageBeatTracking[out] Average frequency spectrum data array

void extractBasicBeatTracking(TArray<bool> &IsBass, TArray<bool> &IsLowM, TArray<bool> &IsHighM, const BChannelTArray &beatResult)

Extract basic beat tracking analysis results (Bass/LowM/HighM)

Parameters:
  • IsBass[out] Beat results on Bass band by channel

  • IsLowM[out] Beat results on Low Mid band by channel

  • IsHighM[out] Beat results on High Mid band by channel

  • beatResult – Beat results by channel

void getTotalAmplitude(FChannelTArray &amplitude)

Returns amplitude for a sample for all the sound

Parameters:

amplitude[out] Amplitude result by channel

void resetBPMCounters()

Reset BPM counters

void getPitchTracking(FChannelTArray &frequencyF0)

Returns pitch tracking result (fundamental frequency) by channel

Parameters:

frequencyF0[out] Fundamental frequency data by channel

void getAmplitudeSection(FChannelTArray &samplesByTimeBand, int channelMode, int channel, float startTime, float endTime, int timeBandSize)

Returns the amplitude analysis result of a section of the audio file

Parameters:
  • samplesByTimeBand[out] Amplitude results

  • channelMode – Channel selection mode

  • channel – Number of channel

  • startTime – Start time of the audio section

  • endTime – End time of the audio section

  • timeBandSize – Number of samples accumulated per result