0

I have created a project where users voice get replicated http://androidsourcecode.blogspot.in/2013/07/android-audio-demo-audiotrack.html and I want to perform animation according to voice level, I got to know about voice level through this tutorial http://www.doepiccoding.com/blog/?p=195#comment-45 now I want to integrate both of this code so that at certain voice level animation should get played at the same time animation should played ...

I am stuck here since long time... I am calling a animation method at the time of writing track and that animation perform all the time which I don't want.

Please help me in this

Abhi
  • 433
  • 2
  • 7
  • 17

1 Answers1

0

So Finally I got the solution:

    animpo.speak(i_Ravan);  
    while (isRecording) {
        double lastLevel =1;
        num = record.read(lin, 0, 2160);
        double sumLevel = 0;
        for (int i=0;i<num;i++){
            sumLevel += lin[i];
        }
        lastLevel = Math.abs((sumLevel/num));
        String ll = String.valueOf(lastLevel);


        track.write(lin, 0, num);

        Log.d("LastLevel",ll);
        if(lastLevel > 5){
            ClassA.speak(image); //Method which perform animation
        }

    }
Mario Stoilov
  • 3,411
  • 5
  • 31
  • 51
Abhi
  • 433
  • 2
  • 7
  • 17