[VCO/Blit/Sawtooth]
- added slight random frequency deviation for more vivid sound
This commit is contained in:
+10
-2
@@ -6,9 +6,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "noise.h"
|
||||||
#include "synth_defs.h"
|
#include "synth_defs.h"
|
||||||
#include "blit.h"
|
#include "blit.h"
|
||||||
#include <fir/fir2.h>
|
#include "fir/fir2.h"
|
||||||
|
#include "synth_types.h"
|
||||||
#include "vector_utils.h"
|
#include "vector_utils.h"
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
@@ -197,6 +199,7 @@ void BLIT_ModFree(blit_common_t *pCom)
|
|||||||
void BLIT_Init(blit_t *pObj, blit_common_t *pCom, synth_float_t fs)
|
void BLIT_Init(blit_t *pObj, blit_common_t *pCom, synth_float_t fs)
|
||||||
{
|
{
|
||||||
pObj->pCom = pCom;
|
pObj->pCom = pCom;
|
||||||
|
Noise_Init(&pCom->noise, 0x31101970);
|
||||||
|
|
||||||
pObj->fs = fs;
|
pObj->fs = fs;
|
||||||
pObj->dutycycle = 0.5;
|
pObj->dutycycle = 0.5;
|
||||||
@@ -256,6 +259,7 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLIT_Start(blit_t *pObj)
|
void BLIT_Start(blit_t *pObj)
|
||||||
@@ -280,6 +284,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++)
|
||||||
{
|
{
|
||||||
@@ -295,7 +303,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]);
|
BLIT_freq_update(pObj, pPitch[i] * (1+pObj->pm_filtered));
|
||||||
}
|
}
|
||||||
|
|
||||||
m = pObj->m;
|
m = pObj->m;
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
#define _BLIT_H_
|
#define _BLIT_H_
|
||||||
|
|
||||||
#include "synth_defs.h"
|
#include "synth_defs.h"
|
||||||
|
#include "noise.h"
|
||||||
|
#include "synth_types.h"
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
// Types
|
// Types
|
||||||
@@ -14,6 +16,7 @@ typedef struct _sblit_common_t
|
|||||||
synth_float_t **ppBLEP;
|
synth_float_t **ppBLEP;
|
||||||
synth_float_t N_K[(BLIT_INTEROLATION_ORDER+0)*(BLIT_INTEROLATION_ORDER+1)];
|
synth_float_t N_K[(BLIT_INTEROLATION_ORDER+0)*(BLIT_INTEROLATION_ORDER+1)];
|
||||||
synth_float_t K[(BLIT_INTEROLATION_ORDER+0)*(BLIT_INTEROLATION_ORDER+1)];
|
synth_float_t K[(BLIT_INTEROLATION_ORDER+0)*(BLIT_INTEROLATION_ORDER+1)];
|
||||||
|
noise_gen_t noise;
|
||||||
|
|
||||||
} blit_common_t;
|
} blit_common_t;
|
||||||
|
|
||||||
@@ -27,6 +30,7 @@ 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;
|
||||||
|
|
||||||
} blit_t;
|
} blit_t;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user