again, more tuning

This commit is contained in:
Harrison Deng 2017-07-13 23:35:47 -05:00
parent 4646032e60
commit dbaaf3edb4
2 changed files with 9 additions and 6 deletions

View File

@ -67,7 +67,7 @@ public class AudioAnalyzer {
bassThresholdMultiplier = 2.6f; bassThresholdMultiplier = 2.6f;
umThresholdMultiplier = 2f; umThresholdMultiplier = 2f;
bassBinBegin = 7; bassBinBegin = 1;
bassBinEnd = 20; bassBinEnd = 20;
UMBinBegin = 300; UMBinBegin = 300;
@ -110,8 +110,13 @@ public class AudioAnalyzer {
//bass detection //bass detection
fluxVal = 0; fluxVal = 0;
for (int i = bassBinBegin; i < bassBinEnd && work; i++) { for (int i = bassBinBegin; i < bassBinEnd && work; i++) {
fluxVal += ((spectrum[i] - lastSpectrum[i])) < 0 if (spectrum[i] >= 0) {
? 0 : (spectrum[i] - lastSpectrum[i]); fluxVal += ((spectrum[i] - lastSpectrum[i])) < 0
? 0 : (spectrum[i] - lastSpectrum[i]);
} else {
fluxVal += ((spectrum[i] - lastSpectrum[i])) < 0
? 0 : (spectrum[i] - lastSpectrum[i]);
}
} }
bassSpectralFlux.add(fluxVal); bassSpectralFlux.add(fluxVal);

View File

@ -55,7 +55,7 @@ public class RhythmMapAlgorithm implements Runnable {
int warningTime = (int) ((3/speedMod)*windowPerSecond); int warningTime = (int) ((3/speedMod)*windowPerSecond);
if ((index+warningTime <= bassPeaks.size) && bassPeaks.get(index + warningTime) >= avgBass) { if ((index+warningTime <= bassPeaks.size) && bassPeaks.get(index + warningTime) >= avgBass) {
//TODO basic void circle spawning //TODO basic void circle spawning
float endRadius = overlappedPeaks.get(index + warningTime)*Polyjet.GAME_AREA_HEIGHT; float endRadius = overlappedPeaks.get(index + warningTime)*Polyjet.GAME_AREA_HEIGHT/4;
map.addToMap(Entities.VOID_CIRCLE, map.addToMap(Entities.VOID_CIRCLE,
endRadius, endRadius,
@ -77,8 +77,6 @@ public class RhythmMapAlgorithm implements Runnable {
Polyjet.GAME_AREA_HEIGHT-0.25f, Polyjet.GAME_AREA_HEIGHT-0.25f,
180*rand.nextFloat()+90, 180*rand.nextFloat()+90,
speedMod*(1f/avgBPS)); speedMod*(1f/avgBPS));
} }
} }