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.

преди 11 години
1234567891011121314151617
  1. #! /usr/bin/perl
  2. use Math::Trig ':pi';
  3. $len = 256;
  4. print "#define SINE_TABLE_LEN $len\n";
  5. print "static const int16_t sine_table[] = {\n";
  6. for ($i=0; $i <= $len; $i++) {
  7. $f = sin($i / $len * 2 * pi);
  8. $d = sprintf "%.0f", $f * 32767.0;
  9. #print $d;
  10. printf "%6d", $d + 0;
  11. print "," if ($i < $len);
  12. print "\n" if ($i % 10) == 9;
  13. }
  14. print "\n" unless ($len % 10) == 9;
  15. print "};\n";