Browse Source

Use new dsp::exp2_taylor5() function.

tags/v2.4.0
Andrew Belt 9 months ago
parent
commit
fae4f4fc36
11 changed files with 13 additions and 13 deletions
  1. +1
    -1
      src/Delay.cpp
  2. +1
    -1
      src/Gates.cpp
  3. +1
    -1
      src/LFO.cpp
  4. +1
    -1
      src/Process.cpp
  5. +1
    -1
      src/Random.cpp
  6. +1
    -1
      src/SEQ3.cpp
  7. +1
    -1
      src/Scope.cpp
  8. +1
    -1
      src/VCF.cpp
  9. +2
    -2
      src/VCO.cpp
  10. +1
    -1
      src/WTLFO.cpp
  11. +2
    -2
      src/WTVCO.cpp

+ 1
- 1
src/Delay.cpp View File

@@ -121,7 +121,7 @@ struct Delay : Module {
// Scale time knob to 1V/oct pitch based on formula explained in constructor, for backwards compatibility
float pitch = std::log2(1000.f) - std::log2(10000.f) * params[TIME_PARAM].getValue();
pitch += inputs[TIME_INPUT].getVoltage() * params[TIME_CV_PARAM].getValue();
float freq = clockFreq / 2.f * std::pow(2.f, pitch);
float freq = clockFreq / 2.f * dsp::exp2_taylor5(pitch);
// Number of desired delay samples
float index = args.sampleRate / freq;
// In order to delay accurate samples, subtract by the historyBuffer size, and an experimentally tweaked amount.


+ 1
- 1
src/Gates.cpp View File

@@ -136,7 +136,7 @@ struct Gates : Module {

// Gate output
float gatePitch = params[LENGTH_PARAM].getValue() + inputs[LENGTH_INPUT].getPolyVoltage(c);
float gateLength = dsp::approxExp2_taylor5(gatePitch + 30.f) / 1073741824;
float gateLength = dsp::exp2_taylor5(gatePitch + 30.f) / 1073741824;
if (std::isfinite(e.gateTime)) {
e.gateTime += args.sampleTime;
if (reset || e.gateTime >= gateLength) {


+ 1
- 1
src/LFO.cpp View File

@@ -131,7 +131,7 @@ struct LFO : Module {
// Pitch and frequency
float_4 pitch = freqParam;
pitch += inputs[FM_INPUT].getVoltageSimd<float_4>(c) * fmParam;
float_4 freq = clockFreq / 2.f * dsp::approxExp2_taylor5(pitch + 30.f) / std::pow(2.f, 30.f);
float_4 freq = clockFreq / 2.f * dsp::exp2_taylor5(pitch);

// Pulse width
float_4 pw = pwParam;


+ 1
- 1
src/Process.cpp View File

@@ -97,7 +97,7 @@ struct Process : Module {
float slew = INFINITY;
if (std::isfinite(slewParam)) {
float slewPitch = slewParam + inputs[SLEW_INPUT].getPolyVoltage(c);
slew = dsp::approxExp2_taylor5(-slewPitch + 30.f) / std::exp2(30.f);
slew = dsp::exp2_taylor5(-slewPitch + 30.f) / std::exp2(30.f);
}
float slewDelta = slew * args.sampleTime;



+ 1
- 1
src/Random.cpp View File

@@ -148,7 +148,7 @@ struct Random : Module {
// Advance clock phase by rate
float rate = params[RATE_PARAM].getValue();
rate += inputs[RATE_PARAM].getVoltage() * params[RATE_CV_PARAM].getValue();
clockFreq = std::pow(2.f, rate);
clockFreq = dsp::exp2_taylor5(rate);
deltaPhase = std::fmin(clockFreq * args.sampleTime, 0.5f);
clockPhase += deltaPhase;
// Trigger


+ 1
- 1
src/SEQ3.cpp View File

@@ -182,7 +182,7 @@ struct SEQ3 : Module {
else {
// Internal clock
float clockPitch = params[TEMPO_PARAM].getValue() + inputs[TEMPO_INPUT].getVoltage() * params[TEMPO_CV_PARAM].getValue();
float clockFreq = std::pow(2.f, clockPitch);
float clockFreq = dsp::exp2_taylor5(clockPitch);
phase += clockFreq * args.sampleTime;
if (phase >= 1.f && !resetGate) {
clock = true;


+ 1
- 1
src/Scope.cpp View File

@@ -152,7 +152,7 @@ struct Scope : Module {
// Add point to buffer if recording
if (bufferIndex < BUFFER_SIZE) {
// Compute time
float deltaTime = std::pow(2.f, -params[TIME_PARAM].getValue()) / BUFFER_SIZE;
float deltaTime = dsp::exp2_taylor5(-params[TIME_PARAM].getValue()) / BUFFER_SIZE;
int frameCount = (int) std::ceil(deltaTime * args.sampleRate);

// Get input


+ 1
- 1
src/VCF.cpp View File

@@ -169,7 +169,7 @@ struct VCF : Module {
// Get pitch
float_4 pitch = freqParam + inputs[FREQ_INPUT].getPolyVoltageSimd<float_4>(c) * freqCvParam;
// Set cutoff
float_4 cutoff = dsp::FREQ_C4 * simd::pow(2.f, pitch);
float_4 cutoff = dsp::FREQ_C4 * dsp::exp2_taylor5(pitch);
// Without oversampling, we must limit to 8000 Hz or so @ 44100 Hz
cutoff = clamp(cutoff, 1.f, args.sampleRate * 0.18f);
filter.setCutoff(cutoff);


+ 2
- 2
src/VCO.cpp View File

@@ -324,10 +324,10 @@ struct VCO : Module {
float_4 freq;
if (!linear) {
pitch += inputs[FM_INPUT].getPolyVoltageSimd<float_4>(c) * fmParam;
freq = dsp::FREQ_C4 * dsp::approxExp2_taylor5(pitch + 30.f) / std::pow(2.f, 30.f);
freq = dsp::FREQ_C4 * dsp::exp2_taylor5(pitch);
}
else {
freq = dsp::FREQ_C4 * dsp::approxExp2_taylor5(pitch + 30.f) / std::pow(2.f, 30.f);
freq = dsp::FREQ_C4 * dsp::exp2_taylor5(pitch);
freq += dsp::FREQ_C4 * inputs[FM_INPUT].getPolyVoltageSimd<float_4>(c) * fmParam;
}
freq = clamp(freq, 0.f, args.sampleRate / 2.f);


+ 1
- 1
src/WTLFO.cpp View File

@@ -145,7 +145,7 @@ struct WTLFO : Module {
for (int c = 0; c < channels; c += 4) {
// Calculate frequency in Hz
float_4 pitch = freqParam + inputs[FM_INPUT].getVoltageSimd<float_4>(c) * fmParam;
float_4 freq = clockFreq / 2.f * dsp::approxExp2_taylor5(pitch + 30.f) / std::pow(2.f, 30.f);
float_4 freq = clockFreq / 2.f * dsp::exp2_taylor5(pitch);
freq = simd::fmin(freq, 1024.f);

// Accumulate phase


+ 2
- 2
src/WTVCO.cpp View File

@@ -159,10 +159,10 @@ struct WTVCO : Module {
float_4 freq;
if (!linear) {
pitch += inputs[FM_INPUT].getPolyVoltageSimd<float_4>(c) * fmParam;
freq = dsp::FREQ_C4 * dsp::approxExp2_taylor5(pitch + 30.f) / std::pow(2.f, 30.f);
freq = dsp::FREQ_C4 * dsp::exp2_taylor5(pitch);
}
else {
freq = dsp::FREQ_C4 * dsp::approxExp2_taylor5(pitch + 30.f) / std::pow(2.f, 30.f);
freq = dsp::FREQ_C4 * dsp::exp2_taylor5(pitch);
freq += dsp::FREQ_C4 * inputs[FM_INPUT].getPolyVoltageSimd<float_4>(c) * fmParam;
}



Loading…
Cancel
Save