OfficialIncubo/BeatDrop-Music-Visualizer

BeatDrop only reacts to the treble at bass variable, but not the accurate bass, mid, treb (compared to projectM) - Beat Detection Issue

Closed this issue · 5 comments

In plugin.cpp at line 8792, there is a possible tweak for bass, mid and treb variable at line 8811, for example:

        // note: only look at bottom half of spectrum!  (hence divide by 6 instead of 3)
        int start = MY_FFT_SAMPLES*i/6;
	int end   = MY_FFT_SAMPLES*(i+1)/6;

...and changed to

        // note: only look at bottom half of spectrum!  (hence divide by 6 instead of 3)
        int start = MY_FFT_SAMPLES*i/64;
	int end   = MY_FFT_SAMPLES*(i+1)/64;

or

        // note: only look at bottom half of spectrum!  (hence divide by 6 instead of 3)
        int start = MY_FFT_SAMPLES*i/64;
	int end   = MY_FFT_SAMPLES*(i+1)/32;

Anyways, the treb cannot react better than before, so this should be a beta tweak.

Here is a clip how I tweaked BeatDrop's beat detection.

BeatDrop.s.a.little.bit.tweaked.beat.detection.mp4

...and the beat detection is now fixed!

Here is the code that I implemented:

.
.
.

// sum spectrum up into 3 bands
	for (i=0; i<3; i++)
	{
		//note: only look at bottom half of spectrum!  (hence divide by 6 instead of 3)
        int start = MY_FFT_SAMPLES*i/171;
        int end = MY_FFT_SAMPLES*(i+1)/171;
		int j;

        if (i == 1)
        {
            start = MY_FFT_SAMPLES * i / 36;
            end = MY_FFT_SAMPLES * (i + 1) / 36;
        }

        if (i == 2)
        {
            start = MY_FFT_SAMPLES*i/6;
            end = MY_FFT_SAMPLES*(i + 1)/6;
        }

		mysound.imm[i] = 0;
.
.
.

I splitted the i to the correct bass, mid, and treb and the results is: PERFECT!

Here is the comparison of my beat detection final tweak and the projectM one:

BeatDrop.s.Final.Beat.Detection.Tweak.vs.projectM.mp4

I made the beat detection more stable and accurate. Check this commit.

Oops, accidental reverted the beat detection official tweak.
Please look at this commit again.

I have upgraded my beat detection implementation to respect all the frequencies:
Bass: 20hz - 250hz
Mid: 250hz - 4000hz
Treb: 4000hz - 20000hz

In overall, it supports the frequencies from 20hz to 20000hz!

Code:
in plugin.cpp, at void CPlugin::DoCustomSoundAnalysis.

for (i=0; i<3; i++)
	{
		//This upgraded beat detection algorithm respects all the frequency range:
		//Bass: 20hz - 250hz
		//Mid: 250hz - 4000hz
		//Treb: 4000hz - 20000hz

        int start = MY_FFT_SAMPLES*i/194;
        int end = MY_FFT_SAMPLES*(i+1)/194; //bass
		int j;

        if (i == 1)
        {
            start = MY_FFT_SAMPLES * i / 68;
            end = MY_FFT_SAMPLES * (i + 1) / 32; //mid
        }

        if (i == 2)
        {
            start = MY_FFT_SAMPLES*i/8;
            end = MY_FFT_SAMPLES*(i + 1)/3; //treb
        }

Later, I'll update the source code if I have time or this milestone is done.