I’m trying to read a wave file no 1, slightly modify the data, and exporting it to wave file no 2. The issue is when writing data they’re modified again, and when reading wave file no 2, I don’t have what I’m supposed to wrote.
I’m using the juce method :
audioFormatWriter->writeFromAudioSampleBuffer(floatBuffer, 0, nSamples)
And I identified this code to be the source of my issue :
//juce_AudioFormatWriter.cpp line 64
static void convertFloatsToInts (int* dest, const float* src, int numSamples) noexcept
{
while (--numSamples >= 0)
{
const double samp = *src++;
if (samp <= -1.0)
*dest = std::numeric_limits<int>::min();
else if (samp >= 1.0)
*dest = std::numeric_limits<int>::max();
else
*dest = roundToInt (std::numeric_limits<int>::max() * samp); //this specific line
++dest;
}
}
For what I’m trying to do, this is important that the data I retrieve from the wave file no 2 is exactly the same I wrote.
Is there a way to do some exact write ?