Class: AudioAnalysis

Addon#AudioAnalysis(renderer, options)

new AudioAnalysis(renderer, options)

AudioAnalysis returns a BPM based on music analisis. Either mp3 or microphone
Audio Analysis Example on codepen:
codepen

see more at Joe Sullivan
AudioAnalysis returns a floating point between 1 and 0, in sync with a bpm
the BPM is calculated based on an input music stream (mp3 file)

  options.audio (String) is a source, like /path/to/mymusic.mp3
  options.microphone (Boolean) use microphone (true) or audiosource (false)
Parameters:
Name Type Description
renderer GlRenderer

current GlRenderer

options Object

object with several settings

Implements:
Source:
Example
var mixer1 = new Mixer( _renderer, { source1: mySource, source2: myOtherSource })
var analysis = new AudioAnalysis( renderer, { audio: 'mymusic.mp3' } );
analysis.add( mixer1.pod )

Members

audio

Audio element, HTMLMediaElement AUDIO reference

Source:

mod

bpm mod, multiplyer for bpm output, usuall 0.125, 0.25, 0.5, 2, 4 etc.

Source:

(static) audio_src

Source:

(static) beats :number

number of beats since start

Type:
  • number
Source:

(static) bpm :number

(calculated) bpm

Type:
  • number
Source:

(static) bpm :number

the bpm float is a reference to the current beat-edge,
it represents a float between 0 and 1, with ±1 being given back every beat

Type:
  • number
Source:

(static) bps

Source:

(static) count

Source:

(static) dataSet

Source:

(static) sec

Source:

(static) tempoData

tempodate gives you a peak into the inner workins of the sampler, including bpm and 'calibrating' status

Source:

Methods

add()

Source:

connectOutput()

connects the audio source to output, making it audible

Source:

disconnectOutput()

disconnects audio to output, this will mute the analalyser, but won't stop analysing

Source:

getAmbience()

Source:

getBlackOut()

Source:

getBpm()

helper function, get's the bpm and retursn is, useful for mixer.bind( func )

Source:

getHighLevels()

Source:

getLowLevels()

Source:

getMidLevels()

Source:

render()

Source:

sync()

Source:

(inner) countIntervalsBetweenNearbyPeaks()

Finds peaks in the audiodata and groups them together

Source:

(inner) forceAudio()

firstload for mobile, forces all control to the site on click
tries and forces another play-event after a click

Source:

(inner) getTempo()

returns 'tempodata', a list of found BPMs sorted on occurrence
object includes: bpm (ie. 128), confidence (0-1), calibrating (true/false),
treshold, tempocounts, foundpeaks and peaks

Source:

(inner) groupNeighborsByTempo()

map found intervals together and returns 'tempocounts', a list of found
tempos and their occurences

Source:

(inner) init()

Source:

(inner) initializeAutoBpm()

initialize autobpm, after Addon#AudioAnalysis.initializeAudio
start the Addon#AudioAnalysis~sampler

Source:

(inner) sampler()

gets the analyser.getByteTimeDomainData
calculates the tempodata every 'slowpoke' (now set at samples 10/s)
returns the most occuring bpm

Source:

(inner) update()

Source: