diff --git a/README.md b/README.md index 8eefe9c..d6f1846 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,12 @@ ChangeLog ```` +== 2024-12-22 + * Bugfix + * SEQ/TuringMachine crash #119 + * M-OSC/Waveforms: Braids Renaissance Chords - fixed note offsets #117 + * Enhancements + * DrumSynth ... == 2024-12-17 * Bugfix/Enchancement #117 * Parameter value was not visualized when modulations set (Bug since 2024-12-16) diff --git a/app/CV/EnvGen_ADSR.cpp b/app/CV/EnvGen_ADSR.cpp index f5c8d32..95b486c 100644 --- a/app/CV/EnvGen_ADSR.cpp +++ b/app/CV/EnvGen_ADSR.cpp @@ -28,7 +28,7 @@ #include "../squares-and-circles-api.h" #include "peaks/modulations/multistage_envelope.h" #include "peaks/modulations/multistage_envelope.cc" -#include "../DRUMS/resources/peaks_lut_env.hpp" +#include "peaks/resources.cc" peaks::MultistageEnvelope _processor; diff --git a/app/DRUMS/Claps.bin b/app/DRUMS/Claps.bin index 57604aa..4a2b792 100644 Binary files a/app/DRUMS/Claps.bin and b/app/DRUMS/Claps.bin differ diff --git a/app/DRUMS/DrumSynth.bin b/app/DRUMS/DrumSynth.bin new file mode 100644 index 0000000..1932c27 Binary files /dev/null and b/app/DRUMS/DrumSynth.bin differ diff --git a/app/DRUMS/DrumSynth.cpp b/app/DRUMS/DrumSynth.cpp new file mode 100644 index 0000000..8f2db95 --- /dev/null +++ b/app/DRUMS/DrumSynth.cpp @@ -0,0 +1,196 @@ +// Copyright (C)2024 - E.Heidt +// +// Author: E.Heidt (eh2k@gmx.de) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// See http://creativecommons.org/licenses/MIT/ for more information. +// + +// xuild_flags: -fno-inline -mfloat-abi=hard -mfpu=fpv5-d16 +// ENGINE_NAME: DRUMS/@!RC8 + +#include "../squares-and-circles-api.h" +#include "../../lib/drumsynth/drumsynth.h" +#include "../../lib/misc/noise.hxx" + +static constexpr size_t n = 8; + +float pitch = 1.f; +float stereo = 0.5f; +float stretch = 1.f; + +DrumModel _instModel[16] = {}; +DrumSynth _inst[16] = {}; + +size_t inst_count = 0; +int32_t inst_selection = 0; +int32_t _midi_trigs = 0; + +uint32_t _t[16] = {}; + +const char *inst_names[16] = {}; + +char __debug[128]; + +void engine::setup() +{ + const uint8_t *drumkit = __data; + // unpack + inst_count = drum_synth_load_models(drumkit, _instModel, ::malloc); + if (inst_count > 0) + { + for (int i = 0; i < inst_count; i++) + { + inst_names[i] = _instModel[i].name; + _t[i] = UINT32_MAX; + _inst[i] = drum_synth_init(&_instModel[i], ::malloc); + } + + engine::addParam("Pitch", &pitch, 0.5f, 1.5f); + engine::addParam(MULTI_TRIGS, &inst_selection, 0, inst_count - 1, inst_names); + engine::addParam("Decay", &stretch, 0.1f, 2.0f); + engine::addParam("Stereo", &stereo); + } + + engine::setMode(ENGINE_MODE_MIDI_IN); +} + +void engine::release() +{ + for (int i = 0; i < inst_count; i++) + { + ::free(_inst[i]); + } +} + +void engine::process() +{ + auto buffer = engine::outputBuffer<0>(); + auto bufferAux = engine::outputBuffer<1>(); + memset(buffer, 0, sizeof(float) * FRAME_BUFFER_SIZE); + memset(bufferAux, 0, sizeof(float) * FRAME_BUFFER_SIZE); + float tmpL[FRAME_BUFFER_SIZE]; + float tmpR[FRAME_BUFFER_SIZE]; + + for (int i = 0; i < inst_count; i++) + { + if (!(*__multi_trigs_mask & (1 << i))) + continue; + + if (engine::trig() & (1 << i) || _midi_trigs & (1 << i)) + { + _t[i] = 0; + drum_synth_reset(_inst[i]); + } + + if (_t[i] < UINT16_MAX) + { + DrumParams params = {_t[i], 0, stretch, stereo}; + + float f = pitch; // powf(2.f, engine::cv()); + float a = stereo; + float b = 1.f - a; + + params.levelL = engine::mixLevelL(i); + params.levelR = engine::mixLevelR(i); + + drum_synth_process_frame(_inst[i], -1, f, ¶ms, buffer, bufferAux, FRAME_BUFFER_SIZE); + + _t[i] += FRAME_BUFFER_SIZE; + } + } +} + +void engine::draw() +{ +} + +void engine::onMidiNote(uint8_t key, uint8_t velocity) // NoteOff: velocity == 0 +{ + if (velocity > 0) + { + switch (key) + { + case 35: // BD0 + _midi_trigs |= (1 << 0); + break; + case 36: // BD1 + _midi_trigs |= (1 << 1); + break; + case 38: // SD0 + _midi_trigs |= (1 << 2); + break; + case 40: // SD1 + _midi_trigs |= (1 << 3); + break; + case 39: // CP + _midi_trigs |= (1 << 4); + break; + case 54: // TMB + _midi_trigs |= (1 << 5); + break; + case 37: // RM + _midi_trigs |= (1 << 6); + break; + case 56: // CB + _midi_trigs |= (1 << 7); + break; + case 41: // LT + case 43: // LT + _midi_trigs |= (1 << 8); + break; + case 45: // MT + case 47: // MT + _midi_trigs |= (1 << 9); + break; + case 48: // HT + case 50: // HT + _midi_trigs |= (1 << 10); + break; + case 42: // CH + case 44: // CH + case 46: // OH + _midi_trigs |= (1 << 11); + break; + } + + *__multi_trigs_mask |= _midi_trigs; + } + else + { + } +} + +void engine::onMidiPitchbend(int16_t pitch) +{ +} + +void engine::onMidiCC(uint8_t ccc, uint8_t value) +{ + // nothing implemented.. +} + +void engine::onMidiSysex(uint8_t byte) +{ +} + +#include "../../lib/drumsynth/drumsynth.cpp" +#include "../../lib/plaits/resources.cc" +#include "../../lib/misc/Biquad.cpp" diff --git a/app/DRUMS/resources/braids_lut_env.hpp b/app/DRUMS/resources/braids_lut_env.hpp deleted file mode 100644 index 83a20bf..0000000 --- a/app/DRUMS/resources/braids_lut_env.hpp +++ /dev/null @@ -1,105 +0,0 @@ -namespace braids { - const uint16_t lut_env_expo[] FLASHMEM = { - 0, 1034, 2053, 3057, - 4044, 5016, 5974, 6916, - 7844, 8757, 9656, 10542, - 11413, 12271, 13116, 13948, - 14766, 15572, 16366, 17147, - 17916, 18673, 19419, 20153, - 20875, 21587, 22287, 22976, - 23655, 24323, 24981, 25629, - 26267, 26894, 27512, 28121, - 28720, 29310, 29890, 30462, - 31024, 31578, 32124, 32661, - 33189, 33710, 34222, 34727, - 35223, 35712, 36193, 36667, - 37134, 37593, 38045, 38490, - 38928, 39360, 39785, 40203, - 40615, 41020, 41419, 41812, - 42198, 42579, 42954, 43323, - 43686, 44044, 44396, 44743, - 45084, 45420, 45751, 46077, - 46397, 46713, 47024, 47330, - 47631, 47927, 48219, 48507, - 48790, 49068, 49342, 49612, - 49878, 50140, 50398, 50651, - 50901, 51147, 51389, 51627, - 51862, 52092, 52320, 52544, - 52764, 52981, 53195, 53405, - 53612, 53816, 54016, 54214, - 54408, 54600, 54788, 54974, - 55156, 55336, 55513, 55688, - 55859, 56028, 56195, 56358, - 56520, 56678, 56835, 56988, - 57140, 57289, 57436, 57580, - 57723, 57863, 58001, 58136, - 58270, 58402, 58531, 58659, - 58784, 58908, 59029, 59149, - 59267, 59383, 59498, 59610, - 59721, 59830, 59937, 60043, - 60147, 60250, 60351, 60450, - 60548, 60644, 60739, 60832, - 60924, 61014, 61103, 61191, - 61277, 61362, 61446, 61528, - 61609, 61689, 61768, 61845, - 61921, 61996, 62070, 62143, - 62214, 62285, 62354, 62422, - 62490, 62556, 62621, 62685, - 62748, 62810, 62871, 62932, - 62991, 63049, 63107, 63163, - 63219, 63274, 63328, 63381, - 63434, 63485, 63536, 63586, - 63635, 63683, 63731, 63778, - 63824, 63870, 63914, 63958, - 64002, 64045, 64087, 64128, - 64169, 64209, 64248, 64287, - 64326, 64363, 64400, 64437, - 64473, 64508, 64543, 64577, - 64611, 64645, 64677, 64710, - 64741, 64773, 64803, 64834, - 64863, 64893, 64922, 64950, - 64978, 65006, 65033, 65060, - 65086, 65112, 65137, 65162, - 65187, 65212, 65236, 65259, - 65282, 65305, 65328, 65350, - 65372, 65393, 65414, 65435, - 65456, 65476, 65496, 65515, - 65535, -}; - -const uint32_t lut_env_portamento_increments[] FLASHMEM = { - 1431655765, 1208633567, 1025339217, 873854034, - 747996982, 642910145, 554750639, 480459775, - 417588783, 364166300, 318596895, 279582889, - 246063710, 217168604, 192179528, 170501890, - 151641346, 135185326, 120788231, 108159539, - 97054201, 87264844, 78615425, 70956050, - 64158714, 58113796, 52727166, 47917783, - 43615697, 39760385, 36299356, 33186980, - 30383504, 27854220, 25568762, 23500507, - 21626072, 19924877, 18378778, 16971748, - 15689604, 14519780, 13451115, 12473688, - 11578663, 10758156, 10005128, 9313280, - 8676970, 8091136, 7551232, 7053169, - 6593263, 6168194, 5774964, 5410864, - 5073442, 4760475, 4469950, 4200037, - 3949073, 3715547, 3498079, 3295415, - 3106409, 2930012, 2765269, 2611303, - 2467313, 2332562, 2206377, 2088136, - 1977272, 1873260, 1775618, 1683902, - 1597702, 1516641, 1440370, 1368566, - 1300932, 1237191, 1177088, 1120388, - 1066869, 1016330, 968580, 923445, - 880761, 840376, 802150, 765951, - 731657, 699152, 668331, 639094, - 611349, 585008, 559991, 536221, - 513628, 492146, 471711, 452267, - 433757, 416131, 399341, 383341, - 368089, 353545, 339672, 326434, - 313798, 301733, 290209, 279199, - 268677, 258617, 248997, 239795, - 230990, 222562, 214494, 206767, - 199365, 192272, 185474, 178956, -}; - -} \ No newline at end of file diff --git a/app/DRUMS/resources/peaks_lut_env.hpp b/app/DRUMS/resources/peaks_lut_env.hpp deleted file mode 100644 index 4825475..0000000 --- a/app/DRUMS/resources/peaks_lut_env.hpp +++ /dev/null @@ -1,271 +0,0 @@ -namespace peaks { -const uint16_t lut_env_linear[] FLASHMEM = { - 0, 257, 514, 771, - 1028, 1285, 1542, 1799, - 2056, 2313, 2570, 2827, - 3084, 3341, 3598, 3855, - 4112, 4369, 4626, 4883, - 5140, 5397, 5654, 5911, - 6168, 6425, 6682, 6939, - 7196, 7453, 7710, 7967, - 8224, 8481, 8738, 8995, - 9252, 9509, 9766, 10023, - 10280, 10537, 10794, 11051, - 11308, 11565, 11822, 12079, - 12336, 12593, 12850, 13107, - 13364, 13621, 13878, 14135, - 14392, 14649, 14906, 15163, - 15420, 15677, 15934, 16191, - 16448, 16705, 16962, 17219, - 17476, 17733, 17990, 18247, - 18504, 18761, 19018, 19275, - 19532, 19789, 20046, 20303, - 20560, 20817, 21074, 21331, - 21588, 21845, 22102, 22359, - 22616, 22873, 23130, 23387, - 23644, 23901, 24158, 24415, - 24672, 24929, 25186, 25443, - 25700, 25957, 26214, 26471, - 26728, 26985, 27242, 27499, - 27756, 28013, 28270, 28527, - 28784, 29041, 29298, 29555, - 29812, 30069, 30326, 30583, - 30840, 31097, 31354, 31611, - 31868, 32125, 32382, 32639, - 32896, 33153, 33410, 33667, - 33924, 34181, 34438, 34695, - 34952, 35209, 35466, 35723, - 35980, 36237, 36494, 36751, - 37008, 37265, 37522, 37779, - 38036, 38293, 38550, 38807, - 39064, 39321, 39578, 39835, - 40092, 40349, 40606, 40863, - 41120, 41377, 41634, 41891, - 42148, 42405, 42662, 42919, - 43176, 43433, 43690, 43947, - 44204, 44461, 44718, 44975, - 45232, 45489, 45746, 46003, - 46260, 46517, 46774, 47031, - 47288, 47545, 47802, 48059, - 48316, 48573, 48830, 49087, - 49344, 49601, 49858, 50115, - 50372, 50629, 50886, 51143, - 51400, 51657, 51914, 52171, - 52428, 52685, 52942, 53199, - 53456, 53713, 53970, 54227, - 54484, 54741, 54998, 55255, - 55512, 55769, 56026, 56283, - 56540, 56797, 57054, 57311, - 57568, 57825, 58082, 58339, - 58596, 58853, 59110, 59367, - 59624, 59881, 60138, 60395, - 60652, 60909, 61166, 61423, - 61680, 61937, 62194, 62451, - 62708, 62965, 63222, 63479, - 63736, 63993, 64250, 64507, - 64764, 65021, 65278, 65535, - 65535, -}; -const uint16_t lut_env_expo[] FLASHMEM = { - 0, 1035, 2054, 3057, - 4045, 5018, 5975, 6918, - 7846, 8760, 9659, 10545, - 11416, 12275, 13120, 13952, - 14771, 15577, 16371, 17152, - 17921, 18679, 19425, 20159, - 20881, 21593, 22294, 22983, - 23662, 24331, 24989, 25637, - 26274, 26902, 27520, 28129, - 28728, 29318, 29899, 30471, - 31034, 31588, 32133, 32670, - 33199, 33720, 34232, 34737, - 35233, 35722, 36204, 36678, - 37145, 37604, 38056, 38502, - 38940, 39371, 39796, 40215, - 40626, 41032, 41431, 41824, - 42211, 42592, 42967, 43336, - 43699, 44057, 44409, 44756, - 45097, 45434, 45764, 46090, - 46411, 46727, 47037, 47344, - 47645, 47941, 48233, 48521, - 48804, 49083, 49357, 49627, - 49893, 50155, 50412, 50666, - 50916, 51162, 51404, 51642, - 51877, 52108, 52335, 52559, - 52780, 52997, 53210, 53421, - 53628, 53831, 54032, 54230, - 54424, 54616, 54804, 54990, - 55173, 55353, 55530, 55704, - 55876, 56045, 56211, 56375, - 56536, 56695, 56851, 57005, - 57157, 57306, 57453, 57597, - 57740, 57880, 58018, 58153, - 58287, 58419, 58548, 58676, - 58801, 58925, 59047, 59167, - 59285, 59401, 59515, 59628, - 59739, 59848, 59955, 60061, - 60165, 60267, 60368, 60468, - 60566, 60662, 60757, 60850, - 60942, 61032, 61121, 61209, - 61295, 61380, 61464, 61546, - 61628, 61707, 61786, 61863, - 61939, 62014, 62088, 62161, - 62233, 62303, 62372, 62441, - 62508, 62574, 62639, 62703, - 62767, 62829, 62890, 62950, - 63010, 63068, 63125, 63182, - 63238, 63293, 63347, 63400, - 63452, 63504, 63554, 63604, - 63654, 63702, 63750, 63797, - 63843, 63888, 63933, 63977, - 64021, 64063, 64105, 64147, - 64188, 64228, 64267, 64306, - 64344, 64382, 64419, 64456, - 64492, 64527, 64562, 64596, - 64630, 64664, 64696, 64729, - 64760, 64792, 64822, 64853, - 64883, 64912, 64941, 64969, - 64997, 65025, 65052, 65079, - 65105, 65131, 65157, 65182, - 65206, 65231, 65255, 65278, - 65302, 65324, 65347, 65369, - 65391, 65412, 65434, 65454, - 65475, 65495, 65515, 65535, - 65535, -}; -const uint16_t lut_env_quartic[] FLASHMEM = { - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 1, 1, - 2, 3, 4, 5, - 6, 8, 9, 11, - 14, 16, 19, 22, - 25, 29, 33, 37, - 42, 48, 53, 59, - 66, 73, 81, 89, - 98, 107, 117, 128, - 139, 151, 164, 177, - 191, 206, 222, 238, - 256, 274, 293, 313, - 334, 355, 378, 402, - 427, 453, 480, 508, - 537, 567, 599, 631, - 665, 700, 737, 775, - 814, 854, 896, 939, - 984, 1030, 1077, 1127, - 1177, 1230, 1283, 1339, - 1396, 1455, 1515, 1577, - 1641, 1707, 1775, 1844, - 1916, 1989, 2064, 2141, - 2220, 2302, 2385, 2470, - 2557, 2647, 2739, 2833, - 2929, 3027, 3128, 3231, - 3336, 3444, 3554, 3667, - 3782, 3899, 4019, 4142, - 4267, 4395, 4525, 4658, - 4794, 4933, 5074, 5218, - 5365, 5515, 5668, 5824, - 5983, 6144, 6309, 6477, - 6648, 6822, 6999, 7179, - 7363, 7550, 7740, 7933, - 8130, 8330, 8534, 8741, - 8951, 9165, 9383, 9604, - 9829, 10057, 10289, 10525, - 10765, 11008, 11255, 11507, - 11761, 12020, 12283, 12550, - 12821, 13096, 13375, 13658, - 13945, 14237, 14532, 14832, - 15137, 15445, 15758, 16076, - 16397, 16724, 17054, 17390, - 17730, 18074, 18423, 18777, - 19136, 19499, 19868, 20241, - 20618, 21001, 21389, 21781, - 22179, 22582, 22990, 23403, - 23821, 24244, 24672, 25106, - 25545, 25990, 26440, 26895, - 27355, 27821, 28293, 28770, - 29253, 29742, 30236, 30735, - 31241, 31752, 32270, 32793, - 33321, 33856, 34397, 34944, - 35497, 36056, 36621, 37192, - 37769, 38353, 38943, 39539, - 40142, 40751, 41366, 41988, - 42617, 43251, 43893, 44541, - 45196, 45857, 46526, 47201, - 47882, 48571, 49267, 49969, - 50678, 51395, 52118, 52849, - 53587, 54332, 55084, 55843, - 56610, 57384, 58165, 58954, - 59750, 60553, 61364, 62183, - 63010, 63843, 64685, 65535, - 65535, -}; - -const uint32_t lut_env_increments[] FLASHMEM = { - 178956970, 162203921, 147263779, 133914742, - 121965179, 111249129, 101622525, 92960022, - 85152324, 78103929, 71731214, 65960813, - 60728233, 55976673, 51656020, 47721976, - 44135321, 40861270, 37868923, 35130786, - 32622357, 30321772, 28209484, 26268003, - 24481648, 22836346, 21319451, 19919582, - 18626484, 17430905, 16324491, 15299685, - 14349647, 13468178, 12649652, 11888959, - 11181454, 10522909, 9909470, 9337624, - 8804164, 8306157, 7840925, 7406012, - 6999170, 6618338, 6261623, 5927288, - 5613733, 5319488, 5043200, 4783621, - 4539601, 4310076, 4094068, 3890668, - 3699040, 3518407, 3348049, 3187303, - 3035548, 2892213, 2756766, 2628711, - 2507588, 2392971, 2284460, 2181685, - 2084301, 1991984, 1904435, 1821372, - 1742534, 1667676, 1596567, 1528995, - 1464759, 1403670, 1345553, 1290243, - 1237585, 1187435, 1139655, 1094119, - 1050706, 1009303, 969803, 932108, - 896122, 861758, 828932, 797565, - 767584, 738918, 711503, 685274, - 660174, 636148, 613143, 591109, - 569999, 549770, 530379, 511787, - 493956, 476850, 460436, 444683, - 429558, 415035, 401085, 387683, - 374804, 362424, 350523, 339078, - 328069, 317479, 307287, 297478, - 288035, 278942, 270184, 261748, - 253620, 245786, 238236, 230956, - 223936, 217166, 210635, 204334, - 198253, 192383, 186717, 181245, - 175961, 170858, 165927, 161162, - 156558, 152107, 147805, 143644, - 139621, 135729, 131964, 128321, - 124796, 121384, 118081, 114883, - 111787, 108788, 105883, 103069, - 100343, 97700, 95139, 92657, - 90250, 87917, 85654, 83459, - 81330, 79265, 77261, 75316, - 73428, 71596, 69817, 68090, - 66413, 64784, 63202, 61666, - 60173, 58722, 57312, 55942, - 54610, 53315, 52056, 50832, - 49641, 48484, 47357, 46262, - 45196, 44159, 43149, 42167, - 41211, 40280, 39374, 38492, - 37632, 36796, 35981, 35187, - 34414, 33660, 32926, 32211, - 31513, 30834, 30172, 29526, - 28896, 28282, 27684, 27100, - 26531, 25975, 25434, 24905, - 24390, 23886, 23395, 22916, - 22449, 21992, 21546, 21111, - 20687, 20272, 19867, 19471, - 19085, 18708, 18339, 17979, - 17627, 17283, 16947, 16619, - 16298, 15985, 15678, 15378, - 15085, 14799, 14519, 14245, - 13977, 13716, 13459, 13209, - 12964, 12724, 12490, 12260, - 12036, 11816, 11601, 11390, - 11184, -}; -} \ No newline at end of file diff --git a/app/DRUMS/resources/peaks_lut_osc.hpp b/app/DRUMS/resources/peaks_lut_osc.hpp deleted file mode 100644 index 90c2822..0000000 --- a/app/DRUMS/resources/peaks_lut_osc.hpp +++ /dev/null @@ -1,548 +0,0 @@ -namespace peaks { -const int16_t wav_sine[] FLASHMEM = { - 0, 201, 402, 603, - 804, 1005, 1206, 1406, - 1607, 1808, 2009, 2209, - 2410, 2610, 2811, 3011, - 3211, 3411, 3611, 3811, - 4011, 4210, 4409, 4608, - 4807, 5006, 5205, 5403, - 5601, 5799, 5997, 6195, - 6392, 6589, 6786, 6982, - 7179, 7375, 7571, 7766, - 7961, 8156, 8351, 8545, - 8739, 8932, 9126, 9319, - 9511, 9703, 9895, 10087, - 10278, 10469, 10659, 10849, - 11038, 11227, 11416, 11604, - 11792, 11980, 12166, 12353, - 12539, 12724, 12909, 13094, - 13278, 13462, 13645, 13827, - 14009, 14191, 14372, 14552, - 14732, 14911, 15090, 15268, - 15446, 15623, 15799, 15975, - 16150, 16325, 16499, 16672, - 16845, 17017, 17189, 17360, - 17530, 17699, 17868, 18036, - 18204, 18371, 18537, 18702, - 18867, 19031, 19194, 19357, - 19519, 19680, 19840, 20000, - 20159, 20317, 20474, 20631, - 20787, 20942, 21096, 21249, - 21402, 21554, 21705, 21855, - 22004, 22153, 22301, 22448, - 22594, 22739, 22883, 23027, - 23169, 23311, 23452, 23592, - 23731, 23869, 24006, 24143, - 24278, 24413, 24546, 24679, - 24811, 24942, 25072, 25201, - 25329, 25456, 25582, 25707, - 25831, 25954, 26077, 26198, - 26318, 26437, 26556, 26673, - 26789, 26905, 27019, 27132, - 27244, 27355, 27466, 27575, - 27683, 27790, 27896, 28001, - 28105, 28208, 28309, 28410, - 28510, 28608, 28706, 28802, - 28897, 28992, 29085, 29177, - 29268, 29358, 29446, 29534, - 29621, 29706, 29790, 29873, - 29955, 30036, 30116, 30195, - 30272, 30349, 30424, 30498, - 30571, 30643, 30713, 30783, - 30851, 30918, 30984, 31049, - 31113, 31175, 31236, 31297, - 31356, 31413, 31470, 31525, - 31580, 31633, 31684, 31735, - 31785, 31833, 31880, 31926, - 31970, 32014, 32056, 32097, - 32137, 32176, 32213, 32249, - 32284, 32318, 32350, 32382, - 32412, 32441, 32468, 32495, - 32520, 32544, 32567, 32588, - 32609, 32628, 32646, 32662, - 32678, 32692, 32705, 32717, - 32727, 32736, 32744, 32751, - 32757, 32761, 32764, 32766, - 32767, 32766, 32764, 32761, - 32757, 32751, 32744, 32736, - 32727, 32717, 32705, 32692, - 32678, 32662, 32646, 32628, - 32609, 32588, 32567, 32544, - 32520, 32495, 32468, 32441, - 32412, 32382, 32350, 32318, - 32284, 32249, 32213, 32176, - 32137, 32097, 32056, 32014, - 31970, 31926, 31880, 31833, - 31785, 31735, 31684, 31633, - 31580, 31525, 31470, 31413, - 31356, 31297, 31236, 31175, - 31113, 31049, 30984, 30918, - 30851, 30783, 30713, 30643, - 30571, 30498, 30424, 30349, - 30272, 30195, 30116, 30036, - 29955, 29873, 29790, 29706, - 29621, 29534, 29446, 29358, - 29268, 29177, 29085, 28992, - 28897, 28802, 28706, 28608, - 28510, 28410, 28309, 28208, - 28105, 28001, 27896, 27790, - 27683, 27575, 27466, 27355, - 27244, 27132, 27019, 26905, - 26789, 26673, 26556, 26437, - 26318, 26198, 26077, 25954, - 25831, 25707, 25582, 25456, - 25329, 25201, 25072, 24942, - 24811, 24679, 24546, 24413, - 24278, 24143, 24006, 23869, - 23731, 23592, 23452, 23311, - 23169, 23027, 22883, 22739, - 22594, 22448, 22301, 22153, - 22004, 21855, 21705, 21554, - 21402, 21249, 21096, 20942, - 20787, 20631, 20474, 20317, - 20159, 20000, 19840, 19680, - 19519, 19357, 19194, 19031, - 18867, 18702, 18537, 18371, - 18204, 18036, 17868, 17699, - 17530, 17360, 17189, 17017, - 16845, 16672, 16499, 16325, - 16150, 15975, 15799, 15623, - 15446, 15268, 15090, 14911, - 14732, 14552, 14372, 14191, - 14009, 13827, 13645, 13462, - 13278, 13094, 12909, 12724, - 12539, 12353, 12166, 11980, - 11792, 11604, 11416, 11227, - 11038, 10849, 10659, 10469, - 10278, 10087, 9895, 9703, - 9511, 9319, 9126, 8932, - 8739, 8545, 8351, 8156, - 7961, 7766, 7571, 7375, - 7179, 6982, 6786, 6589, - 6392, 6195, 5997, 5799, - 5601, 5403, 5205, 5006, - 4807, 4608, 4409, 4210, - 4011, 3811, 3611, 3411, - 3211, 3011, 2811, 2610, - 2410, 2209, 2009, 1808, - 1607, 1406, 1206, 1005, - 804, 603, 402, 201, - 0, -201, -402, -603, - -804, -1005, -1206, -1406, - -1607, -1808, -2009, -2209, - -2410, -2610, -2811, -3011, - -3211, -3411, -3611, -3811, - -4011, -4210, -4409, -4608, - -4807, -5006, -5205, -5403, - -5601, -5799, -5997, -6195, - -6392, -6589, -6786, -6982, - -7179, -7375, -7571, -7766, - -7961, -8156, -8351, -8545, - -8739, -8932, -9126, -9319, - -9511, -9703, -9895, -10087, - -10278, -10469, -10659, -10849, - -11038, -11227, -11416, -11604, - -11792, -11980, -12166, -12353, - -12539, -12724, -12909, -13094, - -13278, -13462, -13645, -13827, - -14009, -14191, -14372, -14552, - -14732, -14911, -15090, -15268, - -15446, -15623, -15799, -15975, - -16150, -16325, -16499, -16672, - -16845, -17017, -17189, -17360, - -17530, -17699, -17868, -18036, - -18204, -18371, -18537, -18702, - -18867, -19031, -19194, -19357, - -19519, -19680, -19840, -20000, - -20159, -20317, -20474, -20631, - -20787, -20942, -21096, -21249, - -21402, -21554, -21705, -21855, - -22004, -22153, -22301, -22448, - -22594, -22739, -22883, -23027, - -23169, -23311, -23452, -23592, - -23731, -23869, -24006, -24143, - -24278, -24413, -24546, -24679, - -24811, -24942, -25072, -25201, - -25329, -25456, -25582, -25707, - -25831, -25954, -26077, -26198, - -26318, -26437, -26556, -26673, - -26789, -26905, -27019, -27132, - -27244, -27355, -27466, -27575, - -27683, -27790, -27896, -28001, - -28105, -28208, -28309, -28410, - -28510, -28608, -28706, -28802, - -28897, -28992, -29085, -29177, - -29268, -29358, -29446, -29534, - -29621, -29706, -29790, -29873, - -29955, -30036, -30116, -30195, - -30272, -30349, -30424, -30498, - -30571, -30643, -30713, -30783, - -30851, -30918, -30984, -31049, - -31113, -31175, -31236, -31297, - -31356, -31413, -31470, -31525, - -31580, -31633, -31684, -31735, - -31785, -31833, -31880, -31926, - -31970, -32014, -32056, -32097, - -32137, -32176, -32213, -32249, - -32284, -32318, -32350, -32382, - -32412, -32441, -32468, -32495, - -32520, -32544, -32567, -32588, - -32609, -32628, -32646, -32662, - -32678, -32692, -32705, -32717, - -32727, -32736, -32744, -32751, - -32757, -32761, -32764, -32766, - -32767, -32766, -32764, -32761, - -32757, -32751, -32744, -32736, - -32727, -32717, -32705, -32692, - -32678, -32662, -32646, -32628, - -32609, -32588, -32567, -32544, - -32520, -32495, -32468, -32441, - -32412, -32382, -32350, -32318, - -32284, -32249, -32213, -32176, - -32137, -32097, -32056, -32014, - -31970, -31926, -31880, -31833, - -31785, -31735, -31684, -31633, - -31580, -31525, -31470, -31413, - -31356, -31297, -31236, -31175, - -31113, -31049, -30984, -30918, - -30851, -30783, -30713, -30643, - -30571, -30498, -30424, -30349, - -30272, -30195, -30116, -30036, - -29955, -29873, -29790, -29706, - -29621, -29534, -29446, -29358, - -29268, -29177, -29085, -28992, - -28897, -28802, -28706, -28608, - -28510, -28410, -28309, -28208, - -28105, -28001, -27896, -27790, - -27683, -27575, -27466, -27355, - -27244, -27132, -27019, -26905, - -26789, -26673, -26556, -26437, - -26318, -26198, -26077, -25954, - -25831, -25707, -25582, -25456, - -25329, -25201, -25072, -24942, - -24811, -24679, -24546, -24413, - -24278, -24143, -24006, -23869, - -23731, -23592, -23452, -23311, - -23169, -23027, -22883, -22739, - -22594, -22448, -22301, -22153, - -22004, -21855, -21705, -21554, - -21402, -21249, -21096, -20942, - -20787, -20631, -20474, -20317, - -20159, -20000, -19840, -19680, - -19519, -19357, -19194, -19031, - -18867, -18702, -18537, -18371, - -18204, -18036, -17868, -17699, - -17530, -17360, -17189, -17017, - -16845, -16672, -16499, -16325, - -16150, -15975, -15799, -15623, - -15446, -15268, -15090, -14911, - -14732, -14552, -14372, -14191, - -14009, -13827, -13645, -13462, - -13278, -13094, -12909, -12724, - -12539, -12353, -12166, -11980, - -11792, -11604, -11416, -11227, - -11038, -10849, -10659, -10469, - -10278, -10087, -9895, -9703, - -9511, -9319, -9126, -8932, - -8739, -8545, -8351, -8156, - -7961, -7766, -7571, -7375, - -7179, -6982, -6786, -6589, - -6392, -6195, -5997, -5799, - -5601, -5403, -5205, -5006, - -4807, -4608, -4409, -4210, - -4011, -3811, -3611, -3411, - -3211, -3011, -2811, -2610, - -2410, -2209, -2009, -1808, - -1607, -1406, -1206, -1005, - -804, -603, -402, -201, - 0, -}; - -const uint32_t lut_oscillator_increments[] FLASHMEM = { - 594570139, 598878640, 603218361, 607589530, - 611992374, 616427123, 620894008, 625393262, - 629925120, 634489817, 639087591, 643718683, - 648383334, 653081787, 657814287, 662581081, - 667382416, 672218544, 677089717, 681996188, - 686938214, 691916051, 696929960, 701980202, - 707067040, 712190739, 717351567, 722549792, - 727785686, 733059521, 738371572, 743722117, - 749111434, 754539804, 760007511, 765514839, - 771062075, 776649508, 782277431, 787946136, - 793655918, 799407076, 805199909, 811034720, - 816911812, 822831491, 828794068, 834799851, - 840849155, 846942294, 853079587, 859261354, - 865487916, 871759598, 878076727, 884439633, - 890848647, 897304104, 903806339, 910355693, - 916952505, 923597121, 930289887, 937031151, - 943821265, 950660583, 957549461, 964488259, - 971477339, 978517064, 985607802, 992749922, - 999943798, 1007189803, 1014488315, 1021839716, - 1029244387, 1036702717, 1044215092, 1051781905, - 1059403550, 1067080425, 1074812930, 1082601467, - 1090446444, 1098348268, 1106307352, 1114324111, - 1122398963, 1130532329, 1138724632, 1146976300, - 1155287763, 1163659455, 1172091811, 1180585271, - 1189140279, -}; -const int16_t wav_overdrive[] FLASHMEM = { - -32767, -32767, -32767, -32767, - -32767, -32767, -32767, -32767, - -32766, -32766, -32766, -32766, - -32766, -32766, -32766, -32766, - -32766, -32766, -32766, -32766, - -32766, -32765, -32765, -32765, - -32765, -32765, -32765, -32765, - -32765, -32765, -32765, -32765, - -32764, -32764, -32764, -32764, - -32764, -32764, -32764, -32764, - -32763, -32763, -32763, -32763, - -32763, -32763, -32763, -32763, - -32762, -32762, -32762, -32762, - -32762, -32762, -32761, -32761, - -32761, -32761, -32761, -32761, - -32760, -32760, -32760, -32760, - -32760, -32759, -32759, -32759, - -32759, -32759, -32758, -32758, - -32758, -32758, -32757, -32757, - -32757, -32757, -32756, -32756, - -32756, -32756, -32755, -32755, - -32755, -32754, -32754, -32754, - -32753, -32753, -32753, -32752, - -32752, -32752, -32751, -32751, - -32751, -32750, -32750, -32749, - -32749, -32749, -32748, -32748, - -32747, -32747, -32746, -32746, - -32745, -32745, -32744, -32744, - -32743, -32743, -32742, -32742, - -32741, -32741, -32740, -32740, - -32739, -32738, -32738, -32737, - -32736, -32736, -32735, -32734, - -32734, -32733, -32732, -32732, - -32731, -32730, -32729, -32728, - -32728, -32727, -32726, -32725, - -32724, -32723, -32722, -32721, - -32720, -32719, -32718, -32717, - -32716, -32715, -32714, -32713, - -32712, -32711, -32710, -32709, - -32707, -32706, -32705, -32704, - -32702, -32701, -32700, -32698, - -32697, -32695, -32694, -32692, - -32691, -32689, -32688, -32686, - -32684, -32683, -32681, -32679, - -32678, -32676, -32674, -32672, - -32670, -32668, -32666, -32664, - -32662, -32660, -32658, -32655, - -32653, -32651, -32649, -32646, - -32644, -32641, -32639, -32636, - -32633, -32631, -32628, -32625, - -32622, -32619, -32617, -32614, - -32610, -32607, -32604, -32601, - -32597, -32594, -32591, -32587, - -32584, -32580, -32576, -32572, - -32568, -32564, -32560, -32556, - -32552, -32548, -32543, -32539, - -32534, -32530, -32525, -32520, - -32515, -32510, -32505, -32500, - -32495, -32489, -32484, -32478, - -32473, -32467, -32461, -32455, - -32448, -32442, -32436, -32429, - -32422, -32416, -32409, -32402, - -32394, -32387, -32380, -32372, - -32364, -32356, -32348, -32340, - -32331, -32323, -32314, -32305, - -32296, -32287, -32277, -32268, - -32258, -32248, -32237, -32227, - -32216, -32206, -32195, -32183, - -32172, -32160, -32148, -32136, - -32124, -32111, -32098, -32085, - -32072, -32058, -32044, -32030, - -32016, -32001, -31986, -31971, - -31955, -31939, -31923, -31907, - -31890, -31873, -31855, -31838, - -31819, -31801, -31782, -31763, - -31743, -31723, -31703, -31682, - -31661, -31640, -31618, -31596, - -31573, -31550, -31526, -31502, - -31478, -31453, -31427, -31401, - -31375, -31348, -31320, -31293, - -31264, -31235, -31205, -31175, - -31145, -31113, -31082, -31049, - -31016, -30983, -30948, -30913, - -30878, -30842, -30805, -30767, - -30729, -30690, -30650, -30610, - -30569, -30527, -30484, -30440, - -30396, -30351, -30305, -30258, - -30211, -30162, -30113, -30063, - -30012, -29959, -29906, -29853, - -29798, -29742, -29685, -29627, - -29568, -29508, -29447, -29385, - -29321, -29257, -29191, -29125, - -29057, -28988, -28918, -28846, - -28774, -28700, -28625, -28548, - -28470, -28391, -28311, -28229, - -28146, -28061, -27975, -27887, - -27798, -27708, -27616, -27522, - -27427, -27331, -27232, -27132, - -27031, -26928, -26823, -26717, - -26609, -26499, -26387, -26274, - -26158, -26041, -25923, -25802, - -25679, -25555, -25428, -25300, - -25170, -25038, -24904, -24767, - -24629, -24489, -24346, -24202, - -24056, -23907, -23756, -23603, - -23448, -23291, -23131, -22970, - -22806, -22640, -22471, -22301, - -22128, -21952, -21775, -21595, - -21413, -21228, -21041, -20852, - -20660, -20466, -20270, -20071, - -19870, -19666, -19460, -19252, - -19041, -18828, -18613, -18395, - -18174, -17951, -17726, -17499, - -17269, -17036, -16802, -16565, - -16325, -16083, -15839, -15593, - -15344, -15093, -14840, -14584, - -14327, -14067, -13805, -13540, - -13274, -13005, -12735, -12462, - -12187, -11910, -11632, -11351, - -11068, -10784, -10498, -10210, - -9920, -9628, -9335, -9040, - -8744, -8446, -8146, -7845, - -7543, -7239, -6934, -6628, - -6320, -6012, -5702, -5391, - -5079, -4766, -4453, -4138, - -3823, -3507, -3190, -2873, - -2555, -2237, -1918, -1599, - -1279, -960, -640, -320, - 0, 320, 640, 960, - 1279, 1599, 1918, 2237, - 2555, 2873, 3190, 3507, - 3823, 4138, 4453, 4766, - 5079, 5391, 5702, 6012, - 6320, 6628, 6934, 7239, - 7543, 7845, 8146, 8446, - 8744, 9040, 9335, 9628, - 9920, 10210, 10498, 10784, - 11068, 11351, 11632, 11910, - 12187, 12462, 12735, 13005, - 13274, 13540, 13805, 14067, - 14327, 14584, 14840, 15093, - 15344, 15593, 15839, 16083, - 16325, 16565, 16802, 17036, - 17269, 17499, 17726, 17951, - 18174, 18395, 18613, 18828, - 19041, 19252, 19460, 19666, - 19870, 20071, 20270, 20466, - 20660, 20852, 21041, 21228, - 21413, 21595, 21775, 21952, - 22128, 22301, 22471, 22640, - 22806, 22970, 23131, 23291, - 23448, 23603, 23756, 23907, - 24056, 24202, 24346, 24489, - 24629, 24767, 24904, 25038, - 25170, 25300, 25428, 25555, - 25679, 25802, 25923, 26041, - 26158, 26274, 26387, 26499, - 26609, 26717, 26823, 26928, - 27031, 27132, 27232, 27331, - 27427, 27522, 27616, 27708, - 27798, 27887, 27975, 28061, - 28146, 28229, 28311, 28391, - 28470, 28548, 28625, 28700, - 28774, 28846, 28918, 28988, - 29057, 29125, 29191, 29257, - 29321, 29385, 29447, 29508, - 29568, 29627, 29685, 29742, - 29798, 29853, 29906, 29959, - 30012, 30063, 30113, 30162, - 30211, 30258, 30305, 30351, - 30396, 30440, 30484, 30527, - 30569, 30610, 30650, 30690, - 30729, 30767, 30805, 30842, - 30878, 30913, 30948, 30983, - 31016, 31049, 31082, 31113, - 31145, 31175, 31205, 31235, - 31264, 31293, 31320, 31348, - 31375, 31401, 31427, 31453, - 31478, 31502, 31526, 31550, - 31573, 31596, 31618, 31640, - 31661, 31682, 31703, 31723, - 31743, 31763, 31782, 31801, - 31819, 31838, 31855, 31873, - 31890, 31907, 31923, 31939, - 31955, 31971, 31986, 32001, - 32016, 32030, 32044, 32058, - 32072, 32085, 32098, 32111, - 32124, 32136, 32148, 32160, - 32172, 32183, 32195, 32206, - 32216, 32227, 32237, 32248, - 32258, 32268, 32277, 32287, - 32296, 32305, 32314, 32323, - 32331, 32340, 32348, 32356, - 32364, 32372, 32380, 32387, - 32394, 32402, 32409, 32416, - 32422, 32429, 32436, 32442, - 32448, 32455, 32461, 32467, - 32473, 32478, 32484, 32489, - 32495, 32500, 32505, 32510, - 32515, 32520, 32525, 32530, - 32534, 32539, 32543, 32548, - 32552, 32556, 32560, 32564, - 32568, 32572, 32576, 32580, - 32584, 32587, 32591, 32594, - 32597, 32601, 32604, 32607, - 32610, 32614, 32617, 32619, - 32622, 32625, 32628, 32631, - 32633, 32636, 32639, 32641, - 32644, 32646, 32649, 32651, - 32653, 32655, 32658, 32660, - 32662, 32664, 32666, 32668, - 32670, 32672, 32674, 32676, - 32678, 32679, 32681, 32683, - 32684, 32686, 32688, 32689, - 32691, 32692, 32694, 32695, - 32697, 32698, 32700, 32701, - 32702, 32704, 32705, 32706, - 32707, 32709, 32710, 32711, - 32712, 32713, 32714, 32715, - 32716, 32717, 32718, 32719, - 32720, 32721, 32722, 32723, - 32724, 32725, 32726, 32727, - 32728, 32728, 32729, 32730, - 32731, 32732, 32732, 32733, - 32734, 32734, 32735, 32736, - 32736, 32737, 32738, 32738, - 32739, 32740, 32740, 32741, - 32741, 32742, 32742, 32743, - 32743, 32744, 32744, 32745, - 32745, 32746, 32746, 32747, - 32747, 32748, 32748, 32749, - 32749, 32749, 32750, 32750, - 32751, 32751, 32751, 32752, - 32752, 32752, 32753, 32753, - 32753, 32754, 32754, 32754, - 32755, 32755, 32755, 32756, - 32756, 32756, 32756, 32757, - 32757, 32757, 32757, 32758, - 32758, 32758, 32758, 32759, - 32759, 32759, 32759, 32759, - 32760, 32760, 32760, 32760, - 32760, 32761, 32761, 32761, - 32761, 32761, 32761, 32762, - 32762, 32762, 32762, 32762, - 32762, 32763, 32763, 32763, - 32763, 32763, 32763, 32763, - 32763, 32764, 32764, 32764, - 32764, 32764, 32764, 32764, - 32764, 32765, 32765, 32765, - 32765, 32765, 32765, 32765, - 32765, 32765, 32765, 32765, - 32766, 32766, 32766, 32766, - 32766, 32766, 32766, 32766, - 32766, 32766, 32766, 32766, - 32766, 32767, 32767, 32767, - 32767, 32767, 32767, 32767, - 32767, -}; -} \ No newline at end of file diff --git a/app/DRUMS/resources/peaks_lut_svf.hpp b/app/DRUMS/resources/peaks_lut_svf.hpp deleted file mode 100644 index d652143..0000000 --- a/app/DRUMS/resources/peaks_lut_svf.hpp +++ /dev/null @@ -1,203 +0,0 @@ -namespace peaks { - const uint16_t lut_svf_cutoff[] FLASHMEM = { - 35, 37, 39, 41, - 44, 46, 49, 52, - 55, 58, 62, 66, - 70, 74, 78, 83, - 88, 93, 99, 105, - 111, 117, 124, 132, - 140, 148, 157, 166, - 176, 187, 198, 210, - 222, 235, 249, 264, - 280, 297, 314, 333, - 353, 374, 396, 420, - 445, 471, 499, 529, - 561, 594, 629, 667, - 706, 748, 793, 840, - 890, 943, 999, 1059, - 1122, 1188, 1259, 1334, - 1413, 1497, 1586, 1681, - 1781, 1886, 1999, 2117, - 2243, 2377, 2518, 2668, - 2826, 2994, 3172, 3361, - 3560, 3772, 3996, 4233, - 4485, 4751, 5033, 5332, - 5648, 5983, 6337, 6713, - 7111, 7532, 7978, 8449, - 8949, 9477, 10037, 10628, - 11254, 11916, 12616, 13356, - 14138, 14964, 15837, 16758, - 17730, 18756, 19837, 20975, - 22174, 23435, 24761, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, 25078, 25078, 25078, - 25078, -}; -const uint16_t lut_svf_damp[] FLASHMEM = { - 65534, 49166, 46069, 43993, - 42386, 41058, 39917, 38910, - 38007, 37184, 36427, 35726, - 35070, 34454, 33873, 33322, - 32798, 32299, 31820, 31361, - 30920, 30496, 30086, 29690, - 29306, 28935, 28574, 28224, - 27883, 27551, 27228, 26912, - 26605, 26304, 26010, 25723, - 25441, 25166, 24896, 24631, - 24371, 24116, 23866, 23620, - 23379, 23141, 22908, 22678, - 22452, 22229, 22010, 21794, - 21581, 21371, 21164, 20960, - 20759, 20560, 20365, 20171, - 19980, 19791, 19605, 19421, - 19239, 19059, 18882, 18706, - 18532, 18360, 18190, 18022, - 17856, 17691, 17528, 17367, - 17207, 17049, 16892, 16737, - 16583, 16431, 16280, 16131, - 15982, 15836, 15690, 15546, - 15403, 15261, 15120, 14981, - 14843, 14705, 14569, 14434, - 14300, 14167, 14036, 13905, - 13775, 13646, 13518, 13391, - 13265, 13140, 13015, 12892, - 12769, 12648, 12527, 12407, - 12287, 12169, 12051, 11934, - 11818, 11703, 11588, 11474, - 11361, 11249, 11137, 11026, - 10915, 10805, 10696, 10588, - 10480, 10373, 10266, 10160, - 10055, 9950, 9846, 9742, - 9639, 9537, 9435, 9333, - 9233, 9132, 9033, 8933, - 8835, 8737, 8639, 8542, - 8445, 8349, 8253, 8158, - 8063, 7969, 7875, 7782, - 7689, 7596, 7504, 7413, - 7321, 7231, 7140, 7050, - 6961, 6872, 6783, 6695, - 6607, 6519, 6432, 6346, - 6259, 6173, 6088, 6003, - 5918, 5833, 5749, 5665, - 5582, 5499, 5416, 5334, - 5251, 5170, 5088, 5007, - 4926, 4846, 4766, 4686, - 4607, 4527, 4449, 4370, - 4292, 4214, 4136, 4059, - 3982, 3905, 3828, 3752, - 3676, 3601, 3525, 3450, - 3375, 3301, 3226, 3152, - 3078, 3005, 2932, 2859, - 2786, 2713, 2641, 2569, - 2497, 2426, 2355, 2284, - 2213, 2142, 2072, 2002, - 1932, 1862, 1793, 1724, - 1655, 1586, 1518, 1449, - 1381, 1313, 1246, 1178, - 1111, 1044, 977, 911, - 844, 778, 712, 647, - 581, 516, 450, 385, - 321, 256, 192, 127, - 63, -}; -const uint16_t lut_svf_scale[] FLASHMEM = { - 32767, 28381, 27473, 26846, - 26352, 25936, 25573, 25248, - 24953, 24682, 24429, 24193, - 23970, 23759, 23557, 23365, - 23181, 23003, 22832, 22667, - 22507, 22352, 22201, 22055, - 21912, 21772, 21636, 21503, - 21373, 21245, 21120, 20998, - 20877, 20759, 20643, 20528, - 20416, 20305, 20196, 20088, - 19982, 19877, 19774, 19672, - 19571, 19471, 19373, 19275, - 19179, 19083, 18989, 18896, - 18803, 18712, 18621, 18531, - 18442, 18353, 18266, 18179, - 18092, 18007, 17922, 17837, - 17754, 17671, 17588, 17506, - 17424, 17343, 17263, 17183, - 17103, 17024, 16946, 16868, - 16790, 16713, 16636, 16559, - 16483, 16407, 16331, 16256, - 16181, 16107, 16033, 15959, - 15885, 15812, 15739, 15666, - 15594, 15522, 15450, 15378, - 15306, 15235, 15164, 15093, - 15022, 14952, 14882, 14812, - 14742, 14672, 14602, 14533, - 14464, 14395, 14326, 14257, - 14188, 14120, 14051, 13983, - 13915, 13847, 13779, 13711, - 13643, 13575, 13508, 13440, - 13372, 13305, 13238, 13170, - 13103, 13036, 12969, 12902, - 12835, 12768, 12701, 12634, - 12567, 12500, 12433, 12366, - 12299, 12232, 12165, 12098, - 12031, 11964, 11897, 11830, - 11762, 11695, 11628, 11561, - 11493, 11426, 11359, 11291, - 11223, 11156, 11088, 11020, - 10952, 10884, 10816, 10747, - 10679, 10610, 10542, 10473, - 10404, 10335, 10266, 10196, - 10127, 10057, 9987, 9917, - 9846, 9776, 9705, 9634, - 9563, 9491, 9420, 9348, - 9276, 9203, 9130, 9057, - 8984, 8910, 8836, 8762, - 8687, 8613, 8537, 8461, - 8385, 8309, 8232, 8155, - 8077, 7998, 7920, 7841, - 7761, 7680, 7600, 7518, - 7436, 7354, 7270, 7187, - 7102, 7017, 6931, 6844, - 6756, 6668, 6578, 6488, - 6397, 6305, 6211, 6117, - 6021, 5925, 5827, 5727, - 5626, 5524, 5420, 5315, - 5207, 5098, 4987, 4873, - 4758, 4639, 4518, 4394, - 4267, 4137, 4002, 3864, - 3720, 3571, 3417, 3255, - 3086, 2907, 2717, 2514, - 2293, 2049, 1774, 1447, - 1022, -}; -} \ No newline at end of file diff --git a/app/M-OSC/Waveforms.bin b/app/M-OSC/Waveforms.bin index ba4bafa..f4f6e00 100644 Binary files a/app/M-OSC/Waveforms.bin and b/app/M-OSC/Waveforms.bin differ diff --git a/app/M-OSC/Waveforms.cpp b/app/M-OSC/Waveforms.cpp index d9b4bf8..1a052f0 100644 --- a/app/M-OSC/Waveforms.cpp +++ b/app/M-OSC/Waveforms.cpp @@ -47,26 +47,46 @@ Envelope envelope; VcoJitterSource jitter_source; braids::Quantizer quantizer; +static int8_t notes[6] = {}; + +#ifndef MACHINE_INTERNAL + void Quantizer::Init() -{} +{ +} -bool Quantizer::enabled() { +bool Quantizer::enabled() +{ return engine::qz_enabled(); } int32_t Quantizer::Process(int32_t pitch, int32_t root, int8_t *note) { + memset(notes, 0, sizeof(notes)); + if (note == nullptr) + note = ¬es[0]; + pitch -= root + (PITCH_PER_OCTAVE * 8); auto ret = engine::qz_process(pitch, note); ret += root + (PITCH_PER_OCTAVE * 8); + notes[0] = *note; return ret; } int16_t Quantizer::Lookup(uint8_t index) { + for (auto ¬e : notes) + { + if (note == 0) + { + note = index - notes[0]; + break; + } + } + return engine::qz_lookup(index) + (PITCH_PER_OCTAVE * 8); } - +#endif uint8_t sync_samples[FRAME_BUFFER_SIZE] = {}; int32_t _pitch = 0; @@ -102,6 +122,7 @@ void engine::setup() void engine::process() { + memset(notes, 0, sizeof(notes)); envelope.Update(_attack / 512, _decay / 512); if (engine::trig()) @@ -184,6 +205,24 @@ void engine::process() void engine::draw() { + if (_shape >= 48) + { + char tmp[8]; + for (int i = 0; i < LEN_OF(notes); i++) + { + if (notes[i] != 0) + { + int slen = 0; + if (i == 0) + slen = sprintf(tmp, "%d", notes[i]); + else + slen = sprintf(tmp, "%+d", notes[i]); + + gfx::drawString(128 - slen * 5, 10 + 6 * i, tmp, 0); + } + } + } + if (!__io->tr) { setParamName(&_decay, "Level"); diff --git a/app/index.json b/app/index.json index b72dea7..4f1efc8 100644 --- a/app/index.json +++ b/app/index.json @@ -48,6 +48,7 @@ "GND/Scope.bin", "GND/FFT.bin", - "SYNTH/plaits.bin" + "SYNTH/plaits.bin", + "DRUMS/DrumSynth.bin" ] } \ No newline at end of file diff --git a/app/squares-and-circles-api.h b/app/squares-and-circles-api.h index 4ae8c67..6c4deba 100644 --- a/app/squares-and-circles-api.h +++ b/app/squares-and-circles-api.h @@ -110,6 +110,7 @@ EXTERN_C uint32_t crc32(uint32_t crc, const void *buf, size_t size); EXTERN_C { extern const char *__name; + extern const uint8_t *__data; extern uint32_t *__t; extern uint8_t *__clock; extern uint8_t *__step; @@ -241,7 +242,7 @@ namespace engine EXTERN_C void process(); EXTERN_C void draw(); EXTERN_C void screensaver(); - + EXTERN_C void release(); ///// typedef bool (*uiHandler)(uint16_t type, uint16_t control, int16_t value, uint16_t mask); diff --git a/app/upload.py b/app/upload.py index 4cdb779..736ac59 100755 --- a/app/upload.py +++ b/app/upload.py @@ -144,9 +144,11 @@ def get_appid(binfile): apps = json.load(f) j = 0 + enginesNew = [] for file in apps["apps"]: bin_file = os.path.dirname(apps_json) + "/" + str(file) if not os.path.exists(bin_file): + print(bin_file, "not found") continue app_id = get_appid(bin_file) # os.path.splitext(file)[0] bin_size = os.path.getsize(bin_file) @@ -170,24 +172,24 @@ def get_appid(binfile): engine["addr"] = "%x" % offset engine["size"] = "%s" % bin_size engine["crc32"] = "%x" % crc32sum - engines.append(engine) - print("NEW ->", file, engine) + enginesNew.append(engine) + print("NEW ->", app_id, file, engine) #continue #exit(0) elif engine["crc32"] == "%x" % crc32sum: onext = int(engine["addr"], 16) + int(engine["size"]) onext += 4096 - (onext % 4096) print( - engine["addr"], engine["size"], + app_id, engine["addr"], engine["size"], os.path.splitext(file)[0], "%x" % crc32sum, "OK!", - bin_size - int(engine["size"]), - "MEM-KB: %d" % ((onext - int(1024 * 1024 / 2)) / 1024) + "NEXT: %x" % (onext) ) + enginesNew.append(engine) continue - print("->", file, engine) + print("->", app_id, file, engine) print( os.path.splitext(file)[0], "%x" % crc32sum, bin_size - int(engine["size"]) @@ -211,8 +213,8 @@ def get_appid(binfile): offset += 4 - (offset % 4) - if len(engines) > 0: - offset = max((int(e["addr"], 16) + int(e["size"])) for e in engines) + if len(enginesNew) > 0: + offset = max((int(e["addr"], 16) + int(e["size"])) for e in enginesNew) offset += 4096 - (offset % 4096) print("END 0x%x" % offset) for chunk in chunk_bytes(bytearray(b"\xff") * 4096, 4096): diff --git a/lib/braids/chords_stack.cc b/lib/braids/chords_stack.cc index 37ee90f..9cf86ed 100644 --- a/lib/braids/chords_stack.cc +++ b/lib/braids/chords_stack.cc @@ -496,11 +496,12 @@ void DigitalOscillator::renderChord( } else { if (quantizer.enabled()) { int8_t index = 0; - fm = pitch_ - quantizer.Process(pitch_, 0, &index); + int8_t root = 0; + fm = pitch_ - quantizer.Process(pitch_, 0, &root); phase_increment[0] = phase_increment_; for (size_t i = 1; i < noteCount; i++) { - index = (index + noteOffset[i-1]); + index = (root + noteOffset[i-1]); if (index >= 128) { noteCount = i; break; diff --git a/lib/drumsynth/drumsynth.cpp b/lib/drumsynth/drumsynth.cpp index ef3f98b..32c4ee1 100644 --- a/lib/drumsynth/drumsynth.cpp +++ b/lib/drumsynth/drumsynth.cpp @@ -33,8 +33,8 @@ #include "misc/Biquad.h" #include "drumsynth.h" -#ifndef SAMPLE_RATE -constexpr float SAMPLE_RATE = 48000.f; +#ifndef __SAMPLE_RATE +constexpr float __SAMPLE_RATE = 48000.f; #endif inline float dB2amp(float dB) @@ -47,15 +47,15 @@ class Envelope const EnvArgs *args_; public: - void init(const EnvArgs &args) + void init(const EnvArgs *args) { - args_ = &args; + args_ = args; value_ = 0.f; e_ = 0.0001f; c_ = 1.0f; segment_ = 0; - if (args.n == 0) + if (args_->n == 0) { value_ = 1.f; pos_ = 0; @@ -132,7 +132,7 @@ class Oscillator void Init(float freq) { pw_ = 0.5f; - phase_inc_ = freq / SAMPLE_RATE; + phase_inc_ = freq / __SAMPLE_RATE; f_ = freq; osc.Init(); } @@ -144,7 +144,7 @@ class Oscillator inline void pitch(float pitch) { - phase_inc_ = f_ * pitch / SAMPLE_RATE; + phase_inc_ = f_ * pitch / __SAMPLE_RATE; } inline void duty(float duty) @@ -215,8 +215,8 @@ struct drum_synth_Part Biquad biquad1 = {}; Biquad biquad2 = {}; - std::pair biquad1b; - std::pair biquad2b; + std::pair biquadA[2] = {}; + std::pair biquadB[2] = {}; const PartArgs *part; @@ -226,18 +226,18 @@ struct drum_synth_Part { this->part = part; - _amp.init(part->osc_amp); - _pitch.init(part->osc_pitch); - _vca.init(part->vca); + _amp.init(&part->osc_amp); + _pitch.init(&part->osc_pitch); + _vca.init(&part->vca); _dc_blocker.Init(0.99f); const auto &a = part->bq1; if (a.mode) - biquad1.setBiquad(a.mode - 1, a.f / SAMPLE_RATE, a.q, a.g); + biquad1.setBiquad(a.mode - 1, a.f / __SAMPLE_RATE, a.q, a.g); const auto &b = part->bq2; if (b.mode) - biquad2.setBiquad(b.mode - 1, b.f / SAMPLE_RATE, b.q, b.g); + biquad2.setBiquad(b.mode - 1, b.f / __SAMPLE_RATE, b.q, b.g); if (part->osc.type == OSC_METALLIC) { @@ -291,6 +291,9 @@ struct drum_synth_Part { for (size_t j = 0; j < this->part->osc.n; j++) this->_osc[j].reset(); + + memset(&this->biquadA, 0, sizeof(this->biquadA)); + memset(&this->biquadB, 0, sizeof(this->biquadB)); } uint32_t last_f = 0; @@ -300,7 +303,7 @@ struct drum_synth_Part uint32_t t = params->t; float osc = 0; float osc2 = 0; - uint32_t ff = f * SAMPLE_RATE; + uint32_t ff = f * __SAMPLE_RATE; // if (t > 0 && this->_amp.finished() && this->_vca.finished()) // { @@ -365,6 +368,8 @@ struct drum_synth_Part this->_osc[0].pitch(this->_pitch.value() * f); this->_osc[0].Tri(osc); break; + default: + return; } if (part->flags & BIQUAD_SERIAL) @@ -376,10 +381,10 @@ struct drum_synth_Part { if (last_f != ff) { - this->biquad1.setFc(part->bq1.f / SAMPLE_RATE * f); + this->biquad1.setFc(part->bq1.f / __SAMPLE_RATE * f); } - osc = this->biquad1.process(osc); + osc = this->biquad1.process(osc, this->biquadA[0].first, this->biquadA[0].second); if (part->bq1.mode < BIQUAD_NOTCH) osc *= part->bq1.g; } @@ -391,10 +396,10 @@ struct drum_synth_Part { if (last_f != ff) { - this->biquad2.setFc(part->bq2.f / SAMPLE_RATE * f); + this->biquad2.setFc(part->bq2.f / __SAMPLE_RATE * f); } - osc = this->biquad2.process(osc); + osc = this->biquad2.process(osc, this->biquadA[1].first, this->biquadA[1].second); if (part->bq2.mode < BIQUAD_NOTCH) osc *= part->bq2.g; } @@ -406,17 +411,17 @@ struct drum_synth_Part if (part->bq1.mode) { - osc2 = this->biquad1.process(osc2, this->biquad1b.first, this->biquad1b.second); + osc2 = this->biquad1.process(osc2, this->biquadB[0].first, this->biquadB[0].second); if (part->bq1.mode < BIQUAD_NOTCH) osc2 *= part->bq1.g; } if (part->ws.n) - osc = waveshaper_transform(osc); + osc2 = waveshaper_transform(osc2); if (part->bq2.mode) { - osc2 = this->biquad2.process(osc2, this->biquad2b.first, this->biquad2b.second); + osc2 = this->biquad2.process(osc2, this->biquadB[1].first, this->biquadB[1].second); if (part->bq2.mode < BIQUAD_NOTCH) osc2 *= part->bq2.g; } @@ -480,6 +485,154 @@ extern "C" void drum_synth_process_frame(DrumSynth inst, int part, float freq, c if (inst) { auto _part = (drum_synth_Part *)&inst[1]; - _part[part].process_frame(freq, params, outL, outR, size); + if (part >= 0) + { + _part[part].process_frame(freq, params, outL, outR, size); + } + else + { + float tmpL[size]; + float tmpR[size]; + size_t skip = -1; + + for (size_t part = 0; part < inst[0]; part++) + { + if (skip == part) + continue; + + _part[part].process_frame(freq, params, tmpL, tmpR, size); + + if (part == 0 && _part[part].part->amp_mod.dest != 0) + { + skip = _part[part].part->amp_mod.dest; + float modL[size]; + float modR[size]; + _part[_part[part].part->amp_mod.dest].process_frame(freq, params, modL, modR, size); + + for (int j = 0; j < size; j++) + { + outL[j] += tmpL[j] * modL[j] * params->levelL; + outR[j] += tmpR[j] * modR[j] * params->levelR; + } + } + else + { + for (int j = 0; j < size; j++) + { + outL[j] += tmpL[j] * params->levelL; + outR[j] += tmpR[j] * params->levelR; + } + } + } + } } +} + +extern "C" int drum_synth_load_models(const uint8_t *drumkit, DrumModel _instModel[16], void *(*malloc)(size_t size)) +{ + if (drumkit == nullptr) + return 0; + + if (drumkit[0] == '!' && drumkit[1] == 'R' && drumkit[2] == 'C' && drumkit[3] == '8') + drumkit += 4; + else + return 0; + + int inst_count = 0; + const uint8_t *p = drumkit; + p += 4; + for (size_t i = 0; i < drumkit[0]; i++) + { + _instModel[i].name = reinterpret_cast(p); + p += 12; + + _instModel[i].n = *reinterpret_cast(p); + p += sizeof(_instModel[i].n); + + PartArgs *part = new (malloc(sizeof(PartArgs) * _instModel[i].n)) PartArgs[_instModel[i].n]{}; + _instModel[i].part = part; + + for (int j = 0; j < _instModel[i].n; j++) + { + part->flags = *reinterpret_cast(p); + p += sizeof(part->flags); + + part->osc = *reinterpret_cast(p); + p += sizeof(part->osc); + + part->osc_pitch.n = *reinterpret_cast(p); + p += sizeof(part->osc_pitch.n); + part->osc_pitch.xy = reinterpret_cast(p); + if (part->osc_pitch.xy[part->osc_pitch.n - 1].t > 0) + { + // OK + } + int k = part->osc_pitch.n; + p += sizeof(EnvXY) * k; + + part->osc_amp.n = *reinterpret_cast(p); + p += sizeof(part->osc_amp.n); + part->osc_amp.xy = reinterpret_cast(p); + if (part->osc_amp.xy[part->osc_amp.n - 1].t > 0) + { + // OK + } + k = part->osc_amp.n; + p += sizeof(EnvXY) * k; + + part->vca.n = *reinterpret_cast(p); + p += sizeof(part->vca.n); + part->vca.xy = reinterpret_cast(p); + if (part->vca.xy[part->vca.n - 1].t > 0) + { + // OK + } + k = part->vca.n; + p += sizeof(EnvXY) * k; + + part->bq1 = *reinterpret_cast(p); + p += sizeof(BiquadArgs); + + part->bq2 = *reinterpret_cast(p); + p += sizeof(BiquadArgs); + + part->ws.n = *reinterpret_cast(p); + p += sizeof(part->ws.n); + part->ws.xy = reinterpret_cast(p); + if (part->ws.xy[part->ws.n - 1].x > 0) + { + // OK + } + k = part->ws.n; + p += sizeof(WS_XY) * k; + + if (part->flags & VCF) + { + part->vcf = reinterpret_cast(p); + p += sizeof(*part->vcf); + + part->vcf_env.n = *reinterpret_cast(p); + p += sizeof(part->vcf_env.n); + part->vcf_env.xy = reinterpret_cast(p); + if (part->vcf_env.xy[part->vcf_env.n - 1].t > 0) + { + // OK + } + k = part->vcf_env.n; + p += sizeof(EnvXY) * k; + } + + part->amp_mod.dest = *reinterpret_cast(p); + p += sizeof(part->amp_mod.dest); + part->amp_mod.offset = *reinterpret_cast(p); + p += sizeof(part->amp_mod.offset); + + part->level = *reinterpret_cast(p); + p += sizeof(part->level); + part++; + } + inst_count++; + } + + return inst_count; } \ No newline at end of file diff --git a/lib/drumsynth/drumsynth.h b/lib/drumsynth/drumsynth.h index da35c7b..c253d60 100644 --- a/lib/drumsynth/drumsynth.h +++ b/lib/drumsynth/drumsynth.h @@ -97,10 +97,25 @@ struct OscArgs uint32_t n; }; +struct AmpMod +{ + uint32_t dest; + float offset; +}; + +struct VCFArgs +{ + float cutoff; + float res; + float envDepth; + float velDepth; +}; + enum PartFlags : uint32_t { BIQUAD_SERIAL = 1 << 1, BIQUAD_PARALLEL = 1 << 2, + VCF = 1 << 3, }; struct PartArgs @@ -113,6 +128,9 @@ struct PartArgs BiquadArgs bq1; BiquadArgs bq2; WSArgs ws; + const VCFArgs *vcf; + EnvArgs vcf_env; + AmpMod amp_mod; float level; }; @@ -129,6 +147,8 @@ struct DrumParams float attack; float decay; float stereo; + float levelL; + float levelR; }; struct DrumKit @@ -144,4 +164,5 @@ extern "C" DrumSynth drum_synth_init(const DrumModel *inst, void *(*malloc)(size_t size)); void drum_synth_process_frame(DrumSynth inst, int part, float freq, const DrumParams *params, float *outL, float *outR, size_t size); void drum_synth_reset(DrumSynth inst); + int drum_synth_load_models(const uint8_t *drumkit, DrumModel _instModel[16], void *(*malloc)(size_t size)); } \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 7167a2e..0580f34 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,5 +9,5 @@ [env:squares-and-circles] apps_json = ./app/index.json -squares_and_circles_loader = 78883e6 ; minimum loader version +squares_and_circles_loader = fb79585 ; minimum loader version platform = .pio/ \ No newline at end of file