Tuesday, December 08, 2009

Learning to Talk Droid

The plan was simple, prerecord audio samples corresponding to ASCII character and play them in a loop.

It turns out that the Android's SoundPool class makes everything easy but also completely useless! Whilst the initial problem of refusing to play audio clips shorter then 5 ms was "solved" by lovering the number of expected corrections per second, it also introduces a small delays in execution of sounds in succession.

While the initial delay of first sample being played to actually hearing it, thus getting the info out of the phone could be tolerated, the tests showed that there is also a delay up to 50 ms between sound clips played, being in succession or simultaneously.

Useful for game programing where there is a large number of sounds to manage and play depending on events, but using this for continuous operation would amount to unpredictable lag which would render the atempted correction useless.

Luckily with the Android version 1.5 and even more improved so in 1.6 came the ability to directly access the phones PCM stream, providing the ability to generate sound on the fly.

So the next solution explores this possibility and so far it's promising:

No comments:

Post a Comment