Inventory Engine  v4.0
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
MoreMountains.Tools.MMAudioAnalyzer Class Reference

This component lets you pick an audio source (either global : the whole scene's audio, a unique source, or the microphone), and will cut it into chunks that you can then use to emit beat events, that other objects can consume and act upon. More...

Inherits MonoBehaviour.

Public Types

enum  Modes { Modes.Global, Modes.AudioSource, Modes.Microphone }
 

Public Member Functions

virtual void FindPeaks ()
 
virtual void PastePeaks ()
 
virtual void ClearPeaks ()
 
virtual void Initialization ()
 

Public Attributes

Modes Mode = Modes.Global
 
AudioSource TargetAudioSource
 
int MicrophoneID = 0
 
float SampleInterval = 0.02f
 
int SpectrumSamples = 1024
 
FFTWindow Window = FFTWindow.Rectangular
 
int NumberOfBands = 8
 
float BufferSpeed = 2f
 
Beat[] Beats
 
float[] RawSpectrum
 
float[] BandLevels
 
float[] BufferedBandLevels
 
float[] BandPeaks
 
float[] LastPeaksAt
 
float[] NormalizedBandLevels
 
float[] NormalizedBufferedBandLevels
 
float Amplitude
 
float NormalizedAmplitude
 
float BufferedAmplitude
 
float NormalizedBufferedAmplitude
 
bool Active = false
 
bool PeaksPasted = false
 

Protected Member Functions

virtual void Awake ()
 
virtual void Update ()
 
virtual IEnumerator Analyze ()
 
virtual void HandleBuffer ()
 
virtual void ComputeBandLevels ()
 
virtual void ComputeAmplitudes ()
 
virtual void HandleBeats ()
 
virtual void OnBeat (Beat beat, float rawValue)
 
virtual IEnumerator RemapBeat (Beat beat)
 
virtual void OnValidate ()
 

Protected Attributes

string _microphone
 
float _microphoneStartedAt = 0f
 
WaitForSeconds _sampleIntervalWaitForSeconds
 
int _cachedNumberOfBands
 

Static Protected Attributes

const int _microphoneDuration = 5
 
const float _microphoneDelay = 0.030f
 
const float _microphoneFrequency = 24000f
 

Detailed Description

This component lets you pick an audio source (either global : the whole scene's audio, a unique source, or the microphone), and will cut it into chunks that you can then use to emit beat events, that other objects can consume and act upon.

The sample interval is the frequency at which sound will be analyzed, the amount of spectrum samples will determine the accuracy of the sampling, the window defines the method used to reduce leakage, and the number of bands will determine in how many bands you want to cut the sound. The more bands, the more levers you'll have to play with afterwards. In general, for all of these settings, higher values mean better quality and lower performance. The buffer speed determines how fast buffered band levels readjust.

Member Enumeration Documentation

◆ Modes

Enumerator
Global 
AudioSource 
Microphone 

Member Function Documentation

◆ Analyze()

virtual IEnumerator MoreMountains.Tools.MMAudioAnalyzer.Analyze ( )
protectedvirtual

◆ Awake()

virtual void MoreMountains.Tools.MMAudioAnalyzer.Awake ( )
protectedvirtual

◆ ClearPeaks()

virtual void MoreMountains.Tools.MMAudioAnalyzer.ClearPeaks ( )
virtual

◆ ComputeAmplitudes()

virtual void MoreMountains.Tools.MMAudioAnalyzer.ComputeAmplitudes ( )
protectedvirtual

◆ ComputeBandLevels()

virtual void MoreMountains.Tools.MMAudioAnalyzer.ComputeBandLevels ( )
protectedvirtual

◆ FindPeaks()

virtual void MoreMountains.Tools.MMAudioAnalyzer.FindPeaks ( )
virtual

◆ HandleBeats()

virtual void MoreMountains.Tools.MMAudioAnalyzer.HandleBeats ( )
protectedvirtual

◆ HandleBuffer()

virtual void MoreMountains.Tools.MMAudioAnalyzer.HandleBuffer ( )
protectedvirtual

◆ Initialization()

virtual void MoreMountains.Tools.MMAudioAnalyzer.Initialization ( )
virtual

◆ OnBeat()

virtual void MoreMountains.Tools.MMAudioAnalyzer.OnBeat ( Beat  beat,
float  rawValue 
)
protectedvirtual

◆ OnValidate()

virtual void MoreMountains.Tools.MMAudioAnalyzer.OnValidate ( )
protectedvirtual

◆ PastePeaks()

virtual void MoreMountains.Tools.MMAudioAnalyzer.PastePeaks ( )
virtual

◆ RemapBeat()

virtual IEnumerator MoreMountains.Tools.MMAudioAnalyzer.RemapBeat ( Beat  beat)
protectedvirtual

◆ Update()

virtual void MoreMountains.Tools.MMAudioAnalyzer.Update ( )
protectedvirtual

Member Data Documentation

◆ _cachedNumberOfBands

int MoreMountains.Tools.MMAudioAnalyzer._cachedNumberOfBands
protected

◆ _microphone

string MoreMountains.Tools.MMAudioAnalyzer._microphone
protected

◆ _microphoneDelay

const float MoreMountains.Tools.MMAudioAnalyzer._microphoneDelay = 0.030f
staticprotected

◆ _microphoneDuration

const int MoreMountains.Tools.MMAudioAnalyzer._microphoneDuration = 5
staticprotected

◆ _microphoneFrequency

const float MoreMountains.Tools.MMAudioAnalyzer._microphoneFrequency = 24000f
staticprotected

◆ _microphoneStartedAt

float MoreMountains.Tools.MMAudioAnalyzer._microphoneStartedAt = 0f
protected

◆ _sampleIntervalWaitForSeconds

WaitForSeconds MoreMountains.Tools.MMAudioAnalyzer._sampleIntervalWaitForSeconds
protected

◆ Active

bool MoreMountains.Tools.MMAudioAnalyzer.Active = false

◆ Amplitude

float MoreMountains.Tools.MMAudioAnalyzer.Amplitude

◆ BandLevels

float [] MoreMountains.Tools.MMAudioAnalyzer.BandLevels

◆ BandPeaks

float [] MoreMountains.Tools.MMAudioAnalyzer.BandPeaks

◆ Beats

Beat [] MoreMountains.Tools.MMAudioAnalyzer.Beats

◆ BufferedAmplitude

float MoreMountains.Tools.MMAudioAnalyzer.BufferedAmplitude

◆ BufferedBandLevels

float [] MoreMountains.Tools.MMAudioAnalyzer.BufferedBandLevels

◆ BufferSpeed

float MoreMountains.Tools.MMAudioAnalyzer.BufferSpeed = 2f

◆ LastPeaksAt

float [] MoreMountains.Tools.MMAudioAnalyzer.LastPeaksAt

◆ MicrophoneID

int MoreMountains.Tools.MMAudioAnalyzer.MicrophoneID = 0

◆ Mode

Modes MoreMountains.Tools.MMAudioAnalyzer.Mode = Modes.Global

◆ NormalizedAmplitude

float MoreMountains.Tools.MMAudioAnalyzer.NormalizedAmplitude

◆ NormalizedBandLevels

float [] MoreMountains.Tools.MMAudioAnalyzer.NormalizedBandLevels

◆ NormalizedBufferedAmplitude

float MoreMountains.Tools.MMAudioAnalyzer.NormalizedBufferedAmplitude

◆ NormalizedBufferedBandLevels

float [] MoreMountains.Tools.MMAudioAnalyzer.NormalizedBufferedBandLevels

◆ NumberOfBands

int MoreMountains.Tools.MMAudioAnalyzer.NumberOfBands = 8

◆ PeaksPasted

bool MoreMountains.Tools.MMAudioAnalyzer.PeaksPasted = false

◆ RawSpectrum

float [] MoreMountains.Tools.MMAudioAnalyzer.RawSpectrum

◆ SampleInterval

float MoreMountains.Tools.MMAudioAnalyzer.SampleInterval = 0.02f

◆ SpectrumSamples

int MoreMountains.Tools.MMAudioAnalyzer.SpectrumSamples = 1024

◆ TargetAudioSource

AudioSource MoreMountains.Tools.MMAudioAnalyzer.TargetAudioSource

◆ Window

FFTWindow MoreMountains.Tools.MMAudioAnalyzer.Window = FFTWindow.Rectangular

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