phase and amplitude of sine wave

rouncer 103 Sep 22, 2008 at 23:47

Can someone help me with this problem?

say ive got a sine wave written into a buffer of samples.

i know the frequency, all i need to do is calculate the amplitude of it and the phase from the start of the buffer.

thanks if someone cares…

2 Replies

Please log in or register to post a reply.

Reedbeta 167 Sep 22, 2008 at 23:55

Try scanning the buffer for the first maximum and the first minimum. That should give you the crest and trough of one cycle of the wave. Then you can find the amplitude as half the difference between those two, and you can calculate the phase by how far into the buffer the first maximum is, compared to the frequency.

rouncer 103 Sep 23, 2008 at 00:22

oh shit… i shouldve thought more…