• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Android Getting Sound Levels

 
Chris Papadopoulos
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there

I'm a newbie in programming and I wanna build a sound recording application.
I have this code which is recording sound and puts a timestamp :

I need to change it and make it messure the sound levels.I'll use the getMaxAmplitude method,but this method returns only the last result,before it was called.I think I should use a loop,but the start method is capturing and encoding continuously.
How can I get the current amplitude,for example in a period of 1 second,on my recording?

Thanks
 
Chris Papadopoulos
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've edited my code into this :



But my result is 0 everytime.Any ideas?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API for the getMaxAmplitude() method tells you:
http://developer.android.com/reference/android/media/MediaRecorder.html#getMaxAmplitude() wrote:Returns the maximum absolute amplitude that was sampled since the last call to this method. Call this only after the setAudioSource().

Returns
the maximum absolute amplitude measured since the last call, or 0 when called for the first time
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic