0

We're developing an app with neural nets that combines many small .mp3's (about 1 sec long) as a way to output the information in the audio format.

Like, if the network sees a number 3001, we wanna combine "three" & "thousand" & "and" & "one" and if it's 4002 --> "four" & "thousand" & "and" & "two", and to do that we try to run those files one after the other in a single thread so that the thread freezes until the "three" file played, then the "thousand" one and so on.

The .mp3's are too short to work with MediaPlayer, and SoundPool doesn't have OnComletedListener and the ability to tell the lenght of the .mp3 tracks. Do you know a good way to deal with the problem and find a solution to it?

Any help is really, really, really appreciated, thanks a lot in advance!

  • Well, maybe you could just use [Text To Speech](https://developer.android.com/reference/android/speech/tts/TextToSpeech) instead(?) – Markus Kauppinen Mar 21 '19 at 14:55
  • Thanks for your suggestion, Markus!The problem is that it's in Russian and supposed to work offline – Ivan Goncharov Mar 22 '19 at 08:40
  • For example my Android 7 phone does support TTS in Russian and [TTS should work offline](https://stackoverflow.com/questions/43486478/does-tts-api-work-without-network-connection-on-android). – Markus Kauppinen Mar 22 '19 at 08:45
  • That's interesting, we didn't know that, man, thanks) It's gonna be our last resort, because we're kinda trying to give the app its own voice and record our own files, have you maybe also heard of some nice way to play .mp3s one after the other or maybe you could give us a hint as to where we could look at? – Ivan Goncharov Mar 22 '19 at 14:36
  • There's an interesting idea [here](https://stackoverflow.com/questions/4436055/android-soundpool-get-notified-when-end-of-played) to use MediaPlayer just to get the duration of the sound and then play it via SoundPool. You would then need to use some timer mechanism to play the small sounds ina sequence. I haven't tried that or anything related myself. – Markus Kauppinen Mar 22 '19 at 15:00
  • Yeah, man, we were desperate enough to try that) The problem was that MediaPlayer is a heavy library that is very prone to errors, like overloading the sound buffer, or skipping listeners after starting which made it not possible for us to work with it) Big thanks for you sticking around and helping, we're still trying to figure things out and, if you stubmle also upon something useful, feel free to share) Thanks, man) – Ivan Goncharov Mar 25 '19 at 15:09

0 Answers0