music mixer code

Dependencies:   mbed wave_player mbed-rtos SimpleRGB 4DGL-uLCD-SE PinDetect

snare.h

Committer:
vamsatoor
Date:
2019-12-09
Revision:
10:5f5e199e1b9c

File content as of revision 10:5f5e199e1b9c:

/**********************************************************************
* Written by WAVToCode
* Date:             Sat Dec 07 06:00:17 PM
* FileName:         snare_8k_8bit_unsigned.C
* Interleaved:      N/A
* Signed:           No
* No. of channels:  1
* No. of samples:   2203
* Bits/Sample:      8
**********************************************************************/

#define NUM_ELEMENTS 2203

const unsigned char data_snare[NUM_ELEMENTS] = {
126, 118, 118, 119, 122, 116, 113, 110, /* 0-7 */
110, 108, 107, 112, 105, 105, 123, 139, /* 8-15 */
150, 156, 164, 172, 173, 179, 183, 182, /* 16-23 */
171, 163, 160, 155, 150, 145, 139, 136, /* 24-31 */
132, 127, 123, 115, 107, 100, 101,  93, /* 32-39 */
 89,  85,  74,  75,  78,  70,  56,  54, /* 40-47 */
 63,  74,  81,  84,  83,  87,  97, 110, /* 48-55 */
125, 143, 156, 164, 170, 176, 174, 171, /* 56-63 */
177, 177, 170, 166, 161, 163, 170, 176, /* 64-71 */
179, 178, 177, 169, 161, 160, 157, 148, /* 72-79 */
140, 133, 125, 126, 126, 123, 117, 111, /* 80-87 */
103,  96,  92,  85,  81,  79,  76,  74, /* 88-95 */
 76,  81,  79,  76,  76,  80,  80,  85, /* 96-103 */
 88,  90,  98, 109, 120, 126, 135, 150, /* 104-111 */
160, 164, 167, 168, 174, 185, 200, 198, /* 112-119 */
182, 181, 179, 184, 174, 163, 165, 154, /* 120-127 */
153, 140, 138, 139, 128, 117, 121, 120, /* 128-135 */
107, 108,  95,  96,  92,  94,  84,  72, /* 136-143 */
 80,  77,  77,  73,  78,  76,  77,  86, /* 144-151 */
 99, 114, 121, 125, 130, 141, 154, 162, /* 152-159 */
165, 160, 149, 153, 153, 151, 153, 154, /* 160-167 */
143, 147, 154, 150, 154, 151, 156, 147, /* 168-175 */
152, 157, 151, 146, 143, 149, 144, 131, /* 176-183 */
118, 116, 119, 110, 102, 102, 102,  99, /* 184-191 */
 95,  94, 100,  96, 109, 106, 100, 110, /* 192-199 */
102, 109, 104, 102, 109, 108, 109, 116, /* 200-207 */
126, 129, 127, 133, 133, 141, 145, 148, /* 208-215 */
149, 143, 148, 140, 143, 139, 142, 142, /* 216-223 */
142, 149, 147, 154, 154, 149, 152, 153, /* 224-231 */
141, 130, 128, 130, 125, 130, 129, 113, /* 232-239 */
108, 103,  99, 103, 100,  89,  92,  92, /* 240-247 */
 90,  96, 107, 127, 122, 114, 123, 126, /* 248-255 */
129, 147, 147, 139, 145, 153, 150, 153, /* 256-263 */
148, 151, 146, 137, 152, 144, 148, 134, /* 264-271 */
130, 129, 133, 125, 119, 119, 118, 127, /* 272-279 */
126, 128, 118, 124, 118, 122, 124, 122, /* 280-287 */
112, 121, 110, 105, 118, 112, 108, 108, /* 288-295 */
115, 113, 117, 110, 118, 120, 122, 129, /* 296-303 */
131, 145, 138, 135, 146, 141, 148, 146, /* 304-311 */
148, 139, 129, 137, 132, 138, 141, 142, /* 312-319 */
138, 127, 121, 118, 117, 124, 117, 117, /* 320-327 */
115, 115, 123, 126, 117, 121, 122, 109, /* 328-335 */
121, 129, 144, 136, 135, 141, 126, 116, /* 336-343 */
120, 118, 121, 114, 108, 113, 114, 134, /* 344-351 */
123, 125, 134, 147, 139, 137, 144, 145, /* 352-359 */
147, 144, 144, 136, 139, 140, 133, 127, /* 360-367 */
138, 121, 120, 120, 122, 124, 114, 111, /* 368-375 */
111, 115, 120, 118, 116, 129, 113, 118, /* 376-383 */
121, 114, 121, 131, 130, 125, 118, 123, /* 384-391 */
126, 113, 130, 135, 124, 120, 118, 124, /* 392-399 */
126, 119, 122, 128, 124, 129, 135, 139, /* 400-407 */
150, 146, 141, 142, 148, 144, 142, 144, /* 408-415 */
133, 138, 139, 135, 130, 132, 129, 121, /* 416-423 */
121, 117, 114, 107, 114, 123, 114, 121, /* 424-431 */
109, 116, 121, 110, 127, 118, 115, 121, /* 432-439 */
121, 125, 132, 127, 119, 129, 130, 125, /* 440-447 */
136, 130, 125, 123, 126, 130, 119, 135, /* 448-455 */
142, 135, 148, 145, 131, 135, 143, 142, /* 456-463 */
131, 136, 135, 129, 124, 119, 125, 128, /* 464-471 */
121, 112, 113, 126, 120, 115, 120, 122, /* 472-479 */
126, 124, 119, 120, 137, 130, 121, 129, /* 480-487 */
122, 124, 127, 123, 119, 117, 126, 126, /* 488-495 */
130, 138, 130, 134, 132, 132, 135, 129, /* 496-503 */
128, 127, 124, 119, 121, 118, 117, 121, /* 504-511 */
138, 137, 128, 137, 144, 140, 145, 146, /* 512-519 */
133, 132, 129, 129, 130, 126, 132, 130, /* 520-527 */
120, 124, 126, 116, 116, 126, 118, 120, /* 528-535 */
115, 113, 112, 112, 116, 114, 115, 113, /* 536-543 */
112, 111, 120, 121, 119, 123, 132, 132, /* 544-551 */
136, 134, 139, 140, 145, 143, 132, 140, /* 552-559 */
136, 140, 141, 139, 136, 140, 134, 136, /* 560-567 */
141, 132, 137, 139, 134, 134, 132, 127, /* 568-575 */
119, 116, 120, 111, 108, 111, 109, 111, /* 576-583 */
111, 111, 116, 113, 124, 125, 118, 125, /* 584-591 */
129, 126, 128, 131, 133, 133, 130, 136, /* 592-599 */
135, 134, 136, 136, 131, 138, 127, 129, /* 600-607 */
132, 124, 129, 124, 128, 124, 129, 127, /* 608-615 */
125, 132, 122, 123, 121, 129, 132, 126, /* 616-623 */
128, 132, 134, 135, 138, 123, 122, 121, /* 624-631 */
122, 123, 115, 127, 118, 121, 125, 123, /* 632-639 */
129, 127, 127, 127, 128, 126, 122, 125, /* 640-647 */
124, 121, 123, 124, 121, 129, 131, 126, /* 648-655 */
126, 125, 127, 133, 130, 130, 139, 135, /* 656-663 */
140, 140, 137, 140, 128, 135, 133, 130, /* 664-671 */
131, 131, 133, 128, 128, 125, 133, 122, /* 672-679 */
116, 121, 124, 116, 112, 117, 114, 118, /* 680-687 */
113, 119, 116, 113, 122, 125, 126, 133, /* 688-695 */
136, 132, 127, 137, 138, 135, 129, 131, /* 696-703 */
135, 126, 129, 128, 126, 130, 126, 124, /* 704-711 */
134, 125, 128, 130, 126, 125, 130, 128, /* 712-719 */
124, 128, 123, 126, 125, 124, 125, 122, /* 720-727 */
126, 130, 124, 128, 127, 128, 128, 124, /* 728-735 */
126, 128, 124, 123, 125, 128, 133, 131, /* 736-743 */
126, 130, 136, 126, 130, 133, 128, 131, /* 744-751 */
129, 134, 131, 128, 131, 124, 122, 126, /* 752-759 */
123, 120, 120, 121, 122, 123, 128, 129, /* 760-767 */
127, 131, 134, 132, 130, 132, 131, 128, /* 768-775 */
128, 127, 123, 124, 122, 120, 127, 121, /* 776-783 */
125, 126, 123, 128, 125, 128, 126, 125, /* 784-791 */
127, 126, 126, 125, 128, 126, 125, 132, /* 792-799 */
127, 131, 129, 131, 131, 129, 133, 131, /* 800-807 */
132, 130, 132, 133, 130, 127, 128, 125, /* 808-815 */
126, 126, 124, 126, 126, 128, 123, 123, /* 816-823 */
121, 123, 130, 126, 125, 122, 121, 125, /* 824-831 */
121, 124, 122, 122, 123, 123, 124, 126, /* 832-839 */
128, 131, 132, 133, 132, 133, 135, 131, /* 840-847 */
134, 136, 133, 131, 132, 128, 129, 132, /* 848-855 */
127, 127, 126, 130, 128, 126, 131, 124, /* 856-863 */
121, 119, 116, 121, 124, 124, 122, 125, /* 864-871 */
120, 121, 127, 127, 126, 123, 123, 124, /* 872-879 */
126, 128, 128, 129, 130, 125, 127, 128, /* 880-887 */
129, 132, 130, 129, 130, 129, 132, 130, /* 888-895 */
133, 133, 132, 133, 130, 131, 130, 130, /* 896-903 */
125, 128, 122, 121, 124, 121, 127, 130, /* 904-911 */
125, 125, 123, 126, 128, 130, 129, 125, /* 912-919 */
124, 123, 128, 126, 128, 123, 120, 121, /* 920-927 */
124, 125, 124, 126, 123, 127, 126, 124, /* 928-935 */
127, 127, 126, 130, 131, 130, 130, 131, /* 936-943 */
129, 130, 128, 130, 129, 131, 130, 134, /* 944-951 */
133, 130, 134, 127, 128, 126, 128, 127, /* 952-959 */
127, 123, 124, 125, 125, 126, 123, 122, /* 960-967 */
123, 124, 126, 132, 129, 128, 122, 128, /* 968-975 */
124, 120, 122, 119, 120, 121, 125, 122, /* 976-983 */
124, 130, 127, 130, 132, 132, 130, 132, /* 984-991 */
132, 131, 133, 131, 133, 128, 128, 131, /* 992-999 */
130, 128, 126, 128, 124, 123, 129, 128, /* 1000-1007 */
126, 127, 128, 129, 132, 130, 127, 128, /* 1008-1015 */
126, 123, 123, 123, 124, 122, 122, 121, /* 1016-1023 */
123, 129, 126, 128, 130, 126, 126, 128, /* 1024-1031 */
125, 128, 127, 124, 124, 122, 125, 123, /* 1032-1039 */
124, 128, 127, 129, 129, 127, 131, 127, /* 1040-1047 */
127, 131, 127, 130, 128, 128, 128, 128, /* 1048-1055 */
128, 130, 130, 127, 129, 129, 132, 133, /* 1056-1063 */
133, 132, 130, 130, 129, 126, 125, 123, /* 1064-1071 */
120, 118, 120, 123, 120, 118, 123, 124, /* 1072-1079 */
124, 124, 129, 129, 125, 128, 127, 130, /* 1080-1087 */
128, 128, 127, 129, 128, 126, 128, 126, /* 1088-1095 */
129, 130, 127, 128, 130, 132, 132, 131, /* 1096-1103 */
133, 131, 131, 128, 126, 126, 127, 124, /* 1104-1111 */
123, 124, 123, 124, 124, 125, 124, 125, /* 1112-1119 */
122, 124, 124, 121, 126, 123, 122, 126, /* 1120-1127 */
127, 126, 127, 130, 131, 132, 132, 131, /* 1128-1135 */
133, 136, 135, 132, 133, 133, 130, 129, /* 1136-1143 */
127, 127, 128, 126, 123, 125, 125, 123, /* 1144-1151 */
124, 127, 126, 128, 125, 126, 128, 127, /* 1152-1159 */
126, 123, 125, 124, 121, 122, 126, 125, /* 1160-1167 */
123, 124, 125, 127, 125, 125, 126, 126, /* 1168-1175 */
125, 127, 127, 128, 131, 129, 133, 133, /* 1176-1183 */
131, 135, 132, 129, 132, 133, 133, 131, /* 1184-1191 */
131, 130, 129, 128, 125, 127, 126, 125, /* 1192-1199 */
124, 122, 121, 120, 120, 124, 123, 125, /* 1200-1207 */
127, 127, 128, 127, 129, 127, 125, 124, /* 1208-1215 */
125, 125, 123, 123, 124, 125, 127, 125, /* 1216-1223 */
125, 128, 128, 130, 131, 134, 134, 132, /* 1224-1231 */
129, 131, 131, 128, 129, 129, 129, 130, /* 1232-1239 */
129, 127, 129, 127, 128, 128, 127, 127, /* 1240-1247 */
126, 126, 127, 126, 125, 126, 125, 125, /* 1248-1255 */
125, 124, 125, 124, 125, 124, 125, 123, /* 1256-1263 */
120, 125, 126, 125, 127, 127, 127, 127, /* 1264-1271 */
127, 129, 126, 127, 126, 125, 126, 128, /* 1272-1279 */
129, 129, 133, 131, 134, 134, 132, 132, /* 1280-1287 */
131, 126, 129, 128, 128, 127, 126, 126, /* 1288-1295 */
124, 127, 128, 128, 130, 127, 124, 128, /* 1296-1303 */
124, 123, 126, 128, 126, 125, 124, 124, /* 1304-1311 */
125, 126, 125, 123, 124, 124, 124, 126, /* 1312-1319 */
129, 127, 127, 127, 129, 130, 129, 128, /* 1320-1327 */
130, 131, 130, 127, 127, 128, 128, 127, /* 1328-1335 */
127, 129, 126, 127, 128, 129, 129, 127, /* 1336-1343 */
127, 129, 128, 127, 128, 127, 127, 126, /* 1344-1351 */
127, 126, 124, 125, 126, 125, 125, 124, /* 1352-1359 */
125, 126, 126, 127, 125, 126, 126, 125, /* 1360-1367 */
126, 124, 125, 128, 127, 125, 128, 131, /* 1368-1375 */
130, 131, 130, 132, 131, 131, 132, 129, /* 1376-1383 */
129, 129, 128, 127, 129, 128, 129, 127, /* 1384-1391 */
126, 127, 128, 128, 129, 128, 126, 129, /* 1392-1399 */
127, 129, 127, 124, 122, 121, 120, 120, /* 1400-1407 */
123, 119, 121, 124, 124, 126, 126, 125, /* 1408-1415 */
128, 128, 127, 128, 125, 129, 130, 129, /* 1416-1423 */
131, 131, 131, 131, 132, 131, 130, 130, /* 1424-1431 */
130, 130, 128, 129, 130, 129, 131, 129, /* 1432-1439 */
128, 125, 126, 125, 123, 124, 122, 123, /* 1440-1447 */
123, 124, 126, 126, 127, 126, 126, 126, /* 1448-1455 */
126, 124, 122, 123, 122, 124, 123, 125, /* 1456-1463 */
126, 127, 129, 130, 131, 132, 133, 134, /* 1464-1471 */
133, 132, 133, 130, 128, 129, 128, 127, /* 1472-1479 */
126, 126, 126, 125, 125, 126, 127, 128, /* 1480-1487 */
127, 126, 125, 125, 126, 126, 126, 125, /* 1488-1495 */
124, 125, 124, 125, 126, 124, 124, 124, /* 1496-1503 */
125, 128, 128, 127, 128, 127, 126, 127, /* 1504-1511 */
127, 126, 127, 129, 127, 126, 126, 128, /* 1512-1519 */
128, 128, 129, 130, 130, 131, 130, 132, /* 1520-1527 */
130, 130, 130, 128, 128, 125, 126, 126, /* 1528-1535 */
125, 124, 124, 127, 127, 129, 129, 129, /* 1536-1543 */
129, 129, 128, 126, 125, 124, 122, 121, /* 1544-1551 */
121, 121, 121, 123, 125, 125, 126, 126, /* 1552-1559 */
128, 127, 129, 130, 130, 130, 131, 132, /* 1560-1567 */
130, 130, 130, 131, 129, 129, 129, 129, /* 1568-1575 */
128, 128, 130, 129, 128, 128, 129, 126, /* 1576-1583 */
126, 126, 124, 124, 123, 123, 122, 122, /* 1584-1591 */
122, 121, 125, 124, 124, 125, 125, 124, /* 1592-1599 */
124, 127, 126, 128, 127, 128, 128, 127, /* 1600-1607 */
128, 127, 127, 127, 129, 130, 129, 131, /* 1608-1615 */
132, 131, 133, 133, 131, 130, 129, 129, /* 1616-1623 */
128, 126, 126, 125, 126, 126, 125, 127, /* 1624-1631 */
126, 127, 127, 127, 127, 127, 127, 125, /* 1632-1639 */
125, 124, 123, 124, 124, 124, 124, 123, /* 1640-1647 */
123, 123, 125, 126, 126, 126, 127, 127, /* 1648-1655 */
128, 129, 128, 128, 128, 128, 127, 128, /* 1656-1663 */
127, 129, 130, 130, 130, 129, 130, 130, /* 1664-1671 */
129, 130, 129, 128, 128, 127, 127, 125, /* 1672-1679 */
125, 124, 125, 125, 125, 126, 125, 125, /* 1680-1687 */
126, 125, 124, 125, 124, 125, 125, 127, /* 1688-1695 */
126, 127, 127, 126, 125, 125, 126, 126, /* 1696-1703 */
127, 128, 129, 131, 131, 133, 133, 133, /* 1704-1711 */
132, 131, 130, 130, 129, 127, 128, 126, /* 1712-1719 */
126, 126, 127, 127, 127, 128, 128, 127, /* 1720-1727 */
126, 126, 124, 122, 122, 122, 122, 123, /* 1728-1735 */
123, 124, 124, 124, 125, 126, 125, 127, /* 1736-1743 */
127, 129, 129, 130, 129, 130, 129, 128, /* 1744-1751 */
128, 128, 127, 127, 127, 128, 128, 128, /* 1752-1759 */
130, 130, 129, 129, 129, 129, 128, 128, /* 1760-1767 */
128, 127, 127, 126, 126, 125, 126, 126, /* 1768-1775 */
125, 125, 125, 125, 126, 127, 127, 127, /* 1776-1783 */
127, 128, 130, 128, 127, 126, 125, 124, /* 1784-1791 */
124, 124, 125, 125, 126, 128, 127, 130, /* 1792-1799 */
129, 129, 129, 129, 128, 125, 127, 126, /* 1800-1807 */
125, 126, 127, 128, 127, 128, 128, 129, /* 1808-1815 */
130, 131, 130, 130, 130, 128, 127, 127, /* 1816-1823 */
126, 126, 125, 124, 124, 124, 124, 124, /* 1824-1831 */
125, 125, 124, 125, 125, 125, 127, 127, /* 1832-1839 */
127, 126, 127, 126, 126, 127, 125, 125, /* 1840-1847 */
127, 127, 127, 129, 129, 130, 131, 131, /* 1848-1855 */
130, 131, 129, 129, 131, 129, 129, 128, /* 1856-1863 */
128, 127, 127, 126, 127, 125, 125, 125, /* 1864-1871 */
125, 126, 127, 127, 127, 127, 126, 126, /* 1872-1879 */
124, 124, 124, 124, 124, 124, 124, 126, /* 1880-1887 */
126, 127, 129, 130, 128, 130, 130, 130, /* 1888-1895 */
129, 128, 128, 126, 127, 128, 128, 128, /* 1896-1903 */
128, 128, 129, 128, 129, 129, 129, 127, /* 1904-1911 */
128, 127, 127, 128, 126, 125, 124, 124, /* 1912-1919 */
123, 123, 123, 124, 125, 126, 125, 126, /* 1920-1927 */
126, 127, 127, 128, 128, 128, 126, 127, /* 1928-1935 */
127, 126, 126, 126, 127, 129, 129, 128, /* 1936-1943 */
130, 130, 130, 130, 130, 130, 129, 131, /* 1944-1951 */
130, 131, 130, 129, 128, 127, 128, 126, /* 1952-1959 */
125, 125, 126, 126, 127, 128, 128, 127, /* 1960-1967 */
128, 127, 126, 125, 124, 122, 122, 122, /* 1968-1975 */
123, 124, 124, 125, 126, 126, 128, 128, /* 1976-1983 */
128, 128, 128, 128, 126, 126, 125, 126, /* 1984-1991 */
126, 128, 128, 129, 129, 129, 130, 131, /* 1992-1999 */
131, 130, 131, 131, 131, 131, 131, 130, /* 2000-2007 */
129, 128, 127, 126, 126, 125, 125, 125, /* 2008-2015 */
125, 125, 126, 124, 124, 124, 125, 125, /* 2016-2023 */
124, 123, 124, 124, 124, 124, 124, 125, /* 2024-2031 */
125, 127, 127, 128, 128, 128, 129, 129, /* 2032-2039 */
131, 131, 131, 132, 132, 132, 131, 130, /* 2040-2047 */
129, 129, 128, 128, 128, 129, 129, 129, /* 2048-2055 */
130, 129, 128, 128, 126, 125, 124, 123, /* 2056-2063 */
122, 121, 121, 122, 122, 122, 124, 124, /* 2064-2071 */
124, 125, 126, 127, 127, 127, 127, 128, /* 2072-2079 */
127, 127, 128, 128, 128, 129, 128, 129, /* 2080-2087 */
128, 128, 128, 128, 129, 130, 130, 130, /* 2088-2095 */
131, 132, 131, 129, 129, 128, 127, 128, /* 2096-2103 */
127, 125, 125, 125, 126, 126, 126, 126, /* 2104-2111 */
126, 125, 125, 126, 127, 125, 125, 126, /* 2112-2119 */
126, 124, 124, 125, 125, 125, 126, 126, /* 2120-2127 */
125, 126, 126, 128, 127, 128, 130, 128, /* 2128-2135 */
129, 128, 128, 128, 127, 127, 127, 127, /* 2136-2143 */
128, 128, 129, 130, 129, 130, 130, 130, /* 2144-2151 */
129, 129, 127, 127, 125, 126, 125, 125, /* 2152-2159 */
125, 125, 123, 123, 125, 125, 125, 125, /* 2160-2167 */
125, 125, 125, 125, 125, 126, 126, 126, /* 2168-2175 */
126, 126, 126, 127, 127, 127, 127, 128, /* 2176-2183 */
129, 130, 130, 130, 130, 130, 130, 130, /* 2184-2191 */
129, 129, 129, 129, 128, 128, 128, 127, /* 2192-2199 */
127, 128, 127}; /* 2200-2202 */


//get and set the frequency from wav conversion tool GUI
int sn=0;

//interrupt routine to play next audio sample from array in flash
void audio_sample_snare()
{

    speaker = data_snare[sn]/255.0;//scale to 0.0 to 1.0 for PWM
    sn++;
    if (sn>= NUM_ELEMENTS) {
        sn = 0;
        sampletick.detach();
        myled = 0;
    }
}