#include <VisualAudioLab.h>

A collection of routines dealing with processing, analyzing and interpretation of audio data.
| VisualAudioLab::VisualAudioLab | ( | ) | [private] |
The constructor. VisualAudioLab is a singleton class. The constructor is private. New instance of class can only be created internally.
| VisualAudioLab::~VisualAudioLab | ( | ) | [private] |
The destructor. VisualAudioLab is a singleton class. The destructor is private. Instance of class can only be destructed internally.
| VizKit::VisualAudioLab::VisualAudioLab | ( | const VisualAudioLab & | other | ) | [private] |
Copy constructor.
| other | Another VisualAudioLab. |
| void VisualAudioLab::addToBeatGapHistogram | ( | uint16 | gapInMilliseconds | ) | [private] |
Adds a value to beatGapHistogram.
| gapInMilliseconds | The gap to previous beat detection in milliseconds. |
| void VisualAudioLab::addToBeatRecords | ( | void | ) | [private] |
Adds a value to beatsRecordedInBeatAnalyseTimeFrame.
| void VizKit::VisualAudioLab::addToWaveformShape | ( | sint8 | minWaveformPoint, | |
| sint8 | maxWaveformPoint | |||
| ) | [private] |
Adds the minimum and maximum waveform data value to the waveform shape.
| minWaveformPoint | The minimum waveform data value. | |
| maxWaveformPoint | The maximum waveform data value. |
| void VisualAudioLab::calcBeatConfidence | ( | void | ) | [private] |
Calculates the confidence of the beat estimation.
| void VisualAudioLab::checkForBeatImpulse | ( | void | ) |
Checks for the beat impulse and sends a notification in case a beat impulse is detected.
| void VisualAudioLab::dispose | ( | void | ) | [static] |
Disposes the VisualAudiolab.
| const uint32 *const VisualAudioLab::getBeatHistogram | ( | void | ) |
Returns a pointer to the histogram of the gaps between detected beat events.
| uint8 VisualAudioLab::getBeatMeter | ( | void | ) |
Answers the question whether the current timestamp suggests a beat impulse.
| uint32 VisualAudioLab::getBestBeatMSInterval | ( | void | ) | [private] |
Returns the best guess for the beat interval in milliseconds. The best guess for the beat interval in milliseconds.
| sint16 VisualAudioLab::getCurrMusicDataHistory | ( | void | ) |
Returns the current music data history.
| uint32 VisualAudioLab::getCurrTimestampIDOfRenderData | ( | void | ) |
Returns the last processed timestampID of the kVisualPluginRenderMessage.
| uint8 VisualAudioLab::getDCIntensity | ( | void | ) |
Returns the DC intensity. The DC intensity is the intensity of the direct current.
| VisualAudioLab * VisualAudioLab::getInstance | ( | void | ) | [static] |
Returns the VisualAudioLab. The VisualAudiolab is initialized if required. The VisualAudioLab is a singleton.
| uint16 VisualAudioLab::getMaxNumberOfMusicDataHistories | ( | void | ) |
Returns the maximum number of histories in waveform data.
| uint16 VisualAudioLab::getMaxNumberOfWaveformShapeHistory | ( | void | ) |
Returns the maximum history number.
Returns the waveform data value of a specific index position.
| index | The index of the requested waveform data. |
| uint8 VisualAudioLab::getMonoWaveformDataAtIndexWithHistoryNum | ( | const uint16 | index, | |
| const uint16 | historyNum | |||
| ) |
Returns the mono waveform data of a specific history at a specific index.
| index | The index of the requested waveform data. | |
| historyNum | The history of the requested waveform data. |
| uint32 VizKit::VisualAudioLab::getNumberOfAudioSpectrumDataEntries | ( | void | ) |
Returns the number of audio spectrum data entries.
| uint16 VisualAudioLab::getNumberOfDataChannels | ( | void | ) |
Returns the number of data channels.
| uint32 VisualAudioLab::getNumberOfSpectrumEntries | ( | void | ) |
Returns the number of spectrum data entries.
| uint32 VisualAudioLab::getNumberOfWaveformEntries | ( | void | ) |
Returns the number of waveform data entries.
| sint16 VisualAudioLab::getPrevMusicDataHistory | ( | void | ) |
Returns the previous music data history. The previous music data history is the one that was current before the one that is now current.
| uint32 VisualAudioLab::getRemainingTimeOfCurrentTrack | ( | void | ) |
Returns the remaining time of the currently playing audio track measured in milliseconds.
| uint8 VisualAudioLab::getRMSIntensity | ( | void | ) |
Returns the RMS (root-mean-square) intensity. The RMS intensity is the computed root-mean-square value.
| const uint8 ***const VisualAudioLab::getSpectrumDataArray | ( | void | ) |
Returns a pointer to the spectrum data array.
| uint32 VisualAudioLab::getTotalTimeOfCurrentTrack | ( | void | ) |
Returns the total time of the currently playing audio track measured in milliseconds.
| const sint16 **const VisualAudioLab::getWaveformDataMonoArray | ( | void | ) |
Returns a pointer to the mono waveform data array. The mono waveform data consists of the averaged values of the waveform data of all available channels.
Returns the single waveform data of a specific channel at a specific index position.
| channel | The channel. | |
| index | The index of the waveform data. |
| uint8 VisualAudioLab::getWaveformDataOfChannelAtIndexWithHistoryNum | ( | const uint16 | channel, | |
| const uint16 | index, | |||
| const uint16 | historyNum | |||
| ) |
Returns the waveform data of a specific channel of a specific history at a specific index.
| channel | The cannel of the requested waveform data. | |
| index | The index of the requested waveform data. | |
| historyNum | The history of the requested waveform data. |
| const sint8* const VizKit::VisualAudioLab::getWaveformShapeArray | ( | void | ) |
Returns a pointer to the waveform shape array.
| void VisualAudioLab::HannWindow | ( | const int | N, | |
| double | TimeSamples[] | |||
| ) |
Processes the sample data with a Hann window.
| N | The number of samples. | |
| TimeSamples | The sample data. |
| void VisualAudioLab::incrementMusicDataHistory | ( | void | ) | [private] |
Increments the current history number of music data. Music data is stored for a number of histories.
| void VisualAudioLab::init | ( | void | ) | [private] |
Allocates and initializes the buffers of the VisualAudioLab.
| elapsedMSSinceStartOfTrack | The number of milliseconds elapsed since start of audio track. |
| VisualAudioLab& VizKit::VisualAudioLab::operator= | ( | const VisualAudioLab & | other | ) | [private] |
Assignment operator.
| void VisualAudioLab::processAudioData | ( | uint8 | numWaveformChannels, | |
| uint16 | numWaveformEntries, | |||
| const uint8 *const | currWaveformData, | |||
| uint8 | numSpectrumChannels, | |||
| uint16 | numSpectrumEntries, | |||
| const uint8 *const | currSpectrumData | |||
| ) |
Processes the audio data chunks. With each RenderMessage iTunes delivers waveform data and spectrum data. The spectrum data is a fft (Fast Fourier Transform) of the waveform data.
| numWaveformChannels | The number of waveform data channels. | |
| numWaveformEntries | The number of waveform data entries per channel. | |
| currWaveformData | A pointer to the waveform data. | |
| numSpectrumChannels | The number of spectrum data channels. | |
| numSpectrumEntries | The number of spectrum data entries per channel. | |
| currSpectrumData | A pointer to the spectrum data. |
| void VisualAudioLab::processSpectrumData | ( | const uint8 | numSpectrumChannels, | |
| const uint16 | numSpectrumEntries, | |||
| const uint8 *const | currSpectrumData | |||
| ) | [private] |
Processes the spectrum data.
| numSpectrumChannels | The number of spectrum data channels (e.g. two for stereo sound).. | |
| numSpectrumEntries | The number of data points per channel. | |
| currSpectrumData | A pointer to the current spectrum data. |
| void VisualAudioLab::processWaveformData | ( | uint8 | numWaveformChannels, | |
| uint16 | numWaveformEntries, | |||
| const uint8 *const | currWaveformData | |||
| ) | [private] |
Processes the waveform data.
| numWaveformChannels | The number of waveform data channels (e.g. two for stereo sound). | |
| numWaveformEntries | The number of data points per channel. | |
| currWaveformData | A pointer to the current waveform data. |
| bool VisualAudioLab::remainingTimeOfCurrentTrackIsKnown | ( | void | ) |
Answers the question whether the remaining time of the current track is known. Streamed audio has no info about remaining time of current track.
| void VisualAudioLab::resetBeatGapHistogram | ( | void | ) | [private] |
Resets the beatGapHistogram.
| void VisualAudioLab::resetData | ( | void | ) |
Resets the stored values of the VisualAudioLab. The VisualAudioLab stores analyzed values of an audio track. Typically the values are resetted when a new track starts playing.
| void VisualAudioLab::setCurrTimestampIDOfRenderData | ( | const uint32 | timestampID | ) |
Sets the last processed timestampID of the kVisualPluginRenderMessage.
| timestampID | The last processed timestampID of the kVisualPluginRenderMessage. |
| void VisualAudioLab::setMaxNumberOfAudioDataChannels | ( | uint16 | aNumberOfMaxAudioDataChannels | ) | [static] |
Sets the maximum number of audio data channels (2 channels means stereo).
| aNumberOfMaxAudioDataChannels | The maximum number of audio data channels. |
| void VisualAudioLab::setNumberOfAudioSpectrumDataEntries | ( | uint32 | aNumberOfAudioSpectrumDataEntries | ) | [static] |
Sets the number of audio spectrum data entries.
| aNumberOfAudioSpectrumDataEntries | The number of audio spectrum data entries. |
| void VisualAudioLab::setNumberOfAudioWaveformDataEntries | ( | uint32 | aNumberOfAudioWaveformDataEntries | ) | [static] |
Sets the number of audio waveform data entries.
| aNumberOfAudioWaveformDataEntries | The number of audio waveform data entries. |
| void VisualAudioLab::setStartTimeOfCurrentTrack | ( | const uint32 | startTimeInMS | ) |
Stores the start time of the current track.
| startTimeInMS | The start time of the currently playing audio track measured in milliseconds. |
| void VisualAudioLab::setStopTimeOfCurrentTrack | ( | const uint32 | stopTimeInMS | ) |
Stores the stop time of the current track.
| stopTimeInMS | The stop time of the currently playing audio track measured in milliseconds. |
| void VisualAudioLab::setTotalTimeOfCurrentTrack | ( | const uint32 | totalTimeInMS | ) |
Stores the total time of the current track.
| totalTimeInMS | The total time of the currently playing audio track measured in milliseconds. |
| void VisualAudioLab::storeBeatImpulse | ( | bool | beatImpulse | ) | [private] |
Stores the beat impulse.
| beatImpulse | True if the current waveform data indicates a beat impulse, false if not. |
double* VizKit::VisualAudioLab::amplitudeEnvelope [private] |
The amplitude envelope array.
float VizKit::VisualAudioLab::avgSpectrumDCLevel [private] |
The average spectrum DC level.
uint32* VizKit::VisualAudioLab::avgWaveformValSum [private] |
The average value of the sum of the waveform data values.
The counter for the calculation o the average value of the sum of the waveform data values.
const uint16 VisualAudioLab::beatAnalyseTimeFrame = 10000 [static, private] |
The time frame in which beats are recorded and analysed. Measured in milliseconds.
uint32* VizKit::VisualAudioLab::beatGapHistogram [private] |
A histogram of the gaps between detected beat events.
Array in which the detected beats are stored with their elapsed milliseconds timestamp since start of track. Ringbuffer.
const uint16 VisualAudioLab::beatThreshold = 300 [static, private] |
The threshold after which we are free to detect a new beat. Measured in milliseconds.
The delta between beats.
const uint8 VisualAudioLab::beatTimeTolerance = 25 [static, private] |
The smallest time a beat is considered to be the same. Measured in milliseconds.
The current history number.
The current index of array beatsRecordedInBeatAnalyseTimeFrame.
uint16 VizKit::VisualAudioLab::currRMSValue [private] |
The current index of array rmsBuffer.
The last processed timestampID of the kVisualPluginRenderMessage.
The accumulated play time of the current audio track measured in milliseconds.
bool VizKit::VisualAudioLab::isBeatImpulse [private] |
1 if the current waveform data indicates a beat impulse, 0 if not.
const uint16 VisualAudioLab::maximumBeatInterval = 2000 [static, private] |
The maximum beat interval. Measured in milliseconds.
uint16 VisualAudioLab::maxNumberOfAudioDataChannels = 0 [static, private] |
The maximum number of audio data channels (2 channels means stereo).
const uint16 VisualAudioLab::maxNumberOfBeatHistogramBins = 100 [static, private] |
const uint16 VisualAudioLab::maxNumberOfBeatsRecordedInAnalyseTimeframe = 200 [static, private] |
const uint16 VisualAudioLab::maxNumberOfMusicDataHistory = 40 [static, private] |
const uint16 VisualAudioLab::maxNumberOfWaveformShapeHistory = 1400 [static, private] |
uint8* VizKit::VisualAudioLab::maxSpectrumLevel [private] |
The maximum spectrum level. 0-128.
sint8* VizKit::VisualAudioLab::maxWaveformVal [private] |
The maximum waveform data value. 0-255. -128 ...127.
The maximum mono waveform data value.
sint32* VizKit::VisualAudioLab::mean [private] |
The mean values.
uint8* VizKit::VisualAudioLab::minSpectrumLevel [private] |
The minimum spectrum level. 0-128.
sint8* VizKit::VisualAudioLab::minWaveformVal [private] |
The minimum waveform data value. 0-255. -128 ...127.
The minimum mono waveform data value.
uint32 VisualAudioLab::numberOfAudioSpectrumDataEntries = 0 [static, private] |
The number of audio spectrum data entries.
uint32 VisualAudioLab::numberOfAudioWaveformDataEntries = 0 [static, private] |
The number of audio waveform data entries.
const uint16 VisualAudioLab::numberOfMillisecondsOfRMSBuffer = 3000 [static, private] |
The number of milliseconds rms values are collected.
The number of music data history.
const uint16 VisualAudioLab::numberOfRMSBufferEntries = 2000 [static, private] |
The number of records in rmsBuffer. Must be greater than: Audio sample rate (44100) / kVisualNumWaveformEntries * (numberOfMillisecondsOfRMSBuffer / 1000).
uint32* VizKit::VisualAudioLab::peakWaveformValSum [private] |
The peak values of the sum of the waveform data values.
uint32* VizKit::VisualAudioLab::prevWaveformValSum [private] |
The previous sum of the waveform data values.
double** VizKit::VisualAudioLab::rms [private] |
The rms values.
RMSValue VizKit::VisualAudioLab::rmsBuffer[2000] [private] |
Array containg rms mono values for the last numberOfMillisecondsOfRMSBuffer milliseconds. Ringbuffer. RMSValues with ((currentMSSinceStartOfTrack - timeInMillisecondsSinceStartOfTrack) > numberOfMillisecondsOfRMSBuffer) are discarded.
double* VizKit::VisualAudioLab::rmsMono [private] |
The mono rms values.
double VizKit::VisualAudioLab::rmsMonoAvg [private] |
The average rms value.
double VizKit::VisualAudioLab::rmsMonoMax [private] |
The maximum mono rms value. Timeframe numberOfMillisecondsOfRMSBuffer.
uint8*** VizKit::VisualAudioLab::spectrumData [private] |
The spectrum data array. The spectrum data array is 3-dimensional with data values, channels and history.
uint8 VizKit::VisualAudioLab::spectrumDCLevel [private] |
The spectrum DC level. 0-256 (?). Direct Current of FFT (mono).
float VizKit::VisualAudioLab::spectrumDCLevelSum [private] |
The sum of the spectrum DC level. sum of data (for calc of avg).
The start time of the currently playing audio track measured in milliseconds. iTunes allows to set a custom start time for a track.
The stop time of the currently playing audio track measured in milliseconds. iTunes allows to set a custom stop time for a track.
double* VizKit::VisualAudioLab::tappingBuffer [private] |
A special buffer for beat detection.
const uint16 VisualAudioLab::tappingBufferLength = 4096 [static, private] |
VisualAudioLab * VisualAudioLab::theVisualAudioLab = NULL [static, private] |
VisualAudioLab is a singleton class. Pointer to private instance is handled internally.
The total time of the currently playing audio track measured in milliseconds.
sint8*** VizKit::VisualAudioLab::waveformData [private] |
The waveform data array. The waveform data array is 3-dimensional with data values, channels and history.
sint16** VizKit::VisualAudioLab::waveformDataMono [private] |
The mono waveform data array. The mono waveform data array is 2-dimensional with data values, and history.
uint32* VizKit::VisualAudioLab::waveformValSum [private] |
The sum of the absolute waveform data values that are higher or lower than 128.