Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java sound - calculating amplitude  RSS feed

 
Redan Hassoun
Greenhorn
Posts: 29
Android AngularJS Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have written a java application that records an audio wave and does some processing on it.
My array of audio samples is in this format :
Sample rate = 14000 Hz
Sample size in bits = 16
Number of channels = 1
unsigned sample values
and it's in little endian order

The application purpose is to calculate three things :
1. Frequency
2. Amplitude
3. Phase

According to frequency, iv'e used the FFT algorithm on the sampled array and got an accurate result.
but ... according to amplitude ...
my samples array is 16-bit for each sample, so the value range is -32768 to 32767.
How can i convert this number into a meaningful unit of measure (like : meter) ?
And does any one knows how can i compute the phase ?

 
Tony Docherty
Bartender
Posts: 3268
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may be better off posting on a sound engineers/audio forum and then coming back here if you can't implement the formulas given to you.

Having said that a quick search found an interesting and informative reply to a similar question on SO http://stackoverflow.com/questions/15134740/16bit-little-endian-byte-array-to-integer-array-to-decibel-value. I hope this helps.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!