-2

i'm trying to make the simplest code (less than 3 or 4 lines) to generate a sawtooth wave in java

I already know the period,frequency, and amplitude of the graph (2). Any suggestions appreciated. I know that i need to use mod arithmetic with the period

i know i need to map the values of [0, period -1] to [-1, 1]. Idk how to use this with modulo arithmetic.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
skar
  • 1
  • 1
  • Please indicate your programmation language, and maybe a proposal for your algorithme that the community may comment and improve. Question with code get more and better answers. – Anthony Apr 29 '16 at 21:10
  • How will you use this algorithme, for which purpose, and how will it be called ? – Anthony Apr 29 '16 at 21:54
  • Maybe start from this http://stackoverflow.com/questions/740619/noise-in-background-when-generating-sine-wave-in-java?rq=1 – Anthony Apr 29 '16 at 21:55
  • Define exactly what you mean by "generate". Exactly what is the "output" you want? – Bohemian Apr 30 '16 at 03:02

1 Answers1

0

**

You can try this project it have sample for sine,squre and saw waveform.

** enter image description here

Hitesh Sahu
  • 41,955
  • 17
  • 205
  • 154