- fixed master volume

- added osc jitter to blep waveform saw, square and tri
This commit is contained in:
2025-08-02 12:04:40 +02:00
parent ff6ba8a179
commit 3bda521d62
3 changed files with 52 additions and 11 deletions
+14
View File
@@ -610,10 +610,24 @@ void JaySynthAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer
} }
for (i=0; i <numSamples; i++) for (i=0; i <numSamples; i++)
{
buf1[i] = (float)(buf[0][i]*limiter_gain[i]); buf1[i] = (float)(buf[0][i]*limiter_gain[i]);
}
for (i=0; i <numSamples; i++) for (i=0; i <numSamples; i++)
{
buf2[i] = (float)(buf[1][i]*limiter_gain[i]); buf2[i] = (float)(buf[1][i]*limiter_gain[i]);
}
#else
for (i=0; i <numSamples; i++)
{
buf1[i] = (float)(buf[0][i]);
}
for (i=0; i <numSamples; i++)
{
buf2[i] = (float)(buf[1][i]);
}
#endif #endif
// In case we have more outputs than inputs, we'll clear any output // In case we have more outputs than inputs, we'll clear any output
+31 -7
View File
@@ -92,6 +92,30 @@ synth_float_t IP_Process(blit_t *pObj, synth_float_t *pLUT, synth_float_t m)
return y; return y;
} }
void BLIT_process_misc(blit_t *pObj)
{
if (pObj->misc_process_downsammple_counter)
{
pObj->misc_process_downsammple_counter--;
return;
}
pObj->misc_process_downsammple_counter = BLIT_MISC_PROCESS_DOWN_SAMPLE;
const synth_float_t alpha = BLIT_JITTER_ERROR*BLIT_MISC_PROCESS_DOWN_SAMPLE;
synth_float_t pm = Noise_Uniform(&pObj->pCom->noise, 1, 0);
if (pm > 0)
{
pObj->jitter += alpha;
}
else
{
pObj->jitter -= alpha;
}
}
void BLIT_freq_update(blit_t *pObj, synth_float_t scale) void BLIT_freq_update(blit_t *pObj, synth_float_t scale)
{ {
synth_float_t p; synth_float_t p;
@@ -99,7 +123,7 @@ void BLIT_freq_update(blit_t *pObj, synth_float_t scale)
pObj->freq_update_req = 0; pObj->freq_update_req = 0;
// p = pObj->fs/(pObj->f*scale*pObj->fm); // p = pObj->fs/(pObj->f*scale*pObj->fm);
p = pObj->fs/(scale*pObj->fm); p = pObj->fs/(scale * pObj->fm * (1 + pObj->jitter));
pObj->dx = (synth_float_t)1.0/p; pObj->dx = (synth_float_t)1.0/p;
pObj->m = umin(BLIT_NUM_HARM_MAX-1, (UINT32)((synth_float_t)SYNTH_BANDWIDTH*2.0*(int)((p/2)) + 0)); pObj->m = umin(BLIT_NUM_HARM_MAX-1, (UINT32)((synth_float_t)SYNTH_BANDWIDTH*2.0*(int)((p/2)) + 0));
@@ -259,7 +283,8 @@ void BLIT_Reset(blit_t *pObj, synth_float_t phase)
pObj->fm = 1; pObj->fm = 1;
pObj->pwm = 0; pObj->pwm = 0;
pObj->pulse_offset = 0; // ToDo: Adjust according to phase pObj->pulse_offset = 0; // ToDo: Adjust according to phase
pObj->pm_filtered = 0; pObj->jitter = 0;
pObj->misc_process_downsammple_counter = BLIT_MISC_PROCESS_DOWN_SAMPLE;
} }
void BLIT_Start(blit_t *pObj) void BLIT_Start(blit_t *pObj)
@@ -284,13 +309,10 @@ void BLIT_Process_SAW_Vector(blit_t *pObj, synth_float_t *pPitch, synth_float_t
if (pSyncOut) if (pSyncOut)
memset(pSyncOut, 0, len*sizeof(synth_float_t)); memset(pSyncOut, 0, len*sizeof(synth_float_t));
synth_float_t alpha = 0.001;
synth_float_t pm = Noise_Gaussian(&pObj->pCom->noise, 0.01, 0);
pObj->pm_filtered = pObj->pm_filtered*(1.0 - alpha) + pm*alpha;
// Create output // Create output
for (i=0; i< len; i++) for (i=0; i< len; i++)
{ {
BLIT_process_misc(pObj);
if (pObj->freq_update_req) if (pObj->freq_update_req)
{ {
BLIT_freq_update(pObj, pPitch[i]); BLIT_freq_update(pObj, pPitch[i]);
@@ -303,7 +325,7 @@ void BLIT_Process_SAW_Vector(blit_t *pObj, synth_float_t *pPitch, synth_float_t
{ {
pObj->fm = (synth_float_t)pow((synth_float_t)2, pCV_fm[i]); pObj->fm = (synth_float_t)pow((synth_float_t)2, pCV_fm[i]);
} }
BLIT_freq_update(pObj, pPitch[i] * (1+pObj->pm_filtered)); BLIT_freq_update(pObj, pPitch[i]);
} }
m = pObj->m; m = pObj->m;
@@ -334,6 +356,7 @@ void BLIT_Process_SQR_Vector(blit_t *pObj, synth_float_t *pPitch, synth_float_t
// Create output // Create output
for (i=0; i< len; i++) for (i=0; i< len; i++)
{ {
BLIT_process_misc(pObj);
if (pObj->freq_update_req) if (pObj->freq_update_req)
{ {
BLIT_freq_update(pObj, pPitch[i]); BLIT_freq_update(pObj, pPitch[i]);
@@ -403,6 +426,7 @@ void BLIT_Process_TRI_Vector(blit_t *pObj, synth_float_t *pPitch, synth_float_t
for (i=0; i< len; i++) for (i=0; i< len; i++)
{ {
BLIT_process_misc(pObj);
if (pObj->freq_update_req) if (pObj->freq_update_req)
{ {
BLIT_freq_update(pObj, pPitch[i]); BLIT_freq_update(pObj, pPitch[i]);
+5 -2
View File
@@ -7,6 +7,9 @@
#include "noise.h" #include "noise.h"
#include "synth_types.h" #include "synth_types.h"
#define BLIT_MISC_PROCESS_DOWN_SAMPLE 2
#define BLIT_JITTER_ERROR 0.0000001
// -------------------------------------------------------------- // --------------------------------------------------------------
// Types // Types
// -------------------------------------------------------------- // --------------------------------------------------------------
@@ -30,8 +33,8 @@ typedef struct _sblit_t
synth_float_t tri_x, tri_sum; synth_float_t tri_x, tri_sum;
UINT32 m, tri_pol, sqr_pol1, sqr_pol2; UINT32 m, tri_pol, sqr_pol1, sqr_pol2;
UINT32 freq_update_req, bufsize; UINT32 freq_update_req, bufsize;
synth_float_t pm_filtered; synth_float_t jitter;
UINT32 misc_process_downsammple_counter;
} blit_t; } blit_t;
// -------------------------------------------------------------- // --------------------------------------------------------------