您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

18 行
384B

  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";