update aspects for having a overall equalizer/compressor
This commit is contained in:
parent
cb048b7866
commit
9f032be96d
|
@ -3,7 +3,7 @@ all : colorchord
|
|||
RAWDRAW:=DrawFunctions.o XDriver.o
|
||||
SOUND:=sound.o sound_alsa.o sound_pulse.o sound_null.o
|
||||
|
||||
OUTS := OutputVoronoi.o DisplayArray.o OutputLinear.o DisplayPie.o DisplayNetwork.o DisplayUSB2812.o DisplayDMX.o OutputProminent.o RecorderPlugin.o
|
||||
OUTS := OutputVoronoi.o DisplayArray.o OutputLinear.o DisplayPie.o DisplayNetwork.o DisplayUSB2812.o DisplayDMX.o OutputProminent.o RecorderPlugin.o OutputCells.o
|
||||
|
||||
WINGCC:=i586-mingw32msvc-gcc
|
||||
WINGCCFLAGS:= -O2 -Wl,--relax -Wl,--gc-sections -ffunction-sections -fdata-sections -s -DICACHE_FLASH_ATTR= -I../embeddedcommon -I.
|
||||
|
@ -13,13 +13,13 @@ RAWDRAWLIBS:=-lX11 -lm -lpthread -lXinerama -lXext
|
|||
LDLIBS:=-lpthread -lasound -lm -lpulse-simple -lpulse
|
||||
|
||||
|
||||
CFLAGS:=-g -Os -flto -Wall -ffast-math -I../embeddedcommon -I. -DICACHE_FLASH_ATTR=
|
||||
CFLAGS:=-g -O0 -flto -Wall -ffast-math -I../embeddedcommon -I. -DICACHE_FLASH_ATTR=
|
||||
EXTRALIBS:=-lusb-1.0
|
||||
|
||||
colorchord : os_generic.o main.o dft.o decompose.o filter.o color.o sort.o notefinder.o util.o outdrivers.o $(RAWDRAW) $(SOUND) $(OUTS) parameters.o chash.o hook.o ../embeddedcommon/DFT32.o
|
||||
gcc -o $@ $^ $(CFLAGS) $(LDLIBS) $(EXTRALIBS) $(RAWDRAWLIBS)
|
||||
|
||||
colorchord.exe : os_generic.c main.c dft.c decompose.c filter.c color.c sort.c notefinder.c util.c outdrivers.c DrawFunctions.c parameters.c chash.c WinDriver.c sound.c sound_null.c sound_win.c OutputVoronoi.c DisplayArray.c OutputLinear.c DisplayPie.c DisplayNetwork.c hook.c RecorderPlugin.c ../embeddedcommon/DFT32.c
|
||||
colorchord.exe : os_generic.c main.c dft.c decompose.c filter.c color.c sort.c notefinder.c util.c outdrivers.c DrawFunctions.c parameters.c chash.c WinDriver.c sound.c sound_null.c sound_win.c OutputVoronoi.c DisplayArray.c OutputLinear.c DisplayPie.c DisplayNetwork.c hook.c RecorderPlugin.c ../embeddedcommon/DFT32.c OutputCells.c
|
||||
$(WINGCC) $(WINGCCFLAGS) -o $@ $^ $(WINLDFLAGS)
|
||||
|
||||
|
||||
|
|
|
@ -24,9 +24,13 @@ wininput = 0
|
|||
#sound_source = PULSE
|
||||
#-1 indicates left and right, 0 left, 1 right.
|
||||
|
||||
sample_channel = 1
|
||||
sample_channel = -1
|
||||
sourcename = default
|
||||
alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
|
||||
#alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
|
||||
#default
|
||||
# alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
|
||||
#alsa_output.pci-0000_00_1f.3.analog-stereo.monitor << New laptop
|
||||
#use pactl list | grep pci-
|
||||
|
||||
##################################
|
||||
# General ColorChord properties. #
|
||||
|
@ -55,7 +59,8 @@ octaves = 5
|
|||
# 2 = DFT Progressive Integer
|
||||
# 3 = DFT Progressive Integer Skippy
|
||||
# 4 = Integer, 32-Bit, Progressive, Skippy.
|
||||
do_progressive_dft = 4
|
||||
do_progressive_dft = 4fa
|
||||
|
||||
|
||||
filter_iter = 2
|
||||
filter_strength = .5
|
||||
|
@ -64,8 +69,8 @@ filter_strength = .5
|
|||
freqbins = 24
|
||||
|
||||
# For the final note information... How much to slack everything?
|
||||
note_attach_amp_iir = 0.2000
|
||||
note_attach_amp_iir2 = 0.150
|
||||
note_attach_amp_iir = 0.3500
|
||||
note_attach_amp_iir2 = 0.250
|
||||
note_attach_freq_iir = 0.3000
|
||||
|
||||
#How many bins a note can jump from frame to frame to be considered a slide.
|
||||
|
@ -75,6 +80,9 @@ note_jumpability = 1.8000
|
|||
note_minimum_new_distribution_value = 0.0200
|
||||
note_out_chop = 0.05000
|
||||
|
||||
#compress_coefficient = 4.0
|
||||
#compress_exponent = .5
|
||||
|
||||
|
||||
#=======================================================================
|
||||
#Outputs
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
outdrivers = DisplayPie,DisplayNetwork,OutputLinear
|
||||
leds = 48
|
||||
light_siding = 1.0 #Turn this to ~1.9 for more uniformity, ~1.0 for less.
|
||||
light_siding = 1.9 #Turn this to ~1.9 for more uniformity, ~1.0 for less.
|
||||
satamp = 1.600
|
||||
is_loop=1
|
||||
led_floor = .1 #Turn to .25 for more uniformity, .1 for less.
|
||||
|
|
|
@ -30,6 +30,9 @@ void WindowsTerm()
|
|||
|
||||
#endif
|
||||
|
||||
float DeltaFrameTime = 0;
|
||||
double Now = 0;
|
||||
|
||||
int lastfps;
|
||||
short screenx, screeny;
|
||||
int gargc;
|
||||
|
@ -183,7 +186,7 @@ const char * InitialFile[NRDEFFILES];
|
|||
double FileTimes[NRDEFFILES];
|
||||
int InitialFileCount = 1;
|
||||
|
||||
void SetEnvValues()
|
||||
void SetEnvValues( int force )
|
||||
{
|
||||
int i;
|
||||
int hits = 0;
|
||||
|
@ -197,7 +200,7 @@ void SetEnvValues()
|
|||
}
|
||||
}
|
||||
|
||||
if( !hits ) return;
|
||||
if( !hits && !force ) return;
|
||||
|
||||
//Otherwise, something changed.
|
||||
|
||||
|
@ -233,13 +236,19 @@ void ProcessArgs()
|
|||
}
|
||||
}
|
||||
|
||||
SetEnvValues();
|
||||
SetEnvValues( 1 );
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf( "Output Drivers:\n" );
|
||||
for( i = 0; i < MAX_OUT_DRIVERS; i++ )
|
||||
{
|
||||
if( ODList[i].Name ) printf( "\t%s\n", ODList[i].Name );
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
WSADATA wsaData;
|
||||
|
||||
|
@ -324,11 +333,19 @@ int main(int argc, char ** argv)
|
|||
nf = CreateNoteFinder( sd->spsRec );
|
||||
|
||||
|
||||
//Once everything was reinitialized, re-read the ini files.
|
||||
SetEnvValues( 1 );
|
||||
|
||||
Now = OGGetAbsoluteTime();
|
||||
double Last = Now;
|
||||
while(1)
|
||||
{
|
||||
char stt[1024];
|
||||
//Handle Rawdraw frame swappign
|
||||
|
||||
Now = OGGetAbsoluteTime();
|
||||
DeltaFrameTime = Now - Last;
|
||||
|
||||
if( !headless )
|
||||
{
|
||||
CNFGHandleInput();
|
||||
|
@ -369,12 +386,16 @@ int main(int argc, char ** argv)
|
|||
//Do a bunch of debugging.
|
||||
if( show_debug_basic )
|
||||
{
|
||||
//char sttdebug[1024];
|
||||
//char * sttend = sttdebug;
|
||||
|
||||
for( i = 0; i < nf->dists; i++ )
|
||||
{
|
||||
CNFGPenX = (nf->dist_means[i] + 0.5) / freqbins * screenx; //Move over 0.5 for visual purposes. The means is correct.
|
||||
CNFGPenY = 400-nf->dist_amps[i] * 150.0 / nf->dist_sigmas[i];
|
||||
//printf( "%f %f\n", dist_means[i], dist_amps[i] );
|
||||
sprintf( stt, "%f\n%f\n", nf->dist_means[i], nf->dist_amps[i] );
|
||||
// sttend += sprintf( sttend, "%f/%f ",nf->dist_means[i], nf->dist_amps[i] );
|
||||
CNFGDrawText( stt, 2 );
|
||||
}
|
||||
CNFGColor( 0xffffff );
|
||||
|
@ -399,6 +420,7 @@ int main(int argc, char ** argv)
|
|||
CNFGPenX = ((float)(i+.4) / note_peaks) * screenx;
|
||||
CNFGPenY = screeny - 30;
|
||||
sprintf( stt, "%d\n%0.0f", nf->enduring_note_id[i], nf->note_amplitudes2[i]*1000.0 );
|
||||
//sttend += sprintf( sttend, "%5d/%5.0f ", nf->enduring_note_id[i], nf->note_amplitudes2[i]*1000.0 );
|
||||
CNFGDrawText( stt, 2 );
|
||||
|
||||
}
|
||||
|
@ -415,6 +437,7 @@ int main(int argc, char ** argv)
|
|||
lasty = thisy;
|
||||
thisy = sound[thissoundhead] * 128 + 128; thissoundhead = (thissoundhead-1+SOUNDCBSIZE)%SOUNDCBSIZE;
|
||||
}
|
||||
//puts( sttdebug );
|
||||
}
|
||||
|
||||
//Extra debugging?
|
||||
|
@ -498,8 +521,8 @@ int main(int argc, char ** argv)
|
|||
OGUSleep( (int)( SecToWait * 1000000 ) );
|
||||
}
|
||||
|
||||
SetEnvValues();
|
||||
|
||||
SetEnvValues( 0 );
|
||||
Last = Now;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,6 +43,9 @@ struct NoteFinder * CreateNoteFinder( int spsRec )
|
|||
ret->current_note_id = 1;
|
||||
ret->amplify = 1;
|
||||
|
||||
ret->compress_coefficient = 1.0;
|
||||
ret->compress_exponenet = .5;
|
||||
|
||||
ret->ofreqs = 0; //force a re-init.
|
||||
|
||||
RegisterValue( "octaves", PAINT, &ret->octaves, sizeof( ret->octaves ) );
|
||||
|
@ -52,6 +55,8 @@ struct NoteFinder * CreateNoteFinder( int spsRec )
|
|||
RegisterValue( "filter_iter", PAINT, &ret->filter_iter, sizeof( ret->filter_iter ) );
|
||||
RegisterValue( "decompose_iterations", PAINT, &ret->decompose_iterations, sizeof( ret->decompose_iterations ) );
|
||||
RegisterValue( "amplify", PAFLOAT, &ret->amplify, sizeof( ret->amplify ) );
|
||||
RegisterValue( "compress_exponent", PAFLOAT, &ret->compress_exponenet, sizeof( ret->compress_exponenet ) );
|
||||
RegisterValue( "compress_coefficient", PAFLOAT, &ret->compress_coefficient, sizeof( ret->compress_coefficient ) );
|
||||
RegisterValue( "dft_speedup", PAFLOAT, &ret->dft_speedup, sizeof( ret->dft_speedup ) );
|
||||
RegisterValue( "dft_q", PAFLOAT, &ret->dft_q, sizeof( ret->dft_q ) );
|
||||
RegisterValue( "default_sigma", PAFLOAT, &ret->default_sigma, sizeof( ret->default_sigma ) );
|
||||
|
@ -239,6 +244,21 @@ void RunNoteFinder( struct NoteFinder * nf, const float * audio_stream, int head
|
|||
|
||||
memset( nf->dist_takens, 0, sizeof( unsigned char ) * maxdists );
|
||||
nf->dists = DecomposeHistogram( nf->folded_bins, freqbins, nf->dist_means, nf->dist_amps, nf->dist_sigmas, maxdists, nf->default_sigma, nf->decompose_iterations );
|
||||
|
||||
//Compress/normalize dist_amps
|
||||
float total_dist = 0;
|
||||
|
||||
for( i = 0; i < nf->dists; i++ )
|
||||
{
|
||||
total_dist += nf->dist_amps[i];
|
||||
}
|
||||
float muxer = nf->compress_coefficient/powf( total_dist * nf->compress_coefficient, nf->compress_exponenet );
|
||||
total_dist = muxer;
|
||||
for( i = 0; i < nf->dists; i++ )
|
||||
{
|
||||
nf->dist_amps[i]*=total_dist;
|
||||
}
|
||||
|
||||
{
|
||||
int dist_sorts[nf->dists];
|
||||
SortFloats( dist_sorts, nf->dist_amps, nf->dists );
|
||||
|
|
|
@ -19,6 +19,10 @@ struct NoteFinder
|
|||
int filter_iter;// = 1;
|
||||
int decompose_iterations;// = 1000;
|
||||
float amplify; // =1 (amplify input across the board)
|
||||
|
||||
float compress_coefficient; // = 1.0; How much to compress the sound by before putting it into the compressor.
|
||||
float compress_exponenet; // = .5; Exponent of the compressor lower = make more uniform.
|
||||
|
||||
int do_progressive_dft; //= 1
|
||||
|
||||
//at 300, there is still some minimal aliasing at higher frequencies. Increase this for less low-end distortion
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#ifndef _PARAMETERS_H
|
||||
#define _PARAMETERS_H
|
||||
|
||||
#define PARAM_BUFF 128
|
||||
#define PARAM_BUFF 160
|
||||
|
||||
enum ParamType
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue