Skip to content

axlecho/TarsosDSP

 
 

Repository files navigation

TarsosDSP on Android

The project is port from JorenSix/TarsosDSP for android

sample

SnapShot

snapshot

Usage

With Gradle:

  • Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:
allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}
  • Step 2. Add the dependency
implementation 'com.github.axlecho:TarsosDSP:{last version}'
  • Step 3. Start activity with file path
    // request audio permissions
    AudioDispatcher dispatcher = AudioDispatcherFactory.fromDefaultMicrophone(22050,1024,0);
    
    PitchDetectionHandler pdh = new PitchDetectionHandler() {
            @Override
            public void handlePitch(PitchDetectionResult result,AudioEvent e) {
                    final float pitchInHz = result.getPitch();
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            TextView text = (TextView) findViewById(R.id.textView1);
                            text.setText("" + pitchInHz);
                        }
                    });                        
            }
    };
    AudioProcessor p = new PitchProcessor(PitchEstimationAlgorithm.FFT_YIN, 22050, 1024, pdh);
    dispatcher.addAudioProcessor(p);
    new Thread(dispatcher,"Audio Dispatcher").start();

About

A Real-Time Audio Processing Framework in Java

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%