Skip to content

Commit

Permalink
Wavetable transition smoothing
Browse files Browse the repository at this point in the history
  • Loading branch information
ctag-fh-kiel committed Sep 14, 2024
1 parent c250dca commit f100e2d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion components/ctagSoundProcessor/ctagSoundProcessorWTOsc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ using namespace CTAG::SP::HELPERS;
void ctagSoundProcessorWTOsc::Process(const ProcessData &data) {
// wave select
currentBank = wavebank;
MK_FLT_PAR_ABS(fWave, wave, 4095.f, 1.f)
if(cv_wave != -1) ONE_POLE(fWave, fabsf(data.cv[cv_wave]), 0.1f)
else fWave = wave / 4095.f;


if(lastBank != currentBank){ // this is slow, hence not modulated by CV
Expand Down
1 change: 1 addition & 0 deletions components/ctagSoundProcessor/ctagSoundProcessorWTOsc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace CTAG {
stmlib::Svf svf;
int16_t *buffer = NULL;
float *fbuffer = NULL;
float fWave = 0.f;
const int16_t *wavetables[64];
int currentBank = 0;
int lastBank = -1;
Expand Down
6 changes: 4 additions & 2 deletions components/ctagSoundProcessor/ctagSoundProcessorWTOscDuo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ using namespace CTAG::SP::HELPERS;
void ctagSoundProcessorWTOscDuo::Process(const ProcessData &data) {
// wave select
currentBank = wavebank;
MK_FLT_PAR_ABS(fwave_1, wave_1, 4095.f, 1.f)
MK_FLT_PAR_ABS(fwave_2, wave_2, 4095.f, 1.f)
if(cv_wave_1 != -1) ONE_POLE(fwave_1, fabsf(data.cv[cv_wave_1]), 0.1f)
else fwave_1 = wave_1 / 4095.f;
if(cv_wave_2 != -1) ONE_POLE(fwave_2, fabsf(data.cv[cv_wave_1]), 0.1f)
else fwave_2 = wave_2 / 4095.f;

if (lastBank != currentBank) { // this is slow, hence not modulated by CV
prepareWavetables();
Expand Down
2 changes: 2 additions & 0 deletions components/ctagSoundProcessor/ctagSoundProcessorWTOscDuo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ namespace CTAG {
int currentBank = 0;
int lastBank = -1;
bool isWaveTableGood = false;
float fwave_1 = 0.f;
float fwave_2 = 0.f;
float valADSR_1 = 0.f;
float valADSR_2 = 0.f;
float valLFO_1 = 0.f;
Expand Down

0 comments on commit f100e2d

Please sign in to comment.