Re: Possible bug in WAV export
- To: mathgroup at smc.vnet.net
- Subject: [mg87930] Re: Possible bug in WAV export
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Sat, 19 Apr 2008 23:55:03 -0400 (EDT)
- Organization: University of Bergen
- References: <ftsd0o$ba7$1@smc.vnet.net> <ftv8on$7kv$1@smc.vnet.net> <fu9fuh$cen$1@smc.vnet.net>
m.r at inbox.ru wrote:
>> To demonstrate that this unbelievable thing really happens, here's an
>> another example, together with the result. Note that the very same
>> command returns different results in subsequent evaluations:
>>
>> In[1]:=
>> Table[
>> Total[#[[1, 1, 1]]] &@
>> ImportString[
>> ExportString[
>> Play[Sum[Sin[2 Pi 440 k t], {k, 1, 4}], {t, 0, 1},
>> SampleRate -> 44100, SampleDepth -> 16], "WAV"], "WAV"],
>> {20}]
>>
>> Out[1]= {0., 268.745, -0.752563, -0.756226, -0.756226, -2.99866, 0., \
>> 0., -2.98279, 0., 0.756226, 341.993, 0., -0.752563, 0., 268.017, \
>> -0.752563, 0., -2.2522, 0.}
>>
>> The small fluctuations could be explained by dithering, but any
>> reasonably precise result cannot have a sum of 342! The sound
>> function was constructed in such a way that the sum should be 0.
>
> A workaround is to use PlayRange -> All.
>
Thank you, this works well! I am still wondering about what causes the
randomness, though. With PlayRange -> All, the sums are always 0., so
it cannot be dithering.