diff --git a/scripts/__pycache__/example_wavetable.cpython-311.pyc b/scripts/__pycache__/example_wavetable.cpython-311.pyc new file mode 100644 index 0000000..467c7f9 Binary files /dev/null and b/scripts/__pycache__/example_wavetable.cpython-311.pyc differ diff --git a/scripts/example_wavetable.py b/scripts/example_wavetable.py new file mode 100644 index 0000000..9397d53 --- /dev/null +++ b/scripts/example_wavetable.py @@ -0,0 +1,3 @@ + +def process(phase): + print("im from process") diff --git a/scripts/generate_wavetable.py b/scripts/generate_wavetable.py new file mode 100644 index 0000000..46fda4b --- /dev/null +++ b/scripts/generate_wavetable.py @@ -0,0 +1,41 @@ + +# this is a script for generating a wavetable file +# a wavetable file consists of a one-dimensional array of samples representing one period of a waveform +# metadata includes: +# - file version (for program compatibility) +# - binary format (float, double, int32, etc.) +# - domain (normal is a phase from x=0 to x=2pi) +# - range (depending on datatypes, e.g. float=[-1,1], int32=[-2^15, 2^15-1]) +# - waveform RMS (for loudness normalization) +# the synth program uses the filename, not any metadata + +# this script uses the function defined in example_wavetable.py to calculate samples +# if you want a custom wavetable, copy/edit/modify the example function (desmos is great for brainstorming) + +import example_wavetable + +def createFile(): + print("creating file") + return 1 + +def writeMetadata(file): + print("im writing metadata") + +def generateWavetable(file): + print("im generating the wavetable") + example_wavetable.process() + +def closeFile(file): + print("finishing up") + +def main(): + print("Hello main") + file = createFile() + writeMetadata(file) + generateWavetable(file) + closeFile(file) + print("done") + + +if __name__ == "__main__": + main() diff --git a/src/synth/Voice.cpp b/src/synth/Voice.cpp index d7c391a..6c8d3e7 100644 --- a/src/synth/Voice.cpp +++ b/src/synth/Voice.cpp @@ -81,6 +81,7 @@ float Voice::process(float* params, bool& scopeTrigger) { float velocityGain = std::lerp(velocityCenter, velocity_, velocitySensitivity); float gain = gainEnv * getParam(ParamId::Osc1VolumeDepth) * velocityGain; + gain *= (100.0f - static_cast(note_)) * 0.005f + 0.75; // sample generation uint8_t osc1Wave = (static_cast(std::round(getParam(ParamId::Osc1WaveSelector1))));