Posted: 26 Apr 2015, 18:15
the title says it all.
I'm trying to get my hands dirty with audio modules...
for a start, I wanted to start easy : an audio volume module with lots of gain followed by a soft clip algorithm...
but even if the module compiles OK, it sounds as if audio is going at modulation rate instead of audio rate.
I'm sure it is not that complicated to sort it out as I must have miss something, but what ???
looks like it is the "TPrecision" that is the problem
here the interesting bits
supabooster.h
private:
//-------------------------------------------------------------------------
// parameters events
UsineEventPtr audioInputs[AUDIO_INS_OUTS_MAX]; // audio input
UsineEventPtr audioOutputs[AUDIO_INS_OUTS_MAX]; // audio output
UsineEventPtr fdrGain;
UsineEventPtr switchMute;
TPrecision tempValue[AUDIO_INS_OUTS_MAX];
//-------------------------------------------------------------------------
static const int numOfParamAfterAudiotInOut = 2;
int queryIndex;
int numOfAudiotInsOuts;
////////////////////////////////////////////////
supabooster.cpp
void AudioVolumeExample::onProcess ()
{
for (int i = 0; i < numOfAudiotInsOuts; i++)
{
sdkCopyEvt (audioInputs, audioOutputs);
sdkMultEvt1 (coeffGain, audioOutputs);
//y = x / (1 + | x | ) softclipping formula
tempValue = sdkGetEvtData(audioOutputs) / (1 + abs(sdkGetEvtData(audioOutputs)));
sdkSetEvtData(audioOutputs, tempValue);
////////////////////////////////////////////////////////
also, is the audio values are between -1 and 1 ?
thanks for your help
Olivar
I'm trying to get my hands dirty with audio modules...
for a start, I wanted to start easy : an audio volume module with lots of gain followed by a soft clip algorithm...
but even if the module compiles OK, it sounds as if audio is going at modulation rate instead of audio rate.
I'm sure it is not that complicated to sort it out as I must have miss something, but what ???
looks like it is the "TPrecision" that is the problem
here the interesting bits
supabooster.h
private:
//-------------------------------------------------------------------------
// parameters events
UsineEventPtr audioInputs[AUDIO_INS_OUTS_MAX]; // audio input
UsineEventPtr audioOutputs[AUDIO_INS_OUTS_MAX]; // audio output
UsineEventPtr fdrGain;
UsineEventPtr switchMute;
TPrecision tempValue[AUDIO_INS_OUTS_MAX];
//-------------------------------------------------------------------------
static const int numOfParamAfterAudiotInOut = 2;
int queryIndex;
int numOfAudiotInsOuts;
////////////////////////////////////////////////
supabooster.cpp
void AudioVolumeExample::onProcess ()
{
for (int i = 0; i < numOfAudiotInsOuts; i++)
{
sdkCopyEvt (audioInputs, audioOutputs);
sdkMultEvt1 (coeffGain, audioOutputs);
//y = x / (1 + | x | ) softclipping formula
tempValue = sdkGetEvtData(audioOutputs) / (1 + abs(sdkGetEvtData(audioOutputs)));
sdkSetEvtData(audioOutputs, tempValue);
////////////////////////////////////////////////////////
also, is the audio values are between -1 and 1 ?
thanks for your help
Olivar