Summary of the problem: When exporting data as an audio file (AIFF/WAV etc.), there appears to be unwanted scaling and offset in the data such that the minimum and maximum values are forced to be -1 and +1. This issue has been tested with AIFFs and WAVs on Mathematica versions 10.1 and 10.2. This issue is not observed when exporting the data as a MAT file for example, nor does it exist when exporting as an AIFF/WAV in Mathematica 220.127.116.11.
Generating a sample waveform
fS = 44100; n = Range[0, fS/2]; sampleWaveForm = Sin[2 Pi 1/fS n];
ListPlot[sampleWaveForm, Joined -> True, PlotRange -> All]
Exporting it as an AIFF
Export["/Users/username/Desktop/sampleWaveForm.aiff", Sound[SampledSoundList[sampleWaveForm, fS]], "AudioEncoding" -> "Integer24"];
Importing it as is
importedWaveForm = Import["/Users/username/Desktop/sampleWaveForm.aiff", "AIFF", "AudioEncoding" -> "Integer24"][[1, 1, 1]];
Plotting imported AIFF
ListPlot[importedWaveForm, Joined -> True, PlotRange -> All]
We see in the image above that the waveform is scaled by a factor of 2, and then offset by -1.
Question: Am I doing something incorrectly (like missing an
Export setting), or is this a bug in Mathematica 10.x? If it is a bug, is anyone aware of it and is there a way to work around it?