JorenSix / TarsosDSP

A Real-Time Audio Processing Framework in Java
http://0110.be/tag/TarsosDSP
GNU General Public License v3.0
1.97k stars 472 forks source link

Cannot play audio file fromPipe #179

Closed pupil72 closed 4 years ago

pupil72 commented 4 years ago

Hi Joren, I'm trying to play an audio file either from my phone's Music folder or from the raw resources of my Android app. However, I cannot make it play. I feel I'm not properly using the right path format, but I tried so many variants and it still doesn't play.

    String name1 = storageDirectory.getAbsolutePath() + "/hola.wav";
    String name2 = "android.resource://package_name/raw/hola.wav";
    String name3 = "/document/primary:Music/hola.wav";
    String name4 = "/sdcard/Music/hola.wav";

    dispatcher2 = AudioDispatcherFactory.fromPipe(nameX,44100,5000,2500);
    dispatcher2.addAudioProcessor(new AndroidAudioPlayer(dispatcher2.getFormat(), 5000, AudioManager.STREAM_MUSIC));
    new Thread(dispatcher2, "Sound Thread").start();
pupil72 commented 4 years ago

Just found out that this issue has already been asked: https://stackoverflow.com/questions/55134848/how-to-play-audio-file-with-androidaudioplayer-from-trasosdsp-android-jar