开发者

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

开发者 https://www.devze.com 2023-02-16 17:35 出处:网络
I read that signal power = signal * signal. What is that? what is signal? how do we obtain it? I\'m progra开发者_如何学Gomming in C(if that\'s necessary to post)Signal is the amplitude of whatever inp

I read that signal power = signal * signal. What is that? what is signal? how do we obtain it? I'm progra开发者_如何学Gomming in C(if that's necessary to post)


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号