NanoLux (Device) 3.0
Codebase for the open-source AudioLux device.
Loading...
Searching...
No Matches
ext_analysis.cpp File Reference
#include <FastLED.h>
#include <Arduino.h>
#include "patterns.h"
#include "nanolux_types.h"
#include "nanolux_util.h"
#include <cmath>

Functions

double * density_formant ()
 Calculates the frequency bands with the highest density.
 
double * band_split_bounce (int len)
 Outputs the average volume of 5 buckets given a sample length.
 
void temp_to_array (double *temp, double *arr, int len)
 Used for moving a temporary pointer into another pointer.
 
void update_formants ()
 Moves data from the formant calculation function to the global array.
 
void update_five_band_split (int len)
 Moves data from the 5-band-split calculation function to the global array.
 
VowelSounds vowel_detection ()
 Detects vowels based off of formants.
 

Variables

double volume
 Global variable used to access the current volume.
 
double peak
 Global variable used to store preak audio frequency.
 
double vReal [SAMPLES]
 
int F0arr [20]
 Used for smoothing (old) formant processing.
 
int F1arr [20]
 Used for smoothing (old) formant processing.
 
int F2arr [20]
 Used for smoothing (old) formant processing.
 
int formant_pose
 Used for smoothing (old) formant processing.
 
double formants [3]
 Global formant array, used for accessing.
 
double fbs [5]
 

Detailed Description

This file's functions perform advanced audio processing.

Many of the functions defined here use values calculated from core_analysis.h to perform more complex audio analysis.

Function Documentation

◆ band_split_bounce()

double * band_split_bounce ( int len)

Outputs the average volume of 5 buckets given a sample length.

Parameters
lenThe number of samples the buckets should stretch across.

This function totals up the volume inside all 5 buckets, averages them, then maps them to the allowed volume range.

◆ density_formant()

double * density_formant ( )

Calculates the frequency bands with the highest density.

Returns
An array of the highest density formants.

This is intended to be used for functions like vowel detection, and is used in a couple patterns. For any nontrivial applications, do not use this.

◆ temp_to_array()

void temp_to_array ( double * temp,
double * arr,
int len )

Used for moving a temporary pointer into another pointer.

Parameters
tempThe temporary pointer to copy from.
arrThe global pointer to copy to.
lenThe number of elements to copy.

Automatically deletes temp after copy is finished.

Intended to be used to copy temporary audio analysis pointer data into global arrays.

Variable Documentation

◆ fbs

double fbs[5]
extern

Global FIVE BAND SPLIT which stores changing bands based on raw frequencies

◆ peak

double peak
extern

Global variable used to store preak audio frequency.

Global variable used to store preak audio frequency.

◆ volume

double volume
extern

Global variable used to access the current volume.

Global variable used to access the current volume.

◆ vReal

double vReal[SAMPLES]
extern

Array to store both sampled and FFT'ed audio. Processing is done in place.