0
$\begingroup$

I'm wondering how can i get the frequency and the amplitude from a 16 bits sample. I have actually an array of 16 bits signed int and I would like to get the frequency and the amplitude of each sample. I've heard from FTT and stuff but I'm kinda new to signal processing about audio. Any advice would be appreciated,

Thanks.

$\endgroup$

closed as unclear what you're asking by MBaz, Peter K. Dec 19 '17 at 12:16

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ It would be better if you gave more information about the audio signal you're working with; then people could give more specific advice for you. Note that an audio signal (ex. recorded sound) is just an array of numbers. Each individual number is what we call a sample. Also note that the type of number (in your case, 16 bit signed int) will not affect your measurement of amplitdue and frequency. $\endgroup$ – goldrik Dec 18 '17 at 21:46
2
$\begingroup$

I'm wondering how can i get the frequency and the amplitude from a 16 bits sample

That makes no sense. A single sample is just a number.

A number doesn't have a frequency.

The number itself is the amplitude.

$\endgroup$
0
$\begingroup$

It depends of what you want: Do you want to write your own code, or just to find the solution? In the first case, you have to learn a lot: https://en.wikipedia.org/wiki/Fourier_transform, or simply use Matlab or Octave functions. They have very good help. If you want just to do some basic analysis, you may try with Audacity free tool that does have spectral analysis and will be able to load your file with samples.

$\endgroup$
  • $\begingroup$ I want to write my own code that retrieves the frequency and magnitude at any time of the sound (with the SFML library in C++) $\endgroup$ – Ay0m3 Dec 18 '17 at 19:05
  • $\begingroup$ OK, you have fftw.org FFTW library that does FFT. Some theory of FFT can be find all around the net, for example here: dspguide.com/ch12/2.htm $\endgroup$ – VladP Dec 18 '17 at 19:13
  • $\begingroup$ Ye I was wondering if I could do that alone but I guess not then $\endgroup$ – Ay0m3 Dec 18 '17 at 19:37
  • $\begingroup$ You may try it to do it from scratches, but there is a lot of theory to cover. Basically, FFT is a sum of sin and cos of the array of samples, multiplied by some coefficients. Try it first with someone else's functions. Also, if you like my answer, click up-vote. $\endgroup$ – VladP Dec 18 '17 at 20:36
0
$\begingroup$

I don't know if this will be helpful answer but a single sample can be considered as the following signal $x[n]=a\delta[n]$ just for $n=0$, then under this interpretation of a single sample the associated discrete-time Fourier transform will be: $$X(e^{j\omega}) = \sum_{n=-\infty}^{\infty} x[n] e^{-j\omega n} = \sum_{n=0}^{0} a e^{-j\omega n} = a $$

Hence we have $X(e^{j\omega})= a$ whose frequency is all (with a magnitude of a) and phase is zero...

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.