SuperpoweredSDK  v2.0.2
Superpowered Audio SDK
Superpowered::LiveAnalyzer Class Reference

Performs bpm and key detection continuously. More...

#include "SuperpoweredAnalyzer.h"

Public Member Functions

 LiveAnalyzer (unsigned int samplerate)
 Constructor. More...
 
 ~LiveAnalyzer ()
 
void process (float *input, unsigned int numberOfFrames)
 Processes some audio. More...
 

Public Attributes

float bpm
 Current beats per minute. More...
 
int keyIndex
 The dominant key (chord) of the music. 0..11 are major keys from A to G#, 12..23 are minor keys from A to G#. -1: unknown. Check the static constants in this header for musical, Camelot and Open Key notations. More...
 
unsigned int samplerate
 Sample rate in Hz. More...
 
bool silence
 If true, bpm and key detection is paused, because the analyzer detects a longer silence period (more than 1 seconds of digital silence or 8 seconds below -48 decibels). If false, bpm and key detection is under progress. More...
 

Private Member Functions

 LiveAnalyzer (const LiveAnalyzer &)
 
LiveAnalyzeroperator= (const LiveAnalyzer &)
 

Private Attributes

liveAnalyzerInternals * internals
 

Detailed Description

Performs bpm and key detection continuously.

The update frequency is 2 seconds.

Warning
High memory usage! This class allocates 320 * samplerate bytes. Example: 48000 Hz * 320 = 15 MB

Constructor & Destructor Documentation

◆ LiveAnalyzer() [1/2]

Superpowered::LiveAnalyzer::LiveAnalyzer ( unsigned int  samplerate)

Constructor.

Parameters
samplerateThe initial sample rate in Hz.

◆ ~LiveAnalyzer()

Superpowered::LiveAnalyzer::~LiveAnalyzer ( )

◆ LiveAnalyzer() [2/2]

Superpowered::LiveAnalyzer::LiveAnalyzer ( const LiveAnalyzer )
private

Member Function Documentation

◆ operator=()

LiveAnalyzer& Superpowered::LiveAnalyzer::operator= ( const LiveAnalyzer )
private

◆ process()

void Superpowered::LiveAnalyzer::process ( float *  input,
unsigned int  numberOfFrames 
)

Processes some audio.

This method can be used in a real-time audio thread.

Parameters
inputPointer to floating point numbers. 32-bit interleaved stereo input.
numberOfFramesNumber of frames to process.

Member Data Documentation

◆ bpm

float Superpowered::LiveAnalyzer::bpm

Current beats per minute.

If the current result is too far from the reality you can do three things:

  1. Set bpm to zero. This forces the analyzer to "forget" the last bpm and may find the correct value within 10 seconds.
  2. Set bpm to an estimated value. This forces the analyzer to "forget" the last bpm and use your estimate instead. It may find the correct value within 4 seconds.
  3. Set bpm to a negative value. This will "hard reset" the analyzer and so it will start fresh.

◆ internals

liveAnalyzerInternals* Superpowered::LiveAnalyzer::internals
private

◆ keyIndex

int Superpowered::LiveAnalyzer::keyIndex

The dominant key (chord) of the music. 0..11 are major keys from A to G#, 12..23 are minor keys from A to G#. -1: unknown. Check the static constants in this header for musical, Camelot and Open Key notations.

◆ samplerate

unsigned int Superpowered::LiveAnalyzer::samplerate

Sample rate in Hz.

◆ silence

bool Superpowered::LiveAnalyzer::silence

If true, bpm and key detection is paused, because the analyzer detects a longer silence period (more than 1 seconds of digital silence or 8 seconds below -48 decibels). If false, bpm and key detection is under progress.


The documentation for this class was generated from the following file: