Shop OBEX P1 Docs P2 Docs Learn Events
sine wave question — Parallax Forums

sine wave question

Hi,

I am doing some tests with optascope and javelin: for the tests·I'm using the understanding signals text.·I want to create a single and dual sine wave for the duration of one second. The text only explains these tests in basic. Can somebody give me a sample in java?????

Thanks,

John

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-12-18 09:14
    The javelin does not have a freqout statement, but you can try
    the attached program.
    If the while (true) takes more than 20 ticks to complete,
    the resulting frequency is lower than the calculated 160 Hz.
    In that case you can try

    ··· while (true) {
    ····· v = sinetable[noparse][[/noparse]i];
    ····· p.update(v,202-v);
    ····· i = (i+10)%360;····· //step
    ··· }

    to get the highest frequency. You can also increase the step but that will
    degrade the generated sinewave (which I think is already of poor quality).

    regards peter
  • edited 2005-12-18 16:16
    Peter,

    Thx... for the sampel.

    John
Sign In or Register to comment.