• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Android Getting Sound Levels

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've edited my code into this :



But my result is 0 everytime.Any ideas?
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic