<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    I think the original code was trying to do a crude resampling to
    reduce data processing requirements.&nbsp; Arguably it should actually
    *resample* down to some smaller number of samples, but instead it
    effectively just samples X bytes every so often and truncates the
    rest.&nbsp; This isn't so bad in practice, but appears not to suit your
    needs<br>
    <br>
    I would suggest you look at libsamplerate resampler on lowest
    quality or even go lower quality than that and just literally skip
    samples to achieve the resampling effect (equivalent to resampling
    with no windowing function, so expect aliasing junk to appear)<br>
    <br>
    Good luck<br>
    <br>
    Ed W<br>
    <br>
    <br>
    <br>
    On 16/12/2011 06:24, Martin Andrews wrote:
    <blockquote
cite="mid:CAC=uGpCjk4cs0=-pX+RyziNPN84wXjktx-iNyUZ3LCC_zHwdjw@mail.gmail.com"
      type="cite"><font class="Apple-style-span" face="arial, helvetica,
        sans-serif">I'm building a 'Piano' spectrum visualization, where
        the pitches detected directly correspond to piano key pitches.</font>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif"><br>
        </font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif">At the moment, the standard fps=20 means that I'm
          only seeing a fraction of the data in my .process(), since (at
          the moment) the&nbsp;<a moz-do-not-send="true" class="code"
href="http://code.mythtv.org/doxygen/classMainVisual.html#a0f7532480cfb1706438af7c1bf02f11c"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255);color:rgb(48,48,240);text-decoration:none">MainVisual::timeout</a>&nbsp;is
          discarding 'between the frame' nodes of audio data, choosing
          to only call .process() when it wants to .draw() the
          visualization.</font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif"><br>
        </font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif">However, for low notes on the piano, I need longer
          periods of audio data to get good recognition, so I'd like to
          run some kind of .process() even for non-displayed chunks of
          audio.</font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif"><br>
        </font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif">Since this feature doesn't seem to be present,
          what is the MythTV preferred way to implement this :</font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif"><br>
        </font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif">(a) Add an additional parameter to .process(node)
          : &nbsp;i.e. &nbsp;.process(node, will_be_displayed=true). &nbsp;But the
          downside of this is that other visualizations will have an
          extra 'ignore this one' choice to make; OR<br>
          <br>
        </font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif">(b) Add an additional virtual function to&nbsp;<a
            moz-do-not-send="true" class="code"
            href="http://code.mythtv.org/doxygen/classVisualBase.html"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255);color:rgb(48,48,240);text-decoration:none">VisualBase</a>&nbsp;:
          i.e. .process_between_displayed_frames(node), which no-one
          else will be hooking into, but I'll be able to use to analyze
          the whole audio stream. &nbsp;Downside is&nbsp;<a moz-do-not-send="true"
            class="code"
            href="http://code.mythtv.org/doxygen/classVisualBase.html"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255);color:rgb(48,48,240);text-decoration:none">VisualBase</a>&nbsp;gets
          a little hairier; OR</font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif"><br>
        </font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif">(c) Some method I haven't thought of.</font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif"><br>
        </font></div>
      <div><font class="Apple-style-span" face="arial, helvetica,
          sans-serif">Each will need a little something added into the
          loop of&nbsp;<a moz-do-not-send="true" class="code"
href="http://code.mythtv.org/doxygen/classMainVisual.html#a0f7532480cfb1706438af7c1bf02f11c"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255);color:rgb(48,48,240);text-decoration:none">MainVisual::timeout</a><span
            class="Apple-style-span"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)">()
            which is </span>discarding&nbsp;&nbsp;node data.</font></div>
      <div><span class="Apple-style-span"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)"><font
            class="Apple-style-span" face="arial, helvetica, sans-serif"><br>
          </font></span></div>
      <div>
        <span class="Apple-style-span"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)"><font
            class="Apple-style-span" face="arial, helvetica, sans-serif">An
            alternative (funky) workaround is to set fps high enough
            that I catch all the data. But that's pretty inefficient,
            since there's no need to refresh the screen at ~90fps
            (44100/512 looks like it would be chunk frequency).</font></span></div>
      <div><span class="Apple-style-span"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)"><font
            class="Apple-style-span" face="arial, helvetica, sans-serif"><br>
          </font></span></div>
      <div>
        <span class="Apple-style-span"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)"><font
            class="Apple-style-span" face="arial, helvetica, sans-serif">Could
            someone with an opinion please weigh in? I'll submit a patch
            vs SVN once it's looking classy...</font></span></div>
      <div><span class="Apple-style-span"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)"><font
            class="Apple-style-span" face="arial, helvetica, sans-serif"><br>
          </font></span></div>
      <div>
        <span class="Apple-style-span"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)"><font
            class="Apple-style-span" face="arial, helvetica, sans-serif">Thanks</font></span></div>
      <div><span class="Apple-style-span"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)"><font
            class="Apple-style-span" face="arial, helvetica, sans-serif">Martin</font></span></div>
      <div><span class="Apple-style-span"
style="font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)"><font
            class="Apple-style-span" face="arial, helvetica, sans-serif">:-)</font></span></div>
      <div>
        <span class="Apple-style-span"
style="font-family:monospace,fixed;font-size:12px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)"><br>
        </span></div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
mythtv-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mythtv-dev@mythtv.org">mythtv-dev@mythtv.org</a>
<a class="moz-txt-link-freetext" href="http://www.mythtv.org/mailman/listinfo/mythtv-dev">http://www.mythtv.org/mailman/listinfo/mythtv-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>