I'm developing a plugin (using C++ and IPlug framework) that read a sample and (later) process it with some effects.
Here's where I have the Process (Double) Replacing which call the reading function (for each sample) of my wavefile:
Code: Select all
void MyPlugin::ProcessDoubleReplacing(double **inputs, double **outputs, int nFrames) {
double *outputLeft = outputs[0];
double *outputRight = outputs[1];
...
// process
for (int i = 0; i < nFrames; i++) {
// clear previous sample
outputLeft[i] = 0.0;
outputRight[i] = 0.0;
...
pWavePlayer->Process(outputLeft[i], outputRight[i]);
...
}
}
Code: Select all
void WavePlayer::Process(double &outputLeft, double &outputRight) {
double outLeft = 0.0;
double outRight = 0.0;
...
outLeft += (pWaveSamples[mPlaybackBase0] * (1 - mPlaybackFrac) + (mPlaybackIndex < mWaveNumSamples - 1 ? pWaveSamples[mPlaybackBase1] * mPlaybackFrac : 0)) * pVoice->mNoteVelocity * pVoice->mEnvelope.mLevel * gainSmoothed;
if (mWaveNumChannels == 2) {
outRight += (pWaveSamples[mPlaybackBase0 + 1] * (1 - mPlaybackFrac) + (mPlaybackIndex < mWaveNumSamples - 1 ? pWaveSamples[mPlaybackBase1 + 1] * mPlaybackFrac : 0)) * pVoice->mNoteVelocity * pVoice->mEnvelope.mLevel * gainSmoothed;
}
else {
outRight = outLeft;
}
...
outputLeft += outLeft;
outputRight += outRight;
}
Code: Select all
pReverb->Process(outputLeft[i], outputRight[i]);
The problem is when I convert the Freeverb implementation from Float to Double: it becomes really (really) noisy.
It looks like increasing the precision increases the SNR
Why this? Should be the opposite? Having more definition, I should be more precise when I quantize later.
Instead, float sound better? If so, why ProcessDoubleReplacing use "double"? Should I also use interpolation/read samples from wavefile in float?
Maybe I'm missing a point...
Thanks to everybody who will help me to got this.