Android blow detection -


i want make app appy birthday, in can detect blow whenever user blows in mic, using code not efficient detect noise , normal sound, using media record class . have tried approach detecting blow

public boolean isblowing()     {         boolean recorder=true;          int minsize = audiorecord.getminbuffersize(8000,audioformat.channel_configuration_mono, audioformat.encoding_pcm_16bit);         audiorecord ar = new audiorecord(mediarecorder.audiosource.mic, 8000,audioformat.channel_configuration_mono, audioformat.encoding_pcm_16bit,minsize);           short[] buffer = new short[minsize];          ar.startrecording();         while(recorder)         {              ar.read(buffer, 0, minsize);             (short s : buffer)              {                 if (math.abs(s) > 27000)   //detect volume (if blow in mic)                 {                     blow_value=math.abs(s);                     system.out.println("blow value="+blow_value);                     ar.stop();                     recorder=false;                      return true;                  }              }         }         return false;      } 

guys if have code detect blow not normal sound please provide, in advance.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -