<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr">Hi Herbert, Hi Christoph,</div><div dir="ltr"><br><blockquote type="cite">On Oct 9, 2020, at 12:33 PM, Herbert König <herbertkoenig@gmx.net> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
Hi Christoph,<br>
<br>
maybe you hit upon a stereo representation with interleaved
channels? But then it should be 16 bit words, so not sure.<br></div></blockquote><div><br></div>That’s right. The sound output primitive takes interleaved (alternating left/right, signed) 16-bit samples. So the mix down methods mix from whatever the representation into this stereo representation.<div><br><blockquote type="cite"><div dir="ltr">
<br>
Cheers,<br>
<br>
Herbert<br>
<br>
storeWAVSamplesOn: aBinaryStream<br>
"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."<br>
<br>
<div class="moz-cite-prefix">Am 09.10.2020 um 18:19 schrieb Thiede,
Christoph:<br>
</div>
<blockquote type="cite" cite="mid:936dcefa487949d3aa4e5a89c6a46f0e@student.hpi.uni-potsdam.de">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi all,</p>
<p><br>
</p>
<p>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:</p>
<p><br>
</p>
<blockquote style="margin: 0 0 0 40px; border: none; padding:
0px;">
<div>sound := SampledSound new</div>
<div><span style="white-space:pre"></span>setSamples:
SampledSound coffeeCupClink</div>
<div><span style="white-space:pre"></span>samplingRate: 12000.</div>
<div><br>
</div>
<div>bytes := ByteArray streamContents: [:stream |</div>
<div><span style="white-space:pre"></span>sound
storeWAVSamplesOn: stream].</div>
<div><br>
</div>
<div>outputSound := SampledSound fromWaveStream: bytes
readStream binary.</div>
</blockquote>
<p><br>
</p>
<p>After running this script, I would expect <span style="font-family: Calibri, Helvetica, sans-serif,
EmojiFont, "Apple Color Emoji", "Segoe UI
Emoji", NotoColorEmoji, "Segoe UI Symbol",
"Android Emoji", EmojiSymbols; font-size: 16px;">
outputSound</span> 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 #<span>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.</span></p>
<p><span><br>
</span></p>
<p><span>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 </span><span style="font-family: Calibri, Arial,
Helvetica, sans-serif; font-size: 12pt;">store outputSound
again, the number of bytes is doubled again, so if you do
certain operations, your image will blow up exponentially
...</span></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:
12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica,
sans-serif, EmojiFont, "Apple Color Emoji",
"Segoe UI Emoji", NotoColorEmoji, "Segoe UI
Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:; margin:0">
<div>
<div class="_rp_T4" id="Item.MessagePartBody">
<div class="_rp_U4 ms-font-weight-regular
ms-font-color-neutralDark rpHighlightAllClass
rpHighlightBodyClass" id="Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe
UI","Segoe
WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple
Color Emoji,Segoe UI
Emoji,NotoColorEmoji,Segoe UI Symbol,Android
Emoji,EmojiSymbols">
<div id="Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont">
<div><font size="3" color="black"><span style="font-size:12pt"><a href="http://www.hpi.de/" target="_blank" rel="noopener
noreferrer" id="LPNoLP" moz-do-not-send="true"><font size="2"><span id="LPlnk909538"></span></font></a></span></font></div>
</font></div>
</div>
</font></div>
</div>
</div>
</div>
<div class="_rp_T4" id="Item.MessagePartBody"><br>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">For the
context of this question, see also: <a href="http://forum.world.st/Overriding-in-Graphics-and-Sounds-td5122783.html" class="OWAAutoLink" id="LPlnk760119" previewremoved="true" moz-do-not-send="true">http://forum.world.st/Overriding-in-Graphics-and-Sounds-td5122783.html</a></div>
<div class="_rp_T4" id="Item.MessagePartBody"><br>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">Best,</div>
<div class="_rp_T4" id="Item.MessagePartBody">Christoph</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap=""></pre>
</blockquote>
<br>
<span></span><br></div></blockquote></div></body></html>