No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

452 líneas
24KB

  1. /* Audio Library for Teensy 3.X
  2. * Copyright (c) 2014, Paul Stoffregen, paul@pjrc.com
  3. *
  4. * Development of this audio library was funded by PJRC.COM, LLC by sales of
  5. * Teensy and Audio Adaptor boards. Please support PJRC's efforts to develop
  6. * open source software by purchasing Teensy or other PJRC products.
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documentation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice, development funding notice, and this permission
  16. * notice shall be included in all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. */
  26. #include <stdint.h>
  27. const int16_t AudioWindowHanning256[] __attribute__ ((aligned (4))) = {
  28. 0, 5, 20, 45, 80, 124, 179, 243, 317, 401,
  29. 495, 598, 711, 833, 965, 1106, 1257, 1416, 1585, 1763,
  30. 1949, 2145, 2349, 2561, 2782, 3011, 3249, 3494, 3747, 4008,
  31. 4276, 4552, 4834, 5124, 5421, 5724, 6034, 6350, 6672, 7000,
  32. 7334, 7673, 8018, 8367, 8722, 9081, 9445, 9812, 10184, 10560,
  33. 10939, 11321, 11707, 12095, 12486, 12879, 13274, 13672, 14070, 14471,
  34. 14872, 15275, 15678, 16081, 16485, 16889, 17292, 17695, 18097, 18498,
  35. 18897, 19295, 19692, 20086, 20478, 20868, 21255, 21639, 22019, 22397,
  36. 22770, 23140, 23506, 23867, 24224, 24576, 24923, 25265, 25602, 25932,
  37. 26258, 26577, 26890, 27196, 27496, 27789, 28076, 28355, 28627, 28892,
  38. 29148, 29398, 29639, 29872, 30097, 30314, 30522, 30722, 30913, 31095,
  39. 31268, 31432, 31588, 31733, 31870, 31997, 32115, 32223, 32321, 32410,
  40. 32489, 32558, 32618, 32667, 32707, 32737, 32757, 32767, 32767, 32757,
  41. 32737, 32707, 32667, 32618, 32558, 32489, 32410, 32321, 32223, 32115,
  42. 31997, 31870, 31733, 31588, 31432, 31268, 31095, 30913, 30722, 30522,
  43. 30314, 30097, 29872, 29639, 29398, 29148, 28892, 28627, 28355, 28076,
  44. 27789, 27496, 27196, 26890, 26577, 26258, 25932, 25602, 25265, 24923,
  45. 24576, 24224, 23867, 23506, 23140, 22770, 22397, 22019, 21639, 21255,
  46. 20868, 20478, 20086, 19692, 19295, 18897, 18498, 18097, 17695, 17292,
  47. 16889, 16485, 16081, 15678, 15275, 14872, 14471, 14070, 13672, 13274,
  48. 12879, 12486, 12095, 11707, 11321, 10939, 10560, 10184, 9812, 9445,
  49. 9081, 8722, 8367, 8018, 7673, 7334, 7000, 6672, 6350, 6034,
  50. 5724, 5421, 5124, 4834, 4552, 4276, 4008, 3747, 3494, 3249,
  51. 3011, 2782, 2561, 2349, 2145, 1949, 1763, 1585, 1416, 1257,
  52. 1106, 965, 833, 711, 598, 495, 401, 317, 243, 179,
  53. 124, 80, 45, 20, 5, 0,
  54. };
  55. const int16_t AudioWindowBartlett256[] __attribute__ ((aligned (4))) = {
  56. 128, 384, 640, 896, 1152, 1408, 1664, 1920, 2176, 2432,
  57. 2688, 2944, 3200, 3456, 3712, 3968, 4224, 4480, 4736, 4992,
  58. 5248, 5504, 5760, 6016, 6272, 6528, 6784, 7040, 7296, 7552,
  59. 7808, 8064, 8320, 8576, 8832, 9088, 9344, 9600, 9856, 10112,
  60. 10368, 10624, 10880, 11136, 11392, 11648, 11904, 12160, 12416, 12672,
  61. 12928, 13184, 13440, 13696, 13952, 14208, 14464, 14720, 14976, 15232,
  62. 15488, 15744, 16000, 16256, 16512, 16768, 17024, 17280, 17536, 17792,
  63. 18048, 18304, 18560, 18816, 19072, 19328, 19584, 19840, 20096, 20352,
  64. 20608, 20864, 21120, 21376, 21632, 21888, 22144, 22400, 22656, 22912,
  65. 23168, 23424, 23680, 23936, 24192, 24448, 24704, 24960, 25216, 25472,
  66. 25728, 25984, 26240, 26496, 26752, 27008, 27264, 27520, 27776, 28032,
  67. 28288, 28544, 28800, 29056, 29312, 29568, 29824, 30080, 30336, 30592,
  68. 30848, 31104, 31360, 31616, 31872, 32128, 32384, 32640, 32640, 32384,
  69. 32128, 31872, 31616, 31360, 31104, 30848, 30592, 30336, 30080, 29824,
  70. 29568, 29312, 29056, 28800, 28544, 28288, 28032, 27776, 27520, 27264,
  71. 27008, 26752, 26496, 26240, 25984, 25728, 25472, 25216, 24960, 24704,
  72. 24448, 24192, 23936, 23680, 23424, 23168, 22912, 22656, 22400, 22144,
  73. 21888, 21632, 21376, 21120, 20864, 20608, 20352, 20096, 19840, 19584,
  74. 19328, 19072, 18816, 18560, 18304, 18048, 17792, 17536, 17280, 17024,
  75. 16768, 16512, 16256, 16000, 15744, 15488, 15232, 14976, 14720, 14464,
  76. 14208, 13952, 13696, 13440, 13184, 12928, 12672, 12416, 12160, 11904,
  77. 11648, 11392, 11136, 10880, 10624, 10368, 10112, 9856, 9600, 9344,
  78. 9088, 8832, 8576, 8320, 8064, 7808, 7552, 7296, 7040, 6784,
  79. 6528, 6272, 6016, 5760, 5504, 5248, 4992, 4736, 4480, 4224,
  80. 3968, 3712, 3456, 3200, 2944, 2688, 2432, 2176, 1920, 1664,
  81. 1408, 1152, 896, 640, 384, 128,
  82. };
  83. const int16_t AudioWindowBlackman256[] __attribute__ ((aligned (4))) = {
  84. 0, 2, 7, 16, 29, 45, 65, 89, 116, 148,
  85. 183, 222, 266, 314, 366, 422, 483, 549, 620, 695,
  86. 776, 862, 953, 1050, 1153, 1261, 1376, 1496, 1623, 1757,
  87. 1897, 2043, 2197, 2358, 2526, 2701, 2883, 3074, 3272, 3477,
  88. 3691, 3912, 4142, 4380, 4626, 4880, 5142, 5413, 5692, 5979,
  89. 6275, 6579, 6891, 7211, 7540, 7876, 8220, 8572, 8932, 9299,
  90. 9674, 10056, 10445, 10840, 11242, 11651, 12065, 12485, 12911, 13342,
  91. 13778, 14218, 14662, 15111, 15563, 16017, 16475, 16935, 17397, 17860,
  92. 18324, 18789, 19253, 19718, 20182, 20644, 21104, 21563, 22018, 22470,
  93. 22919, 23363, 23802, 24237, 24665, 25087, 25503, 25911, 26312, 26704,
  94. 27088, 27462, 27828, 28183, 28527, 28861, 29183, 29494, 29793, 30079,
  95. 30352, 30613, 30859, 31092, 31311, 31515, 31705, 31880, 32039, 32183,
  96. 32312, 32425, 32522, 32603, 32668, 32717, 32750, 32766, 32766, 32750,
  97. 32717, 32668, 32603, 32522, 32425, 32312, 32183, 32039, 31880, 31705,
  98. 31515, 31311, 31092, 30859, 30613, 30352, 30079, 29793, 29494, 29183,
  99. 28861, 28527, 28183, 27828, 27462, 27088, 26704, 26312, 25911, 25503,
  100. 25087, 24665, 24237, 23802, 23363, 22919, 22470, 22018, 21563, 21104,
  101. 20644, 20182, 19718, 19253, 18789, 18324, 17860, 17397, 16935, 16475,
  102. 16017, 15563, 15111, 14662, 14218, 13778, 13342, 12911, 12485, 12065,
  103. 11651, 11242, 10840, 10445, 10056, 9674, 9299, 8932, 8572, 8220,
  104. 7876, 7540, 7211, 6891, 6579, 6275, 5979, 5692, 5413, 5142,
  105. 4880, 4626, 4380, 4142, 3912, 3691, 3477, 3272, 3074, 2883,
  106. 2701, 2526, 2358, 2197, 2043, 1897, 1757, 1623, 1496, 1376,
  107. 1261, 1153, 1050, 953, 862, 776, 695, 620, 549, 483,
  108. 422, 366, 314, 266, 222, 183, 148, 116, 89, 65,
  109. 45, 29, 16, 7, 2, 0,
  110. };
  111. const int16_t AudioWindowFlattop256[] __attribute__ ((aligned (4))) = {
  112. 0, 0, -1, -3, -6, -9, -14, -20, -27, -35,
  113. -45, -56, -68, -83, -99, -117, -137, -160, -185, -213,
  114. -243, -276, -312, -351, -393, -438, -487, -538, -593, -651,
  115. -713, -777, -844, -914, -987, -1062, -1139, -1218, -1298, -1380,
  116. -1462, -1544, -1626, -1707, -1787, -1865, -1939, -2010, -2077, -2139,
  117. -2194, -2243, -2284, -2316, -2339, -2351, -2352, -2339, -2314, -2273,
  118. -2217, -2144, -2054, -1945, -1817, -1668, -1498, -1306, -1090, -851,
  119. -588, -300, 13, 352, 718, 1111, 1530, 1976, 2449, 2949,
  120. 3475, 4027, 4605, 5209, 5837, 6489, 7163, 7860, 8577, 9313,
  121. 10068, 10840, 11626, 12426, 13238, 14059, 14889, 15724, 16563, 17404,
  122. 18244, 19082, 19914, 20740, 21555, 22358, 23147, 23920, 24673, 25405,
  123. 26113, 26796, 27451, 28076, 28669, 29228, 29752, 30238, 30685, 31092,
  124. 31458, 31780, 32058, 32291, 32479, 32620, 32715, 32762, 32762, 32715,
  125. 32620, 32479, 32291, 32058, 31780, 31458, 31092, 30685, 30238, 29752,
  126. 29228, 28669, 28076, 27451, 26796, 26113, 25405, 24673, 23920, 23147,
  127. 22358, 21555, 20740, 19914, 19082, 18244, 17404, 16563, 15724, 14889,
  128. 14059, 13238, 12426, 11626, 10840, 10068, 9313, 8577, 7860, 7163,
  129. 6489, 5837, 5209, 4605, 4027, 3475, 2949, 2449, 1976, 1530,
  130. 1111, 718, 352, 13, -300, -588, -851, -1090, -1306, -1498,
  131. -1668, -1817, -1945, -2054, -2144, -2217, -2273, -2314, -2339, -2352,
  132. -2351, -2339, -2316, -2284, -2243, -2194, -2139, -2077, -2010, -1939,
  133. -1865, -1787, -1707, -1626, -1544, -1462, -1380, -1298, -1218, -1139,
  134. -1062, -987, -914, -844, -777, -713, -651, -593, -538, -487,
  135. -438, -393, -351, -312, -276, -243, -213, -185, -160, -137,
  136. -117, -99, -83, -68, -56, -45, -35, -27, -20, -14,
  137. -9, -6, -3, -1, 0, 0,
  138. };
  139. const int16_t AudioWindowBlackmanHarris256[] __attribute__ ((aligned (4))) = {
  140. 2, 2, 3, 5, 7, 9, 13, 17, 22, 27,
  141. 34, 42, 51, 61, 73, 86, 101, 118, 137, 158,
  142. 181, 207, 235, 267, 301, 339, 381, 427, 476, 530,
  143. 589, 652, 721, 795, 875, 961, 1053, 1151, 1257, 1369,
  144. 1489, 1617, 1752, 1896, 2049, 2210, 2380, 2560, 2749, 2948,
  145. 3156, 3375, 3605, 3845, 4096, 4357, 4630, 4914, 5209, 5516,
  146. 5833, 6162, 6503, 6855, 7218, 7592, 7978, 8374, 8781, 9199,
  147. 9628, 10066, 10514, 10972, 11439, 11915, 12400, 12892, 13392, 13899,
  148. 14413, 14932, 15457, 15987, 16521, 17058, 17599, 18141, 18685, 19229,
  149. 19774, 20318, 20860, 21400, 21936, 22468, 22996, 23518, 24033, 24541,
  150. 25041, 25532, 26012, 26482, 26941, 27387, 27821, 28240, 28645, 29034,
  151. 29408, 29765, 30104, 30426, 30728, 31012, 31276, 31520, 31743, 31945,
  152. 32126, 32284, 32421, 32535, 32627, 32696, 32742, 32765, 32765, 32742,
  153. 32696, 32627, 32535, 32421, 32284, 32126, 31945, 31743, 31520, 31276,
  154. 31012, 30728, 30426, 30104, 29765, 29408, 29034, 28645, 28240, 27821,
  155. 27387, 26941, 26482, 26012, 25532, 25041, 24541, 24033, 23518, 22996,
  156. 22468, 21936, 21400, 20860, 20318, 19774, 19229, 18685, 18141, 17599,
  157. 17058, 16521, 15987, 15457, 14932, 14413, 13899, 13392, 12892, 12400,
  158. 11915, 11439, 10972, 10514, 10066, 9628, 9199, 8781, 8374, 7978,
  159. 7592, 7218, 6855, 6503, 6162, 5833, 5516, 5209, 4914, 4630,
  160. 4357, 4096, 3845, 3605, 3375, 3156, 2948, 2749, 2560, 2380,
  161. 2210, 2049, 1896, 1752, 1617, 1489, 1369, 1257, 1151, 1053,
  162. 961, 875, 795, 721, 652, 589, 530, 476, 427, 381,
  163. 339, 301, 267, 235, 207, 181, 158, 137, 118, 101,
  164. 86, 73, 61, 51, 42, 34, 27, 22, 17, 13,
  165. 9, 7, 5, 3, 2, 2,
  166. };
  167. const int16_t AudioWindowNuttall256[] __attribute__ ((aligned (4))) = {
  168. 0, 0, 1, 2, 4, 6, 9, 13, 17, 22,
  169. 28, 35, 43, 52, 62, 74, 87, 102, 119, 138,
  170. 160, 183, 210, 239, 271, 306, 345, 388, 434, 485,
  171. 540, 600, 665, 735, 811, 893, 981, 1075, 1176, 1284,
  172. 1400, 1523, 1654, 1793, 1940, 2097, 2262, 2437, 2621, 2815,
  173. 3019, 3233, 3458, 3693, 3939, 4196, 4465, 4744, 5035, 5338,
  174. 5651, 5977, 6314, 6663, 7023, 7394, 7777, 8171, 8577, 8993,
  175. 9420, 9857, 10305, 10762, 11229, 11705, 12190, 12683, 13184, 13693,
  176. 14208, 14730, 15257, 15789, 16326, 16867, 17411, 17958, 18506, 19055,
  177. 19604, 20153, 20700, 21245, 21787, 22325, 22858, 23386, 23908, 24422,
  178. 24927, 25424, 25911, 26388, 26853, 27305, 27744, 28170, 28581, 28976,
  179. 29355, 29717, 30062, 30388, 30696, 30984, 31252, 31499, 31726, 31932,
  180. 32115, 32276, 32415, 32532, 32625, 32695, 32742, 32765, 32765, 32742,
  181. 32695, 32625, 32532, 32415, 32276, 32115, 31932, 31726, 31499, 31252,
  182. 30984, 30696, 30388, 30062, 29717, 29355, 28976, 28581, 28170, 27744,
  183. 27305, 26853, 26388, 25911, 25424, 24927, 24422, 23908, 23386, 22858,
  184. 22325, 21787, 21245, 20700, 20153, 19604, 19055, 18506, 17958, 17411,
  185. 16867, 16326, 15789, 15257, 14730, 14208, 13693, 13184, 12683, 12190,
  186. 11705, 11229, 10762, 10305, 9857, 9420, 8993, 8577, 8171, 7777,
  187. 7394, 7023, 6663, 6314, 5977, 5651, 5338, 5035, 4744, 4465,
  188. 4196, 3939, 3693, 3458, 3233, 3019, 2815, 2621, 2437, 2262,
  189. 2097, 1940, 1793, 1654, 1523, 1400, 1284, 1176, 1075, 981,
  190. 893, 811, 735, 665, 600, 540, 485, 434, 388, 345,
  191. 306, 271, 239, 210, 183, 160, 138, 119, 102, 87,
  192. 74, 62, 52, 43, 35, 28, 22, 17, 13, 9,
  193. 6, 4, 2, 1, 0, 0,
  194. };
  195. const int16_t AudioWindowBlackmanNuttall256[] __attribute__ ((aligned (4))) = {
  196. 12, 12, 13, 15, 18, 22, 26, 32, 38, 46,
  197. 54, 64, 76, 89, 103, 119, 137, 158, 180, 205,
  198. 232, 262, 295, 331, 371, 414, 461, 512, 567, 627,
  199. 691, 761, 836, 916, 1002, 1095, 1193, 1299, 1411, 1531,
  200. 1658, 1793, 1935, 2086, 2246, 2414, 2592, 2778, 2974, 3180,
  201. 3396, 3621, 3857, 4104, 4361, 4628, 4907, 5196, 5497, 5808,
  202. 6130, 6464, 6808, 7164, 7530, 7908, 8296, 8694, 9103, 9523,
  203. 9952, 10391, 10839, 11296, 11763, 12237, 12720, 13210, 13707, 14211,
  204. 14721, 15236, 15757, 16281, 16810, 17342, 17876, 18412, 18949, 19487,
  205. 20024, 20560, 21094, 21625, 22153, 22677, 23196, 23709, 24215, 24714,
  206. 25204, 25686, 26157, 26618, 27068, 27505, 27930, 28341, 28737, 29118,
  207. 29484, 29833, 30165, 30479, 30775, 31052, 31310, 31549, 31767, 31964,
  208. 32141, 32296, 32429, 32541, 32630, 32698, 32743, 32765, 32765, 32743,
  209. 32698, 32630, 32541, 32429, 32296, 32141, 31964, 31767, 31549, 31310,
  210. 31052, 30775, 30479, 30165, 29833, 29484, 29118, 28737, 28341, 27930,
  211. 27505, 27068, 26618, 26157, 25686, 25204, 24714, 24215, 23709, 23196,
  212. 22677, 22153, 21625, 21094, 20560, 20024, 19487, 18949, 18412, 17876,
  213. 17342, 16810, 16281, 15757, 15236, 14721, 14211, 13707, 13210, 12720,
  214. 12237, 11763, 11296, 10839, 10391, 9952, 9523, 9103, 8694, 8296,
  215. 7908, 7530, 7164, 6808, 6464, 6130, 5808, 5497, 5196, 4907,
  216. 4628, 4361, 4104, 3857, 3621, 3396, 3180, 2974, 2778, 2592,
  217. 2414, 2246, 2086, 1935, 1793, 1658, 1531, 1411, 1299, 1193,
  218. 1095, 1002, 916, 836, 761, 691, 627, 567, 512, 461,
  219. 414, 371, 331, 295, 262, 232, 205, 180, 158, 137,
  220. 119, 103, 89, 76, 64, 54, 46, 38, 32, 26,
  221. 22, 18, 15, 13, 12, 12,
  222. };
  223. const int16_t AudioWindowWelch256[] __attribute__ ((aligned (4))) = {
  224. 256, 764, 1268, 1768, 2264, 2756, 3244, 3728, 4208, 4684,
  225. 5156, 5624, 6088, 6548, 7004, 7456, 7904, 8348, 8788, 9224,
  226. 9656, 10084, 10508, 10928, 11344, 11756, 12164, 12568, 12968, 13364,
  227. 13756, 14144, 14528, 14908, 15284, 15656, 16024, 16388, 16748, 17104,
  228. 17456, 17804, 18148, 18488, 18824, 19156, 19484, 19808, 20128, 20444,
  229. 20756, 21064, 21368, 21668, 21964, 22256, 22544, 22828, 23108, 23384,
  230. 23656, 23924, 24188, 24448, 24704, 24956, 25204, 25448, 25688, 25924,
  231. 26156, 26384, 26608, 26828, 27044, 27256, 27464, 27668, 27868, 28064,
  232. 28256, 28444, 28628, 28808, 28984, 29156, 29324, 29488, 29648, 29804,
  233. 29956, 30104, 30248, 30388, 30524, 30656, 30784, 30908, 31028, 31144,
  234. 31256, 31364, 31468, 31568, 31664, 31756, 31844, 31928, 32008, 32084,
  235. 32156, 32224, 32288, 32348, 32404, 32456, 32504, 32548, 32588, 32624,
  236. 32656, 32684, 32708, 32728, 32744, 32756, 32764, 32767, 32767, 32764,
  237. 32756, 32744, 32728, 32708, 32684, 32656, 32624, 32588, 32548, 32504,
  238. 32456, 32404, 32348, 32288, 32224, 32156, 32084, 32008, 31928, 31844,
  239. 31756, 31664, 31568, 31468, 31364, 31256, 31144, 31028, 30908, 30784,
  240. 30656, 30524, 30388, 30248, 30104, 29956, 29804, 29648, 29488, 29324,
  241. 29156, 28984, 28808, 28628, 28444, 28256, 28064, 27868, 27668, 27464,
  242. 27256, 27044, 26828, 26608, 26384, 26156, 25924, 25688, 25448, 25204,
  243. 24956, 24704, 24448, 24188, 23924, 23656, 23384, 23108, 22828, 22544,
  244. 22256, 21964, 21668, 21368, 21064, 20756, 20444, 20128, 19808, 19484,
  245. 19156, 18824, 18488, 18148, 17804, 17456, 17104, 16748, 16388, 16024,
  246. 15656, 15284, 14908, 14528, 14144, 13756, 13364, 12968, 12568, 12164,
  247. 11756, 11344, 10928, 10508, 10084, 9656, 9224, 8788, 8348, 7904,
  248. 7456, 7004, 6548, 6088, 5624, 5156, 4684, 4208, 3728, 3244,
  249. 2756, 2264, 1768, 1268, 764, 256,
  250. };
  251. const int16_t AudioWindowHamming256[] __attribute__ ((aligned (4))) = {
  252. 2621, 2626, 2640, 2663, 2695, 2736, 2786, 2845, 2913, 2991,
  253. 3077, 3172, 3276, 3388, 3509, 3639, 3778, 3925, 4080, 4243,
  254. 4415, 4595, 4782, 4978, 5181, 5392, 5610, 5836, 6069, 6309,
  255. 6555, 6809, 7069, 7336, 7609, 7888, 8173, 8464, 8760, 9062,
  256. 9369, 9681, 9998, 10319, 10646, 10976, 11310, 11649, 11991, 12336,
  257. 12685, 13037, 13391, 13749, 14108, 14470, 14834, 15199, 15566, 15935,
  258. 16304, 16674, 17045, 17416, 17788, 18159, 18530, 18900, 19270, 19639,
  259. 20007, 20373, 20738, 21101, 21461, 21820, 22176, 22529, 22879, 23226,
  260. 23570, 23910, 24247, 24579, 24907, 25231, 25551, 25865, 26175, 26479,
  261. 26778, 27072, 27360, 27642, 27918, 28188, 28451, 28708, 28958, 29202,
  262. 29438, 29667, 29889, 30104, 30311, 30510, 30702, 30886, 31061, 31229,
  263. 31388, 31539, 31682, 31816, 31942, 32059, 32167, 32266, 32357, 32439,
  264. 32511, 32575, 32630, 32675, 32712, 32739, 32758, 32767, 32767, 32758,
  265. 32739, 32712, 32675, 32630, 32575, 32511, 32439, 32357, 32266, 32167,
  266. 32059, 31942, 31816, 31682, 31539, 31388, 31229, 31061, 30886, 30702,
  267. 30510, 30311, 30104, 29889, 29667, 29438, 29202, 28958, 28708, 28451,
  268. 28188, 27918, 27642, 27360, 27072, 26778, 26479, 26175, 25865, 25551,
  269. 25231, 24907, 24579, 24247, 23910, 23570, 23226, 22879, 22529, 22176,
  270. 21820, 21461, 21101, 20738, 20373, 20007, 19639, 19270, 18900, 18530,
  271. 18159, 17788, 17416, 17045, 16674, 16304, 15935, 15566, 15199, 14834,
  272. 14470, 14108, 13749, 13391, 13037, 12685, 12336, 11991, 11649, 11310,
  273. 10976, 10646, 10319, 9998, 9681, 9369, 9062, 8760, 8464, 8173,
  274. 7888, 7609, 7336, 7069, 6809, 6555, 6309, 6069, 5836, 5610,
  275. 5392, 5181, 4978, 4782, 4595, 4415, 4243, 4080, 3925, 3778,
  276. 3639, 3509, 3388, 3276, 3172, 3077, 2991, 2913, 2845, 2786,
  277. 2736, 2695, 2663, 2640, 2626, 2621,
  278. };
  279. const int16_t AudioWindowCosine256[] __attribute__ ((aligned (4))) = {
  280. 0, 404, 807, 1211, 1614, 2017, 2420, 2822, 3224, 3626,
  281. 4027, 4427, 4827, 5226, 5624, 6021, 6417, 6813, 7207, 7600,
  282. 7993, 8383, 8773, 9161, 9548, 9934, 10318, 10700, 11081, 11460,
  283. 11837, 12213, 12586, 12958, 13328, 13696, 14061, 14425, 14786, 15145,
  284. 15502, 15857, 16209, 16558, 16906, 17250, 17592, 17931, 18268, 18602,
  285. 18932, 19261, 19586, 19908, 20227, 20543, 20856, 21166, 21472, 21776,
  286. 22076, 22372, 22666, 22955, 23242, 23525, 23804, 24079, 24351, 24620,
  287. 24884, 25145, 25402, 25655, 25904, 26149, 26391, 26628, 26861, 27090,
  288. 27315, 27536, 27753, 27966, 28174, 28378, 28578, 28773, 28964, 29151,
  289. 29333, 29510, 29684, 29852, 30017, 30176, 30331, 30482, 30628, 30769,
  290. 30905, 31037, 31164, 31287, 31404, 31517, 31625, 31728, 31827, 31921,
  291. 32009, 32093, 32172, 32247, 32316, 32380, 32440, 32494, 32544, 32588,
  292. 32628, 32663, 32693, 32718, 32738, 32752, 32762, 32767, 32767, 32762,
  293. 32752, 32738, 32718, 32693, 32663, 32628, 32588, 32544, 32494, 32440,
  294. 32380, 32316, 32247, 32172, 32093, 32009, 31921, 31827, 31728, 31625,
  295. 31517, 31404, 31287, 31164, 31037, 30905, 30769, 30628, 30482, 30331,
  296. 30176, 30017, 29852, 29684, 29510, 29333, 29151, 28964, 28773, 28578,
  297. 28378, 28174, 27966, 27753, 27536, 27315, 27090, 26861, 26628, 26391,
  298. 26149, 25904, 25655, 25402, 25145, 24884, 24620, 24351, 24079, 23804,
  299. 23525, 23242, 22955, 22666, 22372, 22076, 21776, 21472, 21166, 20856,
  300. 20543, 20227, 19908, 19586, 19261, 18932, 18602, 18268, 17931, 17592,
  301. 17250, 16906, 16558, 16209, 15857, 15502, 15145, 14786, 14425, 14061,
  302. 13696, 13328, 12958, 12586, 12213, 11837, 11460, 11081, 10700, 10318,
  303. 9934, 9548, 9161, 8773, 8383, 7993, 7600, 7207, 6813, 6417,
  304. 6021, 5624, 5226, 4827, 4427, 4027, 3626, 3224, 2822, 2420,
  305. 2017, 1614, 1211, 807, 404, 0,
  306. };
  307. const int16_t AudioWindowTukey256[] __attribute__ ((aligned (4))) = {
  308. 0, 20, 80, 179, 317, 495, 711, 965, 1257, 1585,
  309. 1949, 2349, 2782, 3249, 3747, 4276, 4834, 5421, 6034, 6672,
  310. 7334, 8018, 8722, 9445, 10184, 10939, 11707, 12486, 13274, 14070,
  311. 14872, 15678, 16485, 17292, 18097, 18897, 19692, 20478, 21255, 22019,
  312. 22770, 23506, 24224, 24923, 25602, 26258, 26890, 27496, 28076, 28627,
  313. 29148, 29639, 30097, 30522, 30913, 31268, 31588, 31870, 32115, 32321,
  314. 32489, 32618, 32707, 32757, 32767, 32767, 32767, 32767, 32767, 32767,
  315. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  316. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  317. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  318. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  319. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  320. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  321. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  322. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  323. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  324. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  325. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  326. 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
  327. 32767, 32767, 32757, 32707, 32618, 32489, 32321, 32115, 31870, 31588,
  328. 31268, 30913, 30522, 30097, 29639, 29148, 28627, 28076, 27496, 26890,
  329. 26258, 25602, 24923, 24224, 23506, 22770, 22019, 21255, 20478, 19692,
  330. 18897, 18097, 17292, 16485, 15678, 14872, 14070, 13274, 12486, 11707,
  331. 10939, 10184, 9445, 8722, 8018, 7334, 6672, 6034, 5421, 4834,
  332. 4276, 3747, 3249, 2782, 2349, 1949, 1585, 1257, 965, 711,
  333. 495, 317, 179, 80, 20, 0,
  334. };
  335. /*
  336. #! /usr/bin/perl
  337. # http://en.wikipedia.org/wiki/Window_function
  338. use Math::Trig ':pi';
  339. $len = 256;
  340. for ($i=0; $i < $len; $i++) {
  341. $name = "Hanning";
  342. $val = 0.5 * (1 - cos(2 * pi * $i / ($len -1)));
  343. #$name = "Bartlett";
  344. #$val = 1 - abs(($i - ($len - 1) / 2) / ($len / 2));
  345. #$name = "Blackman";
  346. #$a0 = (1 - 0.16) / 2;
  347. #$a1 = 0.5;
  348. #$a2 = 0.16 / 2;
  349. #$val = $a0 - $a1 * cos(2 * pi * $i / ($len -1)) + $a2 * cos(4 * pi * $i / ($len -1));
  350. #$name = "Flattop";
  351. #$a0 = 1;
  352. #$a1 = 1.93;
  353. #$a2 = 1.29;
  354. #$a3 = 0.388;
  355. #$a4 = 0.028;
  356. #$max = $a0 - $a1 * cos(pi) + $a2 * cos(2 * pi) - $a3 * cos(3 * pi) + $a4 * cos(4 * pi) ;
  357. #$val = $a0 - $a1 * cos(2 * pi * $i / ($len -1)) + $a2 * cos(4 * pi * $i / ($len -1));
  358. #$val += -1 * $a3 * cos(6 * pi * $i / ($len -1)) + $a4 * cos(8 * pi * $i / ($len -1));
  359. #$val /= $max;
  360. #$name = "BlackmanHarris";
  361. #$a0 = 0.35875;
  362. #$a1 = 0.48829;
  363. #$a2 = 0.14128;
  364. #$a3 = 0.01168;
  365. #$a4 = 0;
  366. #$val = $a0 - $a1 * cos(2 * pi * $i / ($len -1)) + $a2 * cos(4 * pi * $i / ($len -1));
  367. #$val += -1 * $a3 * cos(6 * pi * $i / ($len -1)) + $a4 * cos(8 * pi * $i / ($len -1));
  368. #$name = "Nuttall";
  369. #$a0 = 0.355768;
  370. #$a1 = 0.487396;
  371. #$a2 = 0.144232;
  372. #$a3 = 0.012604;
  373. #$a4 = 0;
  374. #$val = $a0 - $a1 * cos(2 * pi * $i / ($len -1)) + $a2 * cos(4 * pi * $i / ($len -1));
  375. #$val += -1 * $a3 * cos(6 * pi * $i / ($len -1)) + $a4 * cos(8 * pi * $i / ($len -1));
  376. #$name = "BlackmanNuttall";
  377. #$a0 = 0.3635819;
  378. #$a1 = 0.4891775;
  379. #$a2 = 0.1365995;
  380. #$a3 = 0.0106411;
  381. #$a4 = 0;
  382. #$val = $a0 - $a1 * cos(2 * pi * $i / ($len -1)) + $a2 * cos(4 * pi * $i / ($len -1));
  383. #$val += -1 * $a3 * cos(6 * pi * $i / ($len -1)) + $a4 * cos(8 * pi * $i / ($len -1));
  384. #$name = "Welch";
  385. #$val = 1 - (($i - ($len - 1) / 2) / ($len / 2)) ** 2;
  386. #$name = "Hamming";
  387. #$val = 0.54 - 0.46 * cos(2 * pi * $i / ($len -1));
  388. #$name = "Cosine";
  389. #$val = cos((pi * $i / ($len -1)) - (pi / 2));
  390. #$name = "Tukey";
  391. #$a = 0.5;
  392. #if ($i <= ($a * ($len - 1) / 2)) {
  393. # $val = 0.5 * (1 + cos(pi * ((2 * $i / ($a * ($len - 1))) - 1)));
  394. #} elsif ($i < (($len - 1) * (1 - $a / 2))) {
  395. # $val = 0.99999;
  396. #} else {
  397. # $val = 0.5 * (1 + cos(pi * ((2 * $i / ($a * ($len - 1))) - (2 / $a) + 1)));
  398. #}
  399. #$name = "KaiserBessel";
  400. # TODO: what is the full equation, with the "zero-th order modified Bessel function"?
  401. $n = int($val * 32768 + 0.5);
  402. $n = 32767 if $n > 32767;
  403. if (0) {
  404. print $i;
  405. print "\t";
  406. printf "%9.6f", $val;
  407. print "\t";
  408. print $n;
  409. print "\n";
  410. } else {
  411. if ($i == 0) {
  412. print "const int16_t AudioWindow${name}${len}[] __attribute__ ((aligned (4))) = {\n";
  413. }
  414. printf "%6d", $n;
  415. print "," if ($i < $len);
  416. print "\n" if ($i % 10) == 9;
  417. }
  418. }
  419. print "\n" unless ($len % 10) == 9;
  420. print "};\n";
  421. */