[squeak-dev] Question about SoundGenerationPlugin/mixSampleCount

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Fri Oct 9 16:19:35 UTC 2020


Hi all,


for a test, I am storing sounds into a ByteArray and read them again. This works well for PluckedSounds, for example, but I found some strange behavior when doing the same with SampledSounds:


sound := SampledSound new

setSamples: SampledSound coffeeCupClink

samplingRate: 12000.


bytes := ByteArray streamContents: [:stream |

sound storeWAVSamplesOn: stream].


outputSound := SampledSound fromWaveStream: bytes readStream binary.


After running this script, I would expect outputSound to have the same samples as sound. But actually, every byte in the SoundBuffer appears twice! Still, playing the sound does not sound differently in my ears. I traced the issue down and found out that #mixSampleCount:into:startingAt:leftVol:rightVol: is writing every byte four times on the stream - two would be okay for left and right channel, but I do not understand the four. I reproduced the issue both on Windows and Ubuntu (WSL). Disabling the primitive did not help either.


So I am wondering: Is this a bug or totally fine (because you cannot hear a difference anyway)? If the latter is the case, how can I compare the sounds else in a reliable way? If I store outputSound again, the number of bytes is doubled again, so if you do certain operations, your image will blow up exponentially ...

<http://www.hpi.de/>

For the context of this question, see also: http://forum.world.st/Overriding-in-Graphics-and-Sounds-td5122783.html

Best,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201009/864a59f0/attachment-0001.html>


More information about the Squeak-dev mailing list