Sine Wave Formula I have to write a program to generate some signals, one of them is sine wave. According to pdf from the teacher, I have this formula:
$$x(t) = A\sin\left(\frac{2\pi}{T}(t-t_1)\right)$$
I know what is $t$ and $t_1$. $T$ is basic period but what value I have to put into the formula to obtain a value? On every site, I see that frequency is in numerator but when I change $t$ to $n \over f$ I have frequency in denominator. Maybe someone can explain me this formula.
I can generate sine wave with this code:
for(i = 0; i < 10000; i++)
{
  // i is the sample index
  // Straight sine function means one cycle every 2*pi samples:
  // buffer[i] = sin(i); 
  // Multiply by 2*pi--now it's one cycle per sample:
  // buffer[i] = sin((2 * pi) * i); 
  // Multiply by 1,000 samples per second--now it's 1,000 cycles per second:
  // buffer[i] = sin(1000 * (2 * pi) * i);
  // Divide by 44,100 samples per second--now it's 1,000 cycles per 44,100
  // samples, which is just what we needed:
  buffer[i] = sin(1000 * (2 * pi) * i / 44100);
}

But I don't know why frequency in this code is in numerator.
When I asked about this on stackoverflow they sent me to mathematics forum.
 A: The general form of your function is
$$x(t) = A \sin \left( {\omega t + \alpha } \right)\tag{1}$$
Now suppose we are looking for its basic period. According to definition of basic period, the smallest positive real number $T$ satisfying $x(t) = x(t + T)$ is called the basic period of $x(t)$. If such a $T$ exist then one defines the frequency as $f = {1 \over T}$. Hence, consider the following
$$A\sin \left( {\omega t + \alpha } \right) = A\sin \left( {\omega t + \omega T + \alpha } \right)\tag{2}$$
you know by your trigonometry knowledge that this can happen only when
$$\omega t + \omega T + \alpha  = \omega t + \alpha  + 2n\pi ,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,n = 1,2,3,...\tag{3}$$
and hence
$$\omega T = 2n\pi ,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,n = 1,2,3,...\tag{4}$$
consequently the smallest $T$ will be
$$T = {{2\pi } \over \omega }\tag{5}$$
and the frequency is
$$f = {\omega  \over {2\pi }}\tag{6}$$
you can use $(5)$ or $(6)$ to write $(1)$ in another form
$$\left\{ \matrix{
  x(t) = A \sin \left( {2\pi f\,t + \alpha } \right) \hfill \cr 
  x(t) = A \sin \left( {{{2\pi } \over T}t + \alpha } \right) \hfill \cr}  \right.\tag{7}$$
As $(7)$ shows, frequency is in the numerator and the period is in denominator! :)
