[squeak-dev] Question about SoundGenerationPlugin/mixSampleCount

Herbert König herbertkoenig at gmx.net
Fri Oct 9 19:33:46 UTC 2020


Hi Christoph,

maybe you hit upon a stereo representation with interleaved channels?
But then it should be 16 bit words, so not sure.

Cheers,

Herbert

storeWAVSamplesOn: aBinaryStream
     "Store this sound as a 16-bit Windows WAV file at the current
SoundPlayer sampling rate. Store both channels if self isStereo is true;
otherwise, store the left channel only as a mono sound."

Am 09.10.2020 um 18:19 schrieb Thiede, Christoph:
>
> 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/a364fa68/attachment.html>


More information about the Squeak-dev mailing list