willblaschko / AlexaAndroid

A library and sample app to abstract access to the Amazon Alexa service for Android applications.
GNU General Public License v2.0
280 stars 133 forks source link

Why prerecorded audio is slower then sending audio in Chunks and Text sending is Slower then both #165

Open ghost opened 5 years ago

ghost commented 5 years ago

Hi willblaschko,

We are working on AVS in android application. We are using your library as a reference

we have successfully sent audio to Alexa but response time is slower. so below are the questions we require some explaining.

  1. Why prerecorded audio response is slower?
  2. Why streaming audio response is faster as compared to prerecorded audio?
  3. Why sending text to audio is slower then the above 2 questions?
  4. How can we make prerecorded audio response faster?
ihavenoface5 commented 5 years ago

I know this question is for willblaschko but here are my insights on your questions.

  1. Prerecorded audio isn't being chunked. Chunking reduces the latency because Amazon can begin processing the audio when the first chunk is received.
  2. Why streaming audio response is faster as compared to prerecorded audio? Amazon is able to process audio as it's coming in. (Think of this as Alexa is listening as you are speaking vs Alexa waiting for you to finish speaking, then processing the audio then responding).
  3. Text sent must be converted to audio first using a text to speech library. The result is then sent (possibly not chunked).
  4. You would need to create a method that chunks the audio and streams it to Amazon.