<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    I changed playLoop to just copy the current SoundBuffer into a
    collection. I got some 11 seconds sound (2 below) <br>
    Each buffer I differentiated and took the abs value. (see attached
    st) <br>
    Of those I took the max. In case of wraparound that would be close
    to 64k.  <br>
    The zeroes in these buffers are the clippings. (3 below) Again I
    took the max. (4 below). <br>
    <br>
    I can't email screenshots from the Pi but I did it on a Pi too. I
    used Tim's first snippet. I found a lot of clipping inside Squeak
    and not a single wraparound in several attempts.<br>
    <br>
    Same observation id waggling the Keyboard or playing my 6 voiced C
    major while waggling the keyboard morph.<br>
    <br>
    On the Pi3 I still lost buffers (getting 7 seconds worth of buffers
    from 10+ seconds of Audio). I would not search in the Squeak
    Smalltalk code for the problem but would suspect the primitive where
    Squeak hands the output to Raspbian. <br>
    <br>
    That said clipping still makes for horrible sound (SCNR :-).<br>
    <br>
    Cheers,<br>
    <br>
    Herbert<br>
    <br>
    <br>
    <img src="cid:part1.6A32D190.09CC0445@gmx.net" alt="">
    <div class="moz-cite-prefix">Am 29.12.2020 um 12:38 schrieb Herbert
      König:<br>
    </div>
    <blockquote type="cite"
      cite="mid:4cfccf9d-aa05-60df-fc70-7ce8b8665516@gmx.net">
      <br>
      <br>
      Am 28.12.2020 um 22:48 schrieb tim Rowledge:
      <br>
      <blockquote type="cite">
        <blockquote type="cite">On 2020-12-28, at 10:36 AM, Herbert
          <a class="moz-txt-link-rfc2396E" href="mailto:herbertkoenig@gmx.net"><herbertkoenig@gmx.net></a> wrote:
          <br>
          <br>
          Inside Squeak I saw a lot of clipping as expected, outside I
          saw
          <br>
          wrapping whenever it clipped inside.
          <br>
        </blockquote>
        That would be an interesting thing to prove conclusively. It's
        not unimagineable that there could be a bug in a unix sound
        library.
        <br>
      </blockquote>
      I'd suspect the Squeak primitive that hands the buffers to the OS
      before
      <br>
      looking into OS code.
      <br>
      <br>
      Would it be conclusive to record the outside for a minute or so,
      read
      <br>
      that file and count wrapping
      <br>
      (sample(n) = +fullscale and sample(n+1) = -fullscale) or
      (sample(n) =
      <br>
      -fullscale and sample(n+1) = +fullscale)
      <br>
      and do the same for all SoundBuffers we get hold of inside Squeak
      during
      <br>
      the recording? (repeatedly checking SoundBuffer allInstances)
      <br>
      <br>
      <blockquote type="cite">Maybe if we make a crafted sound buffer
        with a clean waveform that we know never gets clipped but does
        hit the maxval/minval and play it directly with no mixing
        related calls (because the mixer code does volume scaling etc
        and internal clipping) we might see what comes out of pulseaudio
        and indeed alsa.
        <br>
      </blockquote>
      AbstractSound or the like has a class var Sine with that but I
      feel
      <br>
      that's directed at finding a bug in the OS and discards the
      possibility
      <br>
      of Squeak messing it up. And the organ sounds used are predictable
      <br>
      enough re clipping but I hope the individual envelopes add some
      <br>
      randomness to cover more cases.
      <br>
      <br>
      Cheers,
      <br>
      <br>
      Herbert
      <br>
      <br>
      <br>
    </blockquote>
    <br>
  </body>
</html>