diff --git a/README.md b/README.md index 048017f..1dfb1ba 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,7 @@ In order to run user units built with SDK version 1.1-0, the following firmware ## Compiled Oscillators -The compiled oscillators are found in the oscillators folder under its respective platform name: -- nts-1. -- minilogue-xd. +The compiled oscillators are found in the releases section of this repo. ## Prerequisites diff --git a/builds/nts-1/osc/harmon/manifest.json b/builds/nts-1/osc/harmon/manifest.json index 95169ce..3162ea4 100644 --- a/builds/nts-1/osc/harmon/manifest.json +++ b/builds/nts-1/osc/harmon/manifest.json @@ -6,15 +6,15 @@ "api" : "1.1-0", "dev_id" : 0, "prg_id" : 0, - "version" : "0.1-0", + "version" : "1.0-0", "name" : "harm", "num_param" : 6, "params" : [ - ["ROOT", 0, 100, "%"], ["P1", 0, 100, "%"], ["P2", 0, 100, "%"], ["P3", 0, 100, "%"], ["P4", 0, 100, "%"], + ["P5", 0, 100, "%"], ["SPRD", 0, 2, "%"] ] } diff --git a/builds/nts-1/osc/kord/manifest.json b/builds/nts-1/osc/kord/manifest.json index f65c410..d6add60 100644 --- a/builds/nts-1/osc/kord/manifest.json +++ b/builds/nts-1/osc/kord/manifest.json @@ -6,7 +6,7 @@ "api" : "1.1-0", "dev_id" : 0, "prg_id" : 0, - "version" : "0.1-0", + "version" : "1.0-0", "name" : "kord", "num_param" : 6, "params" : [ diff --git a/oscillators/nts-1/harmonikv1.0.ntkdigunit b/oscillators/nts-1/harmonikv1.0.ntkdigunit deleted file mode 100644 index 094bdee..0000000 Binary files a/oscillators/nts-1/harmonikv1.0.ntkdigunit and /dev/null differ diff --git a/oscillators/nts-1/subharmonikorgv1.1.ntkdigunit b/oscillators/nts-1/subharmonikorgv1.1.ntkdigunit deleted file mode 100644 index 0f013c6..0000000 Binary files a/oscillators/nts-1/subharmonikorgv1.1.ntkdigunit and /dev/null differ diff --git a/src/nts-1/osc/harmon/harmon.cpp b/src/nts-1/osc/harmon/harmon.cpp index 09b1302..0f58838 100644 --- a/src/nts-1/osc/harmon/harmon.cpp +++ b/src/nts-1/osc/harmon/harmon.cpp @@ -10,7 +10,6 @@ static Oscillator osc; void OSC_INIT(uint32_t platform, uint32_t api) { osc.drive = 0.f; osc.spread = harmonic; - } static inline float fold(float x) { @@ -47,34 +46,25 @@ void OSC_CYCLE( int32_t *yn, const uint32_t frames ) { - float signals[5] = { 0 }; const float w0 = osc_w0f_for_note((params->pitch)>>8, params->pitch & 0xFF); - const float drive = osc.drive; const float lfo = q31_to_f32(params->shape_lfo); q31_t * __restrict y = (q31_t *)yn; const q31_t * y_e = y + frames; for (; y != y_e; ) { - for (int i = 0; i < 5; i++) { + float sig = 0.f; + for (int i = 0; i < 6; i++) { float p = osc.phases[i]; - float g = osc.gains[i]; int div = spread(i); float w = w0 * div; p = (p < 0.f) ? 1.f - p : p - (uint32_t)p; - float folded = 0.75f * (drive + lfo) * fold(osc_sinf(p)); + float folded = 0.75f * (osc.drive + lfo) * fold(osc_sinf(p)); p = p + folded; - signals[i] = (osc_sinf(p)) * g; + sig += osc_sinf(p) * osc.gains[i]; osc.phases[i] += w; osc.phases[i] -= (uint32_t)osc.phases[i]; } - - // Main signal - float sig = 0.f; - for (int i = 0; i < 5 ; i++) { - sig += signals[i]; - } - sig *= osc.total_gain; *(y++) = f32_to_q31(sig); } @@ -88,24 +78,29 @@ void OSC_NOTEOFF(const user_osc_param_t * const params) { (void)params; } +float scale_input(int value) { + float ratio = (float)value / 100.f; + return ratio / 6.f; +} + void OSC_PARAM(uint16_t index, uint16_t value) { const float valf = param_val_to_f32(value); switch (index) { case k_user_osc_param_id1: - osc.gains[0] = valf; + osc.gains[1] = scale_input(value); break; case k_user_osc_param_id2: - osc.gains[1] = valf; + osc.gains[2] = scale_input(value); break; case k_user_osc_param_id3: - osc.gains[2] = valf; + osc.gains[3] = scale_input(value); break; case k_user_osc_param_id4: - osc.gains[3] = valf; + osc.gains[4] = scale_input(value); break; case k_user_osc_param_id5: - osc.gains[4] = valf; + osc.gains[5] = scale_input(value); break; case k_user_osc_param_id6: switch (value) { @@ -124,7 +119,7 @@ void OSC_PARAM(uint16_t index, uint16_t value) { osc.drive = valf; break; case k_user_osc_param_shiftshape: - osc.total_gain = valf * 5.f; + osc.gains[0] = valf / 6.f; break; default: break; diff --git a/src/nts-1/osc/harmon/harmon.hpp b/src/nts-1/osc/harmon/harmon.hpp index af689ff..13bda90 100644 --- a/src/nts-1/osc/harmon/harmon.hpp +++ b/src/nts-1/osc/harmon/harmon.hpp @@ -12,9 +12,8 @@ typedef enum { } Spread; typedef struct Oscillator { - float phases[5] = { 0 }; - float gains[5]= { 1.f, 0.f, 0.f, 0.f, 0.f }; + float phases[6] = { 0 }; + float gains[6]= { 0.17, 0.f, 0.f, 0.f, 0.f, 0.f }; float drive; Spread spread; - float total_gain; } Oscillator;