From 96405bd094e2c4a9bcb6dda6671e5ee032a07ca7 Mon Sep 17 00:00:00 2001 From: Blitblank Date: Sun, 1 Feb 2026 00:24:08 -0600 Subject: [PATCH] tweaks and comments --- config/profiles/default.yaml | 8 +++++++- src/synth/Voice.cpp | 11 ++++++++++- src/synth/WavetableController.cpp | 5 +++++ src/ui/MainWindow.cpp | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/config/profiles/default.yaml b/config/profiles/default.yaml index 471e384..79e3489 100644 --- a/config/profiles/default.yaml +++ b/config/profiles/default.yaml @@ -27,9 +27,15 @@ Osc3OctaveOffset: [1, -5, 5] Osc3SemitoneOffset: [7, -12, 12] Osc3PitchOffset: [-8.79, -100, 100] +# gonna have something like this: +#MasterPitchOffset: +# - [0, -5, 5] # Octave +# - [0, -12, -12] # Semitone +# - [0, -100, 100] # Pitch + # Envelope generator parameters Osc1Volume: - - [1, 0, 2] # Depth + - [1, 0, 10] # Depth - [0.05, 0, 2] # Attack - [0.2, 0, 2] # Decay - [0.7, 0, 1] # Sustain diff --git a/src/synth/Voice.cpp b/src/synth/Voice.cpp index 0f40d3b..d7c391a 100644 --- a/src/synth/Voice.cpp +++ b/src/synth/Voice.cpp @@ -2,6 +2,7 @@ #include "Voice.h" #include #include +#include Voice::Voice(SmoothedParam* params, WavetableController* wavetable) : params_(params), wavetable_(wavetable) { @@ -97,8 +98,14 @@ float Voice::process(float* params, bool& scopeTrigger) { float osc2 = oscillators_[1].process(osc2NoteOffset + note_, (getParam(ParamId::Osc2PitchOffset) + getParam(ParamId::MasterPitchOffset))/100.0f, temp); float osc3 = oscillators_[2].process(osc3NoteOffset + note_, (getParam(ParamId::Osc3PitchOffset) + getParam(ParamId::MasterPitchOffset))/100.0f, temp); + // TODO: implement controls for noise + //float scale = static_cast(rand()) / static_cast(RAND_MAX); // Range [0.0, 1.0] + //float noise = -1.0f + 2.0f * scale; + // these values didn't sound good so I commented them out before I get controls for them + // mix oscillators - float sampleOut = (osc1 + osc2*0.25f + osc3*0.125f) * gain; + // TODO: implement gain controls for the other oscillators + float sampleOut = (osc1 + osc2*0.4f + osc3*0.15f) * gain; // pre-filtered noise // filter sample float baseFreq = oscillators_[0].frequency(); @@ -109,5 +116,7 @@ float Voice::process(float* params, bool& scopeTrigger) { float filteredSample = filter1_.biquadProcess(sampleOut); // sampleOut = filter2_.biquadProcess(sampleOut); // TODO: for some reason second filter is unstable only on windows 🤷 + //filteredSample += noise*0.125f; // post-filtered noise + return filteredSample; } \ No newline at end of file diff --git a/src/synth/WavetableController.cpp b/src/synth/WavetableController.cpp index 4fa6c7b..0758c21 100644 --- a/src/synth/WavetableController.cpp +++ b/src/synth/WavetableController.cpp @@ -17,6 +17,11 @@ void WavetableController::init() { wavetables_.resize(4); // resize for however many files we find + // don't really know how the files are gonna work + // but I'd like two files- a yaml that contains metadata like name, length, range, datatype, etc. + // and the main data be just a big array of that data type in a binary file + // although having it all in a single bin makes the most sense with the metadata being in the header + float phase = 0.0f; float phaseInc = 2.0f * M_PI / static_cast(SYNTH_WAVETABLE_SIZE); diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index b5970f9..4867b8e 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -144,6 +144,7 @@ void MainWindow::onResetClicked() { ui_->envelopeFilterResonance->init(EnvelopeId::FilterResonance, config_.loadEnvProfile("default", "FilterResonance")); // TODO: clean these up, maybe put them in a package like the envelope generators (it'll help encapsulate the int-snapping business) + // what I might do is make a variable-length slider-package object ui_->sliderMasterOctave->setResolution(configRoot["MasterOctaveOffset"][2].as() - configRoot["MasterOctaveOffset"][1].as()); ui_->sliderMasterOctave->setRange(configRoot["MasterOctaveOffset"][1].as(), configRoot["MasterOctaveOffset"][2].as()); ui_->sliderMasterOctave->setValue(configRoot["MasterOctaveOffset"][0].as());