You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
430B

  1. // Utility to make a rawwave sine table (assumes big-endian machine).
  2. #include <math.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #define LENGTH 1024
  6. #define PI 3.14159265358979323846
  7. void main()
  8. {
  9. int i,j;
  10. double temp;
  11. short data[LENGTH + 2];
  12. FILE *fd;
  13. fd = fopen("sinewave.raw","wb");
  14. for (i=0; i<LENGTH; i++)
  15. data[i] = 32767 * sin(i * 2 * PI / (double) LENGTH);
  16. fwrite(&data,2,LENGTH,fd);
  17. fclose(fd);
  18. }