Added tarsos library for onset detection of audio; tried to implement ComplexOnsetDetector but ffmpeg is needed.
This commit is contained in:
parent
b43910328e
commit
8f5ac74823
|
@ -20,9 +20,10 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:appcompat-v7:24.1.1'
|
||||
compile 'com.android.support:support-v4:24.1.1'
|
||||
compile 'com.android.support:design:24.1.1'
|
||||
compile files('libs/TarsosDSP-Android-latest.jar')
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -25,6 +25,11 @@ import android.view.View;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import be.tarsos.dsp.AudioDispatcher;
|
||||
import be.tarsos.dsp.io.android.AudioDispatcherFactory;
|
||||
import be.tarsos.dsp.onsets.ComplexOnsetDetector;
|
||||
import be.tarsos.dsp.onsets.OnsetHandler;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
@ -300,7 +305,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
};
|
||||
timer.schedule(timerTask, 350, 555);
|
||||
timer.schedule(timerTask, 300, 555);
|
||||
mediaPlayer = MediaPlayer.create(this, R.raw.ievan_polkka);
|
||||
mediaPlayer.setLooping(true);
|
||||
mediaPlayer.start();
|
||||
|
@ -317,13 +322,28 @@ public class MainActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
};
|
||||
timer.schedule(timerTask, 200, 425);
|
||||
timer.schedule(timerTask, 180, 425);
|
||||
mediaPlayer = MediaPlayer.create(this, R.raw.nyan);
|
||||
mediaPlayer.setLooping(true);
|
||||
mediaPlayer.start();
|
||||
//testOnsets();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void testOnsets() {
|
||||
// needs ffmpeg???
|
||||
AudioDispatcher dispatcher = AudioDispatcherFactory.fromPipe("/res/raw/nyan.mp3", 44100,5000,2500);
|
||||
ComplexOnsetDetector cod = new ComplexOnsetDetector(521, 0.3, 256.0/44100.0*4.0, -70);
|
||||
dispatcher.addAudioProcessor(cod);
|
||||
cod.setHandler(new OnsetHandler() {
|
||||
@Override
|
||||
public void handleOnset(double v, double v1) {
|
||||
System.out.println(v);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region ACTIVITIES
|
||||
|
|
Loading…
Reference in New Issue