Menu

#311 block~-overlapped canvases: samplerate wrong for dsp objects

v0.41
open
puredata (322)
7
2019-12-28
2008-06-28
No

There's a strange behavior in canvases with overlapped blocks without resampling (e.g. set with [block~ 1024 2]).
In such canvases e.g. [osc~ 440] delivers a cosine wave with an actual frequency of 220 Hz, because of the double overlap.
This is because dsp signal vectors carry the wrong sample rate (sp[0]->s_sr = 88200 instead of 44100).
[samplerate~] correctly reports 44100 because it uses a different method of retrieving the sample rate.

For osc~ it's possible to take into account the wrong internal sample rate, but that's certainly not possible in more general cases.

Discussion

  • Thomas Grill

    Thomas Grill - 2008-06-28
    • priority: 5 --> 7
    • assigned_to: nobody --> millerpuckette
     
  • IOhannes m zmölnig

    • labels: 680483 --> puredata
     
  • IOhannes m zmölnig

    i always wanted to have the samplerate & the overlap factor within the signal-structure (with samplerate being the "real" samplerate times all the upsampling)

     
  • mrshpot

    mrshpot - 2019-12-28

    I have encountered this when playing with FFTs, and wonder why it's like this.
    The behavior is directly traceable to d_ugen.c which says:
    srate = parent_srate * realoverlap * upsample / downsample;

    The * upsample / downsample part makes total sense to me, but I don't understand why realoverlap is folded into the samplerate. Could you explain why?

     
    • IOhannes m zmölnig

      Am 28. Dezember 2019 11:35:53 MEZ schrieb mrshpot mrshpot@users.sourceforge.net:

      I have encountered this when playing with FFTs, and wonder why it's
      like this.
      The behavior is directly traceable to d_ugen.c which says:
      srate = parent_srate * realoverlap * upsample / downsample;

      The * upsample / downsample part makes total sense to me, but I don't
      understand why realoverlap is folded into the samplerate. Could you
      explain why?

      "samplerate" is really just a measure of how many samples you process in a given timespan.

      if you have an overlap-factor of 2, you get:

      AB
       BC
        CD
      

      so in 1 second, Pd has to process (44100/2+44100+44100/2) samples. which makes a total of 88200 samples.

      given the above, it's obvious that you process twice as much samples (on a second, or any given timespan) with[block * 2] than with [block * 1], that's why samplerate doubles as well...

      (indeed, there's a loss of information)

       

Anonymous
Anonymous

Add attachments
Cancel