# phase and amplitude of sine wave

2 replies to this topic

### #1rouncer

Senior Member

• Members
• 2725 posts

Posted 22 September 2008 - 11:47 PM

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...

### #2Reedbeta

DevMaster Staff

• 5310 posts
• LocationSanta Clara, CA

Posted 22 September 2008 - 11:55 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

### #3rouncer

Senior Member

• Members
• 2725 posts

Posted 23 September 2008 - 12:22 AM

oh shit... i shouldve thought more...

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users