I'm using Mathematica to sonify some data. Using "Play," I can generate the audio within Mathematica and it sounds fantastic. However, when I export it to an audio file, the waveform is clipped and I can hear popping and static-y sounds. I've tried different file formats (.aif, .wav, .flac) and I've tried changing the SampleRate and AudioEncoding. Nothing seems to work. Every time I export it, there is still clipping. I don't understand why it plays perfectly within Mathematica, but doesn't export properly. Any suggestions?
To run the code you will need to download the csv file.
 
carbonIntensity = 
  Import["/Users/Jackie/Desktop/CarbonSpectrum.csv", {"Data", 
    Range[2, 62], 3}];
carbonFreq = 
  Import["/Users/Jackie/Desktop/CarbonSpectrum.csv", {"Data", 
    Range[2, 62], 4}];
(*Sums together all sinewaves with given frequencies in the csv file*)
carbonSonified = 
  Sum[carbonIntensity[[i]]*Sin[2*\[Pi]*t*carbonFreq[[i]]], {i, 
    1, ((62 - 2) - 1)}];
Play[carbonSonified, {t, 0, 5}]
Export["carbonSonified.wav", %]
In this picture, you can see the top of the wave is flat where it has been clipped.

				
					
				
				
					
					
						
							 Attachments:
							Attachments: