Re: Question about Audio Buffer/Timing

Jeremy Landry <[email protected]> Thu, 22 Feb 2018 11:32:22 -0800
Newsgroups gmane.comp.lang.smalltalk.squeak.squeakland
Message-ID <CAMYa41ng2-obctuUd-fS7g_bH56ouuSaQuD6mVGfUq1EnKokaA@mail.gmail.com>
--===============7099537194036604370==
Content-Type: multipart/alternative; boundary="001a113ec642511d5e0565d21a06"

--001a113ec642511d5e0565d21a06
Content-Type: text/plain; charset="UTF-8"

https://drive.google.com/file/d/1nJlQ4huXcKZmTm6GADl40ZrWAEd7Kv97/view?usp=sharing

This is a demo of the problem for ETOYS 5 (along with some other stuff
there that shows what I've looked into, to some degree).  Hitting play on
the scriptor, you will hear a sequence that has awful timing.  I don't
expect 'sample perfect', zero latency or anything spectacular, but it would
seem that if there's timers in the system, everything should adhere to it,
or else not be called timers and something like,
'when-we-get-around-to-its'.  This video here demonstrates that Squeak, at
least, can do timing just fine and older versions have midi demos, but
again, I'm using Etoys for a specific reason, so it's confusing me as to
why the delays happen...

Both sequencers are mouse interactive and playing with the script timer and
setting blocks on/off can reveal this hidden metronome...maybe that IS the
buffer?  I'm not sure...what's most puzzling is that sometimes it will
sound right, and sometimes it won't...even if it wasn't correct, I'd
probably be okay if it was consistently incorrect because I can actually
work with consistency, so I guess if nothing else, that's what I'm trying
to figure out how to get without making tile usage unavailable for a
sequencer built on etoys tiles...

Thanks for all the efforts so far...I did notice some changing in the
timing when I checked the preference there but also unchecked the
preference of stopSoundsWhenDone, just in case it was hiccuping by shutting
down the sound stream then making a new one.  It didn't help, but I had
forgotten about these preferences.







On Thu, Feb 22, 2018 at 10:57 AM, Bob Arning <[email protected]> wrote:

> There do seem to be some platform issues as to whether this will really
> work. Some things you could do:
>
> - check the value of the Preference for #soundQuickStart -- make it true
> if not already
>
> - put some code into the SoundPlayer method to tell you if quickStart is
> being requested and if not honored, why
>
> On 2/22/18 1:22 PM, Jeremy Landry wrote:
>
> Thanks for the crossover.  I am subscribed, but generally shy away from
> posting there as it seems out of my league and my main interest is in Etoys
> since, well, again, leagues and all that.  I know just enough ST to break
> things, not build them!  :)
>
> So using the code from this message from Bob Arning:
> *Bob Arning* arning315 at comcast.net
> <squeak-dev%40lists.squeakfoundation.org?Subject=Re%3A%20%5Bsqueak-dev%5D%20%5Bsqueakland%5D%20Question%20about%20Audio%20Buffer/Timing&In-Reply-To=%3C269cdd30-7c77-6cab-22aa-591eee543b21%40comcast.net%3E>
> *Thu Feb 22 15:49:07 UTC 2018*
>
>    - Previous message: [squeak-dev] [squeakland] Question about Audio
>    Buffer/Timing
>    <http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-February/197505.html>
>    - Next message: [squeak-dev] [squeakland] Question about Audio
>    Buffer/Timing
>    <http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-February/197509.html>
>    - *Messages sorted by:* [ date ]
>    <http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-February/date.html#197508>
>     [ thread ]
>    <http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-February/thread.html#197508>
>     [ subject ]
>    <http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-February/subject.html#197508>
>     [ author ]
>    <http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-February/author.html#197508>
>
> ------------------------------
>
> SoundPlayer class gives a clue:
>
> resumePlaying: aSound quickStart: quickStart
>      "Start playing the given sound without resetting it; it will resume
> playing from where it last stopped. If quickStart is true, then try to
> start playing the given sound immediately."
>
>
> Just looking at it and taking a guess, it doesn't seem to be *quite* the
> thing I was looking for.  I was thinking there's a method/class variable
> with a value that could be changed to affect the system, rather than
> 'poking in' every thing I want to play when I want to play it individually
> because the ultimate effect is that Etoys PLAYSOUND:SOUND tile will work as
> normal and this seems that it would have to be used instead of the
> tiles...I have no idea if this is possible, but I'll also dig around the
> class browser in Etoys, maybe I'll stumble into something, but so far, as I
> noted, I only found the sound-buffer and sample rates, not the imposed
> delay method that I remember reading about.  I remember the reasoning it
> was put in was to prevent accidental playing of sounds inside of a
> single-frame repeat-tile...i.e. a repeat tile with any value other than 1
> and inside of it having a playsound:sound tile would overload the speakers
> and make nasty noises because so many things are playing on top of each
> other. I actually WANT this.  Based on how sound plays now, you can hear an
> 'invisible' metronome that makes sure all sounds are separated and equally
> spaced apart and in the case of repeat tiles, only seems to accept the last
> sound as valid/playable.
>
> Thanks for the help so far!  I'm not expecting a solution because I don't
> know if one exists, but my thought is 'if it was done, it can be
> undone'...and just looking at how to undo it!  :p
>
>
>
> On Thu, Feb 22, 2018 at 9:59 AM, David T. Lewis <[email protected]>
> wrote:
>
>> There is some follow up discussion happening on the squeak-dev list. I
>> don't
>> know if it helps, but you can read the posts here if you are not
>> subscribed to
>> that list:
>>
>> http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-
>> February/197508.html
>>
>> HTH,
>> Dave
>>
>> On Thu, Feb 22, 2018 at 10:27:18AM -0500, David T. Lewis wrote:
>> > Hi Jeremy,
>> >
>> > I am copying this to the squeak-dev list in case someone there can offer
>> > some guidance.
>> >
>> > Dave
>> >
>> >
>> > On Wed, Feb 21, 2018 at 02:44:21PM -0800, Jeremy Landry wrote:
>> > > Hi, I made a quick audio sequencer test in Etoys and found that
>> there's a
>> > > hidden 'timer' that limits the responsiveness of new sounds that go
>> into
>> > > the playback buffer (terminology isn't accurate, but hopefully it
>> makes
>> > > sense to people).
>> > >
>> > > I found the sound buffer setting, but was wondering if there's
>> something
>> > > else that limits how fast new sounds get added to the playback
>> stream? I
>> > > read somewhere (old-man-aphasia here) that some code was added to
>> prevent
>> > > overloading the buffer so surely there's a snippet of code I could
>> add to a
>> > > project to reverse this, if it's what is causing the delay?
>> > >
>> > > Thanks for any help finding the solution.
>> >
>> > > _______________________________________________
>> > > squeakland mailing list
>> > > squeakland-bD51WKytQuId/fn+uklp/[email protected]
>> > > http://lists.squeakland.org/mailman/listinfo/squeakland
>> >
>> > _______________________________________________
>> > squeakland mailing list
>> > squeakland-bD51WKytQuId/fn+uklp/[email protected]
>> > http://lists.squeakland.org/mailman/listinfo/squeakland
>>
>
>
>
> _______________________________________________
> squeakland mailing listsqueakland-bD51WKytQuId/fn+uklp/[email protected]://lists.squeakland.org/mailman/listinfo/squeakland
>
>
>
> _______________________________________________
> squeakland mailing list
> squeakland-bD51WKytQuId/fn+uklp/[email protected]
> http://lists.squeakland.org/mailman/listinfo/squeakland
>
>

--001a113ec642511d5e0565d21a06
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><a href=3D"https://drive.google.com/file/d/1nJlQ4huXcKZmTm=
6GADl40ZrWAEd7Kv97/view?usp=3Dsharing">https://drive.google.com/file/d/1nJl=
Q4huXcKZmTm6GADl40ZrWAEd7Kv97/view?usp=3Dsharing</a><br><div><br></div><div=
>This is a demo of the problem for ETOYS 5 (along with some other stuff the=
re that shows what I&#39;ve looked into, to some degree).=C2=A0 Hitting pla=
y on the scriptor, you will hear a sequence that has awful timing.=C2=A0 I =
don&#39;t expect &#39;sample perfect&#39;, zero latency or anything spectac=
ular, but it would seem that if there&#39;s timers in the system, everythin=
g should adhere to it, or else not be called timers and something like, &#3=
9;when-we-get-around-to-its&#39;.=C2=A0 This video here demonstrates that S=
queak, at least, can do timing just fine and older versions have midi demos=
, but again, I&#39;m using Etoys for a specific reason, so it&#39;s confusi=
ng me as to why the delays happen...</div><div><br></div><div>Both sequence=
rs are mouse interactive and playing with the script timer and setting bloc=
ks on/off can reveal this hidden metronome...maybe that IS the buffer?=C2=
=A0 I&#39;m not sure...what&#39;s most puzzling is that sometimes it will s=
ound right, and sometimes it won&#39;t...even if it wasn&#39;t correct, I&#=
39;d probably be okay if it was consistently incorrect because I can actual=
ly work with consistency, so I guess if nothing else, that&#39;s what I&#39=
;m trying to figure out how to get without making tile usage unavailable fo=
r a sequencer built on etoys tiles...</div><div><br></div><div>Thanks for a=
ll the efforts so far...I did notice some changing in the timing when I che=
cked the preference there but also unchecked the preference of stopSoundsWh=
enDone, just in case it was hiccuping by shutting down the sound stream the=
n making a new one.=C2=A0 It didn&#39;t help, but I had forgotten about the=
se preferences.</div><div><br></div><div><br></div><div><br></div><div>=C2=
=A0=C2=A0</div><div><br></div><div><br></div></div><div class=3D"gmail_extr=
a"><br><div class=3D"gmail_quote">On Thu, Feb 22, 2018 at 10:57 AM, Bob Arn=
ing <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a>&gt;</span> wrote:<br><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex">
 =20
   =20
 =20
  <div text=3D"#000000" bgcolor=3D"#FFFFFF">
    <p><font face=3D"Georgia">There do seem to be some platform issues as
        to whether this will really work. Some things you could do:</font><=
/p>
    <p><font face=3D"Georgia">- check the value of the Preference for
        #soundQuickStart -- make it true if not already</font></p>
    <p><font face=3D"Georgia">- put some code into the SoundPlayer method
        to tell you if quickStart is being requested and if not honored,
        why</font><br>
    </p><div><div class=3D"h5">
    <br>
    <div class=3D"m_4959563591284099764moz-cite-prefix">On 2/22/18 1:22 PM,=
 Jeremy Landry
      wrote:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr">Thanks for the crossover.=C2=A0 I am subscribed, but
        generally shy away from posting there as it seems out of my
        league and my main interest is in Etoys since, well, again,
        leagues and all that.=C2=A0 I know just enough ST to break things,
        not build them!=C2=A0 :)
        <div><br>
        </div>
        <div>So using the code from this message from Bob Arning:</div>
        <div>
          <b>Bob
            Arning</b><span><span>=C2=A0</span></span><a href=3D"mailto:squ=
eak-dev%40lists.squeakfoundation.org?Subject=3DRe%3A%20%5Bsqueak-dev%5D%20%=
5Bsqueakland%5D%20Question%20about%20Audio%20Buffer/Timing&amp;In-Reply-To=
=3D%3C269cdd30-7c77-6cab-22aa-591eee543b21%40comcast.net%3E" title=3D"[sque=
ak-dev] [squeakland] Question about Audio
            Buffer/Timing" target=3D"_blank">arning315 at comcast.net<span>=
=C2=A0</span></a><br>
          <i>Thu
            Feb 22 15:49:07 UTC 2018</i><span></span>
          <ul>
            <li>Previous message:<span>=C2=A0</span><a href=3D"http://lists=
.squeakfoundation.org/pipermail/squeak-dev/2018-February/197505.html" targe=
t=3D"_blank">[squeak-dev] [squeakland]
                Question about Audio Buffer/Timing</a></li>
            <li>Next message:<span>=C2=A0</span><a href=3D"http://lists.squ=
eakfoundation.org/pipermail/squeak-dev/2018-February/197509.html" target=3D=
"_blank">[squeak-dev] [squeakland]
                Question about Audio Buffer/Timing</a></li>
            <li><b>Messages sorted by:</b><span>=C2=A0</span><a href=3D"htt=
p://lists.squeakfoundation.org/pipermail/squeak-dev/2018-February/date.html=
#197508" target=3D"_blank">[ date ]</a><span>=C2=A0</span><a href=3D"http:/=
/lists.squeakfoundation.org/pipermail/squeak-dev/2018-February/thread.html#=
197508" target=3D"_blank">[ thread ]</a><span>=C2=A0</span><a href=3D"http:=
//lists.squeakfoundation.org/pipermail/squeak-dev/2018-February/subject.htm=
l#197508" target=3D"_blank">[ subject ]</a><span>=C2=A0</span><a href=3D"ht=
tp://lists.squeakfoundation.org/pipermail/squeak-dev/2018-February/author.h=
tml#197508" target=3D"_blank">[ author ]</a></li>
          </ul>
          <hr>
          <pre style=3D"color:rgb(0,0,0);font-style:normal;font-variant-lig=
atures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:norma=
l;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;bac=
kground-color:rgb(255,255,255);text-decoration-style:initial;text-decoratio=
n-color:initial">SoundPlayer class gives a clue:

resumePlaying: aSound quickStart: quickStart
 =C2=A0=C2=A0=C2=A0 &quot;Start playing the given sound without resetting i=
t; it will resume=20
playing from where it last stopped. If quickStart is true, then try to=20
start playing the given sound immediately.&quot;
</pre>
          <br class=3D"m_4959563591284099764gmail-Apple-interchange-newline=
">
          Just looking at it and taking a guess, it doesn&#39;t seem to be
          *quite* the thing I was looking for.=C2=A0 I was thinking there&#=
39;s a
          method/class variable with a value that could be changed to
          affect the system, rather than &#39;poking in&#39; every thing I =
want
          to play when I want to play it individually because the
          ultimate effect is that Etoys PLAYSOUND:SOUND tile will work
          as normal and this seems that it would have to be used instead
          of the tiles...I have no idea if this is possible, but I&#39;ll
          also dig around the class browser in Etoys, maybe I&#39;ll stumbl=
e
          into something, but so far, as I noted, I only found the
          sound-buffer and sample rates, not the imposed delay method
          that I remember reading about.=C2=A0 I remember the reasoning it
          was put in was to prevent accidental playing of sounds inside
          of a single-frame repeat-tile...i.e. a repeat tile with any
          value other than 1 and inside of it having a playsound:sound
          tile would overload the speakers and make nasty noises because
          so many things are playing on top of each other. I actually
          WANT this.=C2=A0 Based on how sound plays now, you can hear an
          &#39;invisible&#39; metronome that makes sure all sounds are sepa=
rated
          and equally spaced apart and in the case of repeat tiles, only
          seems to accept the last sound as valid/playable.</div>
        <div><br>
        </div>
        <div>Thanks for the help so far!=C2=A0 I&#39;m not expecting a solu=
tion
          because I don&#39;t know if one exists, but my thought is &#39;if=
 it
          was done, it can be undone&#39;...and just looking at how to undo
          it!=C2=A0 :p=C2=A0=C2=A0</div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class=3D"gmail_extra"><br>
        <div class=3D"gmail_quote">On Thu, Feb 22, 2018 at 9:59 AM, David
          T. Lewis <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]=
com" target=3D"_blank">[email protected]</a>&gt;</span>
          wrote:<br>
          <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex">There is
            some follow up discussion happening on the squeak-dev list.
            I don&#39;t<br>
            know if it helps, but you can read the posts here if you are
            not subscribed to<br>
            that list:<br>
            <br>
            <a href=3D"http://lists.squeakfoundation.org/pipermail/squeak-d=
ev/2018-February/197508.html" rel=3D"noreferrer" target=3D"_blank">http://l=
ists.squeakfoundation.<wbr>org/pipermail/squeak-dev/2018-<wbr>February/1975=
08.html</a><br>
            <br>
            HTH,<br>
            Dave<br>
            <div class=3D"m_4959563591284099764HOEnZb">
              <div class=3D"m_4959563591284099764h5"><br>
                On Thu, Feb 22, 2018 at 10:27:18AM -0500, David T. Lewis
                wrote:<br>
                &gt; Hi Jeremy,<br>
                &gt;<br>
                &gt; I am copying this to the squeak-dev list in case
                someone there can offer<br>
                &gt; some guidance.<br>
                &gt;<br>
                &gt; Dave<br>
                &gt;<br>
                &gt;<br>
                &gt; On Wed, Feb 21, 2018 at 02:44:21PM -0800, Jeremy
                Landry wrote:<br>
                &gt; &gt; Hi, I made a quick audio sequencer test in
                Etoys and found that there&#39;s a<br>
                &gt; &gt; hidden &#39;timer&#39; that limits the responsive=
ness
                of new sounds that go into<br>
                &gt; &gt; the playback buffer (terminology isn&#39;t
                accurate, but hopefully it makes<br>
                &gt; &gt; sense to people).<br>
                &gt; &gt;<br>
                &gt; &gt; I found the sound buffer setting, but was
                wondering if there&#39;s something<br>
                &gt; &gt; else that limits how fast new sounds get added
                to the playback stream? I<br>
                &gt; &gt; read somewhere (old-man-aphasia here) that
                some code was added to prevent<br>
                &gt; &gt; overloading the buffer so surely there&#39;s a
                snippet of code I could add to a<br>
                &gt; &gt; project to reverse this, if it&#39;s what is
                causing the delay?<br>
                &gt; &gt;<br>
                &gt; &gt; Thanks for any help finding the solution.<br>
                &gt;<br>
                &gt; &gt; ______________________________<wbr>______________=
___<br>
                &gt; &gt; squeakland mailing list<br>
                &gt; &gt; <a href=3D"mailto:squeakland-bD51WKytQuId/fn+uklp/[email protected]=
" target=3D"_blank">squeakland-bD51WKytQuId/fn+uklp/[email protected]<wbr>g</a><br>
                &gt; &gt; <a href=3D"http://lists.squeakland.org/mailman/li=
stinfo/squeakland" rel=3D"noreferrer" target=3D"_blank">http://lists.squeak=
land.org/ma<wbr>ilman/listinfo/squeakland</a><br>
                &gt;<br>
                &gt; ______________________________<wbr>_________________<b=
r>
                &gt; squeakland mailing list<br>
                &gt; <a href=3D"mailto:squeakland-bD51WKytQuId/fn+uklp/[email protected]" tar=
get=3D"_blank">squeakland-bD51WKytQuId/fn+uklp/[email protected]<wbr>g</a><br>
                &gt; <a href=3D"http://lists.squeakland.org/mailman/listinf=
o/squeakland" rel=3D"noreferrer" target=3D"_blank">http://lists.squeakland.=
org/ma<wbr>ilman/listinfo/squeakland</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class=3D"m_4959563591284099764mimeAttachmentHeader"></field=
set>
      <br>
      <pre>______________________________<wbr>_________________
squeakland mailing list
<a class=3D"m_4959563591284099764moz-txt-link-abbreviated" href=3D"mailto:s=
queakland-bD51WKytQuId/fn+uklp/[email protected]" target=3D"_blank">[email protected]=
nd.<wbr>org</a>
<a class=3D"m_4959563591284099764moz-txt-link-freetext" href=3D"http://list=
s.squeakland.org/mailman/listinfo/squeakland" target=3D"_blank">http://list=
s.squeakland.org/<wbr>mailman/listinfo/squeakland</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

<br>______________________________<wbr>_________________<br>
squeakland mailing list<br>
<a href=3D"mailto:squeakland-bD51WKytQuId/fn+uklp/[email protected]">squeakland-bD51WKytQuLPboN/[email protected]=
and.<wbr>org</a><br>
<a href=3D"http://lists.squeakland.org/mailman/listinfo/squeakland" rel=3D"=
noreferrer" target=3D"_blank">http://lists.squeakland.org/<wbr>mailman/list=
info/squeakland</a><br>
<br></blockquote></div><br></div>

--001a113ec642511d5e0565d21a06--

--===============7099537194036604370==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18Kc3F1ZWFrbGFu
ZCBtYWlsaW5nIGxpc3QKc3F1ZWFrbGFuZEBsaXN0cy5zcXVlYWtsYW5kLm9yZwpodHRwOi8vbGlz
dHMuc3F1ZWFrbGFuZC5vcmcvbWFpbG1hbi9saXN0aW5mby9zcXVlYWtsYW5kCg==

--===============7099537194036604370==--