tweaks and comments
This commit is contained in:
@@ -27,9 +27,15 @@ Osc3OctaveOffset: [1, -5, 5]
|
|||||||
Osc3SemitoneOffset: [7, -12, 12]
|
Osc3SemitoneOffset: [7, -12, 12]
|
||||||
Osc3PitchOffset: [-8.79, -100, 100]
|
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
|
# Envelope generator parameters
|
||||||
Osc1Volume:
|
Osc1Volume:
|
||||||
- [1, 0, 2] # Depth
|
- [1, 0, 10] # Depth
|
||||||
- [0.05, 0, 2] # Attack
|
- [0.05, 0, 2] # Attack
|
||||||
- [0.2, 0, 2] # Decay
|
- [0.2, 0, 2] # Decay
|
||||||
- [0.7, 0, 1] # Sustain
|
- [0.7, 0, 1] # Sustain
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "Voice.h"
|
#include "Voice.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <random>
|
||||||
|
|
||||||
Voice::Voice(SmoothedParam* params, WavetableController* wavetable) : params_(params), wavetable_(wavetable) {
|
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 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);
|
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<float>(rand()) / static_cast<float>(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
|
// 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
|
// filter sample
|
||||||
float baseFreq = oscillators_[0].frequency();
|
float baseFreq = oscillators_[0].frequency();
|
||||||
@@ -109,5 +116,7 @@ float Voice::process(float* params, bool& scopeTrigger) {
|
|||||||
float filteredSample = filter1_.biquadProcess(sampleOut);
|
float filteredSample = filter1_.biquadProcess(sampleOut);
|
||||||
// sampleOut = filter2_.biquadProcess(sampleOut); // TODO: for some reason second filter is unstable only on windows 🤷
|
// sampleOut = filter2_.biquadProcess(sampleOut); // TODO: for some reason second filter is unstable only on windows 🤷
|
||||||
|
|
||||||
|
//filteredSample += noise*0.125f; // post-filtered noise
|
||||||
|
|
||||||
return filteredSample;
|
return filteredSample;
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,11 @@ void WavetableController::init() {
|
|||||||
|
|
||||||
wavetables_.resize(4); // resize for however many files we find
|
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 phase = 0.0f;
|
||||||
float phaseInc = 2.0f * M_PI / static_cast<float>(SYNTH_WAVETABLE_SIZE);
|
float phaseInc = 2.0f * M_PI / static_cast<float>(SYNTH_WAVETABLE_SIZE);
|
||||||
|
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ void MainWindow::onResetClicked() {
|
|||||||
ui_->envelopeFilterResonance->init(EnvelopeId::FilterResonance, config_.loadEnvProfile("default", "FilterResonance"));
|
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)
|
// 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<int>() - configRoot["MasterOctaveOffset"][1].as<int>());
|
ui_->sliderMasterOctave->setResolution(configRoot["MasterOctaveOffset"][2].as<int>() - configRoot["MasterOctaveOffset"][1].as<int>());
|
||||||
ui_->sliderMasterOctave->setRange(configRoot["MasterOctaveOffset"][1].as<int>(), configRoot["MasterOctaveOffset"][2].as<int>());
|
ui_->sliderMasterOctave->setRange(configRoot["MasterOctaveOffset"][1].as<int>(), configRoot["MasterOctaveOffset"][2].as<int>());
|
||||||
ui_->sliderMasterOctave->setValue(configRoot["MasterOctaveOffset"][0].as<int>());
|
ui_->sliderMasterOctave->setValue(configRoot["MasterOctaveOffset"][0].as<int>());
|
||||||
|
|||||||
Reference in New Issue
Block a user