選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

data_windows.c 32KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  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. const int16_t AudioWindowHanning1024[] __attribute__ ((aligned (4))) = {
  336. 0, 0, 1, 3, 5, 8, 11, 15, 20, 25,
  337. 31, 37, 44, 52, 61, 69, 79, 89, 100, 111,
  338. 123, 136, 149, 163, 178, 193, 208, 225, 242, 259,
  339. 277, 296, 315, 335, 356, 377, 399, 421, 444, 468,
  340. 492, 517, 542, 568, 595, 622, 650, 678, 707, 736,
  341. 767, 797, 829, 860, 893, 926, 960, 994, 1029, 1064,
  342. 1100, 1137, 1174, 1211, 1250, 1288, 1328, 1368, 1408, 1449,
  343. 1491, 1533, 1576, 1619, 1663, 1708, 1753, 1798, 1844, 1891,
  344. 1938, 1986, 2034, 2083, 2133, 2182, 2233, 2284, 2335, 2387,
  345. 2440, 2493, 2547, 2601, 2656, 2711, 2766, 2823, 2879, 2937,
  346. 2994, 3053, 3111, 3171, 3230, 3291, 3351, 3413, 3474, 3536,
  347. 3599, 3662, 3726, 3790, 3855, 3920, 3985, 4051, 4118, 4185,
  348. 4252, 4320, 4388, 4457, 4526, 4596, 4666, 4737, 4808, 4879,
  349. 4951, 5023, 5096, 5169, 5243, 5317, 5391, 5466, 5541, 5617,
  350. 5693, 5769, 5846, 5923, 6001, 6079, 6158, 6236, 6316, 6395,
  351. 6475, 6555, 6636, 6717, 6799, 6880, 6962, 7045, 7128, 7211,
  352. 7295, 7379, 7463, 7547, 7632, 7717, 7803, 7889, 7975, 8062,
  353. 8148, 8236, 8323, 8411, 8499, 8587, 8676, 8765, 8854, 8944,
  354. 9033, 9123, 9214, 9304, 9395, 9486, 9578, 9670, 9761, 9854,
  355. 9946, 10039, 10132, 10225, 10318, 10412, 10505, 10599, 10694, 10788,
  356. 10883, 10978, 11073, 11168, 11264, 11359, 11455, 11551, 11648, 11744,
  357. 11841, 11937, 12034, 12131, 12229, 12326, 12424, 12521, 12619, 12717,
  358. 12815, 12914, 13012, 13111, 13209, 13308, 13407, 13506, 13605, 13704,
  359. 13804, 13903, 14003, 14102, 14202, 14302, 14401, 14501, 14601, 14701,
  360. 14802, 14902, 15002, 15102, 15203, 15303, 15403, 15504, 15604, 15705,
  361. 15806, 15906, 16007, 16107, 16208, 16309, 16409, 16510, 16610, 16711,
  362. 16812, 16912, 17013, 17113, 17214, 17314, 17415, 17515, 17616, 17716,
  363. 17816, 17916, 18017, 18117, 18217, 18317, 18416, 18516, 18616, 18716,
  364. 18815, 18915, 19014, 19113, 19213, 19312, 19411, 19509, 19608, 19707,
  365. 19805, 19904, 20002, 20100, 20198, 20296, 20393, 20491, 20588, 20685,
  366. 20782, 20879, 20976, 21072, 21169, 21265, 21361, 21457, 21552, 21647,
  367. 21743, 21838, 21932, 22027, 22121, 22216, 22309, 22403, 22497, 22590,
  368. 22683, 22776, 22868, 22961, 23053, 23144, 23236, 23327, 23418, 23509,
  369. 23599, 23690, 23780, 23869, 23959, 24048, 24136, 24225, 24313, 24401,
  370. 24489, 24576, 24663, 24750, 24836, 24922, 25008, 25093, 25178, 25263,
  371. 25347, 25431, 25515, 25599, 25682, 25764, 25847, 25929, 26010, 26091,
  372. 26172, 26253, 26333, 26413, 26492, 26571, 26650, 26728, 26806, 26883,
  373. 26960, 27037, 27113, 27189, 27265, 27340, 27414, 27488, 27562, 27636,
  374. 27708, 27781, 27853, 27925, 27996, 28067, 28137, 28207, 28276, 28345,
  375. 28414, 28482, 28550, 28617, 28683, 28750, 28815, 28881, 28946, 29010,
  376. 29074, 29137, 29200, 29263, 29325, 29386, 29447, 29508, 29568, 29627,
  377. 29686, 29745, 29803, 29860, 29917, 29974, 30029, 30085, 30140, 30194,
  378. 30248, 30301, 30354, 30407, 30458, 30510, 30560, 30611, 30660, 30709,
  379. 30758, 30806, 30853, 30900, 30947, 30993, 31038, 31083, 31127, 31170,
  380. 31213, 31256, 31298, 31339, 31380, 31420, 31460, 31499, 31538, 31576,
  381. 31613, 31650, 31686, 31722, 31757, 31791, 31825, 31859, 31891, 31924,
  382. 31955, 31986, 32017, 32046, 32076, 32104, 32132, 32160, 32187, 32213,
  383. 32239, 32264, 32288, 32312, 32335, 32358, 32380, 32402, 32422, 32443,
  384. 32462, 32481, 32500, 32518, 32535, 32551, 32567, 32583, 32598, 32612,
  385. 32625, 32638, 32651, 32662, 32673, 32684, 32694, 32703, 32712, 32720,
  386. 32727, 32734, 32740, 32746, 32751, 32755, 32759, 32762, 32764, 32766,
  387. 32767, 32767, 32767, 32767, 32766, 32764, 32762, 32759, 32755, 32751,
  388. 32746, 32740, 32734, 32727, 32720, 32712, 32703, 32694, 32684, 32673,
  389. 32662, 32651, 32638, 32625, 32612, 32598, 32583, 32567, 32551, 32535,
  390. 32518, 32500, 32481, 32462, 32443, 32422, 32402, 32380, 32358, 32335,
  391. 32312, 32288, 32264, 32239, 32213, 32187, 32160, 32132, 32104, 32076,
  392. 32046, 32017, 31986, 31955, 31924, 31891, 31859, 31825, 31791, 31757,
  393. 31722, 31686, 31650, 31613, 31576, 31538, 31499, 31460, 31420, 31380,
  394. 31339, 31298, 31256, 31213, 31170, 31127, 31083, 31038, 30993, 30947,
  395. 30900, 30853, 30806, 30758, 30709, 30660, 30611, 30560, 30510, 30458,
  396. 30407, 30354, 30301, 30248, 30194, 30140, 30085, 30029, 29974, 29917,
  397. 29860, 29803, 29745, 29686, 29627, 29568, 29508, 29447, 29386, 29325,
  398. 29263, 29200, 29137, 29074, 29010, 28946, 28881, 28815, 28750, 28683,
  399. 28617, 28550, 28482, 28414, 28345, 28276, 28207, 28137, 28067, 27996,
  400. 27925, 27853, 27781, 27708, 27636, 27562, 27488, 27414, 27340, 27265,
  401. 27189, 27113, 27037, 26960, 26883, 26806, 26728, 26650, 26571, 26492,
  402. 26413, 26333, 26253, 26172, 26091, 26010, 25929, 25847, 25764, 25682,
  403. 25599, 25515, 25431, 25347, 25263, 25178, 25093, 25008, 24922, 24836,
  404. 24750, 24663, 24576, 24489, 24401, 24313, 24225, 24136, 24048, 23959,
  405. 23869, 23780, 23690, 23599, 23509, 23418, 23327, 23236, 23144, 23053,
  406. 22961, 22868, 22776, 22683, 22590, 22497, 22403, 22309, 22216, 22121,
  407. 22027, 21932, 21838, 21743, 21647, 21552, 21457, 21361, 21265, 21169,
  408. 21072, 20976, 20879, 20782, 20685, 20588, 20491, 20393, 20296, 20198,
  409. 20100, 20002, 19904, 19805, 19707, 19608, 19509, 19411, 19312, 19213,
  410. 19113, 19014, 18915, 18815, 18716, 18616, 18516, 18416, 18317, 18217,
  411. 18117, 18017, 17916, 17816, 17716, 17616, 17515, 17415, 17314, 17214,
  412. 17113, 17013, 16912, 16812, 16711, 16610, 16510, 16409, 16309, 16208,
  413. 16107, 16007, 15906, 15806, 15705, 15604, 15504, 15403, 15303, 15203,
  414. 15102, 15002, 14902, 14802, 14701, 14601, 14501, 14401, 14302, 14202,
  415. 14102, 14003, 13903, 13804, 13704, 13605, 13506, 13407, 13308, 13209,
  416. 13111, 13012, 12914, 12815, 12717, 12619, 12521, 12424, 12326, 12229,
  417. 12131, 12034, 11937, 11841, 11744, 11648, 11551, 11455, 11359, 11264,
  418. 11168, 11073, 10978, 10883, 10788, 10694, 10599, 10505, 10412, 10318,
  419. 10225, 10132, 10039, 9946, 9854, 9761, 9670, 9578, 9486, 9395,
  420. 9304, 9214, 9123, 9033, 8944, 8854, 8765, 8676, 8587, 8499,
  421. 8411, 8323, 8236, 8148, 8062, 7975, 7889, 7803, 7717, 7632,
  422. 7547, 7463, 7379, 7295, 7211, 7128, 7045, 6962, 6880, 6799,
  423. 6717, 6636, 6555, 6475, 6395, 6316, 6236, 6158, 6079, 6001,
  424. 5923, 5846, 5769, 5693, 5617, 5541, 5466, 5391, 5317, 5243,
  425. 5169, 5096, 5023, 4951, 4879, 4808, 4737, 4666, 4596, 4526,
  426. 4457, 4388, 4320, 4252, 4185, 4118, 4051, 3985, 3920, 3855,
  427. 3790, 3726, 3662, 3599, 3536, 3474, 3413, 3351, 3291, 3230,
  428. 3171, 3111, 3053, 2994, 2937, 2879, 2823, 2766, 2711, 2656,
  429. 2601, 2547, 2493, 2440, 2387, 2335, 2284, 2233, 2182, 2133,
  430. 2083, 2034, 1986, 1938, 1891, 1844, 1798, 1753, 1708, 1663,
  431. 1619, 1576, 1533, 1491, 1449, 1408, 1368, 1328, 1288, 1250,
  432. 1211, 1174, 1137, 1100, 1064, 1029, 994, 960, 926, 893,
  433. 860, 829, 797, 767, 736, 707, 678, 650, 622, 595,
  434. 568, 542, 517, 492, 468, 444, 421, 399, 377, 356,
  435. 335, 315, 296, 277, 259, 242, 225, 208, 193, 178,
  436. 163, 149, 136, 123, 111, 100, 89, 79, 69, 61,
  437. 52, 44, 37, 31, 25, 20, 15, 11, 8, 5,
  438. 3, 1, 0, 0,
  439. };
  440. /*
  441. #! /usr/bin/perl
  442. # http://en.wikipedia.org/wiki/Window_function
  443. use Math::Trig ':pi';
  444. $len = 256;
  445. for ($i=0; $i < $len; $i++) {
  446. $name = "Hanning";
  447. $val = 0.5 * (1 - cos(2 * pi * $i / ($len -1)));
  448. #$name = "Bartlett";
  449. #$val = 1 - abs(($i - ($len - 1) / 2) / ($len / 2));
  450. #$name = "Blackman";
  451. #$a0 = (1 - 0.16) / 2;
  452. #$a1 = 0.5;
  453. #$a2 = 0.16 / 2;
  454. #$val = $a0 - $a1 * cos(2 * pi * $i / ($len -1)) + $a2 * cos(4 * pi * $i / ($len -1));
  455. #$name = "Flattop";
  456. #$a0 = 1;
  457. #$a1 = 1.93;
  458. #$a2 = 1.29;
  459. #$a3 = 0.388;
  460. #$a4 = 0.028;
  461. #$max = $a0 - $a1 * cos(pi) + $a2 * cos(2 * pi) - $a3 * cos(3 * pi) + $a4 * cos(4 * pi) ;
  462. #$val = $a0 - $a1 * cos(2 * pi * $i / ($len -1)) + $a2 * cos(4 * pi * $i / ($len -1));
  463. #$val += -1 * $a3 * cos(6 * pi * $i / ($len -1)) + $a4 * cos(8 * pi * $i / ($len -1));
  464. #$val /= $max;
  465. #$name = "BlackmanHarris";
  466. #$a0 = 0.35875;
  467. #$a1 = 0.48829;
  468. #$a2 = 0.14128;
  469. #$a3 = 0.01168;
  470. #$a4 = 0;
  471. #$val = $a0 - $a1 * cos(2 * pi * $i / ($len -1)) + $a2 * cos(4 * pi * $i / ($len -1));
  472. #$val += -1 * $a3 * cos(6 * pi * $i / ($len -1)) + $a4 * cos(8 * pi * $i / ($len -1));
  473. #$name = "Nuttall";
  474. #$a0 = 0.355768;
  475. #$a1 = 0.487396;
  476. #$a2 = 0.144232;
  477. #$a3 = 0.012604;
  478. #$a4 = 0;
  479. #$val = $a0 - $a1 * cos(2 * pi * $i / ($len -1)) + $a2 * cos(4 * pi * $i / ($len -1));
  480. #$val += -1 * $a3 * cos(6 * pi * $i / ($len -1)) + $a4 * cos(8 * pi * $i / ($len -1));
  481. #$name = "BlackmanNuttall";
  482. #$a0 = 0.3635819;
  483. #$a1 = 0.4891775;
  484. #$a2 = 0.1365995;
  485. #$a3 = 0.0106411;
  486. #$a4 = 0;
  487. #$val = $a0 - $a1 * cos(2 * pi * $i / ($len -1)) + $a2 * cos(4 * pi * $i / ($len -1));
  488. #$val += -1 * $a3 * cos(6 * pi * $i / ($len -1)) + $a4 * cos(8 * pi * $i / ($len -1));
  489. #$name = "Welch";
  490. #$val = 1 - (($i - ($len - 1) / 2) / ($len / 2)) ** 2;
  491. #$name = "Hamming";
  492. #$val = 0.54 - 0.46 * cos(2 * pi * $i / ($len -1));
  493. #$name = "Cosine";
  494. #$val = cos((pi * $i / ($len -1)) - (pi / 2));
  495. #$name = "Tukey";
  496. #$a = 0.5;
  497. #if ($i <= ($a * ($len - 1) / 2)) {
  498. # $val = 0.5 * (1 + cos(pi * ((2 * $i / ($a * ($len - 1))) - 1)));
  499. #} elsif ($i < (($len - 1) * (1 - $a / 2))) {
  500. # $val = 0.99999;
  501. #} else {
  502. # $val = 0.5 * (1 + cos(pi * ((2 * $i / ($a * ($len - 1))) - (2 / $a) + 1)));
  503. #}
  504. #$name = "KaiserBessel";
  505. # TODO: what is the full equation, with the "zero-th order modified Bessel function"?
  506. $n = int($val * 32768 + 0.5);
  507. $n = 32767 if $n > 32767;
  508. if (0) {
  509. print $i;
  510. print "\t";
  511. printf "%9.6f", $val;
  512. print "\t";
  513. print $n;
  514. print "\n";
  515. } else {
  516. if ($i == 0) {
  517. print "const int16_t AudioWindow${name}${len}[] __attribute__ ((aligned (4))) = {\n";
  518. }
  519. printf "%6d", $n;
  520. print "," if ($i < $len);
  521. print "\n" if ($i % 10) == 9;
  522. }
  523. }
  524. print "\n" unless ($len % 10) == 9;
  525. print "};\n";
  526. */