Search code examples
signal-processingsignalspcmsignal-strength

how to determine signal strength of a pcm sample? in terms of power


I read that signal power = signal * signal. What is that? what is signal? how do we obtain it? I'm programming in C(if that's necessary to post)


Solution

  • Signal is the amplitude of whatever input source you have sampled. E.g. for audio you might have 16 bit signed samples, and +32767 might represent say +1.0 V analogue and -32768 would be -1.0 V analogue. (The relationship between digital sample value and whatever analogue quantity you are sampling is usually linear, which makes life simple.)

    To calculate the power of a signal you would measure the mean square value, e.g.

    double sum_sq = 0.0;
    for (int i = 0; i < N; ++i)
    {
        sum_sq += (double)sample[i] * (double)sample[i];
    }
    double power = sum_sq / (double)N;