changing the frequency of a phasor only when its output = 0


    May 22 2007 | 10:14 pm
    hi ,anyone has solved that problem?
    i include the following patch that explains what i want to do exactly.
    im trying to avoid making it with a signal vectorsize dependant logic (like with send~ - receive~ and a 1 sample svs for the feedback).
    i thought of using poke~ to write 1 sample per time in a buffer~ and then use index~ for playing it back 1 sample later but i cant get it to work.
    any opinions?
    thanks
    -peter
    (yx6@in.gr)
    max v2;

    • May 22 2007 | 10:49 pm
    • May 22 2007 | 11:28 pm
      thanks ,but i want a signal domain solution only (sample accurate)
      , because look for example what will happen if i do this :
      max v2;
    • May 23 2007 | 5:40 pm
      I've posted a patch within the last couple of weeks or so that
      demonstrates this sort of thing. Subject heading:
      Re: clicks using phasor~ and wave~
      Peter McCulloch
    • May 23 2007 | 7:40 pm
      stefan ,your patch outputs the attached waveforms in my pc.
      those are not straight phasor lines ,that means that the frequency doesnt change when the phase = 0 ,but on any phase.
      -peter
    • May 24 2007 | 6:45 am
      pierre schrieb:
      > stefan ,your patch outputs the attached waveforms in my pc. those are
      > not straight phasor lines ,that means that the frequency doesnt
      > change when the phase = 0 ,but on any phase.
      yes, I realised that, it seems you have to give the tapin~ an argument
      of at least 1, and then its almost there. it will still produce a signal
      vector delay...
      Stefan
      --
      Stefan Tiedje------------x-------
      --_____-----------|--------------
      --(_|_ ----|-----|-----()-------
      -- _|_)----|-----()--------------
      ----------()--------www.ccmix.com
    • May 25 2007 | 9:02 pm
      if all you're worried about is getting rid of clicks when you change the frequency, then just use a line~ object to drive the frequency inlet of your oscillator.
      if you tell me you can hear the difference between a signal that changes frequencies instantly when its amplitude is 0, and a signal that ramps from one frequency to another over half a millisecond, then i'd say you're lying.
      -scott
    • Jun 01 2007 | 7:15 pm
      who told you all those?
      i can hear the difference for sure ,because i use a low frequency phasor~ as an index to read from a buffer not as an audio oscillator itself.
    • Jun 02 2007 | 1:34 pm
      On 01 Jun 2007, at 21:15, pierre wrote:
      >
      > who told you all those?
      > i can hear the difference for sure ,because i use a low frequency
      > phasor~ as an index to read from a buffer not as an audio
      > oscillator itself.
      afaik, what you are after is not possible in plain maxmsp.
      i've put together a little external for my own needs, that does
      exaclty that: a phasor~ that changes its frequency only at phase 0.
      this is osx only and beta - but it works for what i'm doing.
      if you are still interested you can contact me off list.
      shouldn't be too hard to mock it up in java and mxj~ for
      crossplattform use.
      volker.
    • Jun 02 2007 | 4:24 pm
      >
      > afaik, what you are after is not possible in plain maxmsp.
      No, you definitely can do this in MSP, provided that the length in
      samples of the phasor going from 0-1 is not less than the signal
      vector. (and even if it is, it means that you grab a value every 2+
      vectors instead of every vector. At those speeds, you probably won't
      notice.)
      I'd be interested in your code. Here's a way of doing it in Max. It
      handles positive and negative frequencies and has a lockout feature
      around 0, so you can specify a minimum +/- value (e.g. 0.1,-0.1) to
      prevent uber-slow phasor frequencies
      max v2;
    • Jun 03 2007 | 12:27 pm
    • Jun 03 2007 | 9:02 pm
      > i'm sorry to disagree. the signal feedback method (which has been
      > proposed before) always has a latency
      > of at least 1 sig-vector, and therefor can't be precise.
      > i do agree however, that in most cases this is not audible and works
      > well enough - as in the example you provided.
      > but there are examples where it does matter (try changing loop-length
      > without altering playback-pitch e.g.).
      I understand the latency factor and that there's no getting around it
      from a theoretical perspective, but this almost never matters for the
      following reasons:
      - the played back material is almost always played with an envelope.
      - If you delay the output of the phasor~ using delay~ equal to the
      signal vector size and then run the remainder of your sah~ off of the
      trigger for the sah~ of the phasor~, they will now match up to within
      one sample.
      - because whatever phasor~ is reading through is most likely
      interpolated, or if not interpolated, not read through at a
      sample-by-sample rate, there will already be sampling artifacts.
      - the length of a signal vector can be manipulated using poly~. A
      latency of 1 signal vector when the signal vector is 4 is not much.
      The length of the signal vector is related to the maximum speed that
      you'll be using the phasor~ at. If you run at slower speeds, you can
      get by with a longer vector.
      Don't get me wrong, I think it would be nice to have an object that
      would work this way without all the extra fussing, but I do think it's
      worth it to see if you can come up with a solution without having to
      write a C external. The other thing to take into account is that if
      you write a C external and it interpolates cycle-lengths that are not
      integer length, then you're still going to have a very slight pitch
      drift issue in that some cycles will be one sample longer than other
      even though they have the same frequency. There's always noise in the
      system from sampling-rate to bit-depth. The big question is not how to
      get rid of it, but what is a tolerance you can live with. If you want
      to write an external for it, more power to you, and I look forward to
      it. In the meantime, here's some new code that works pretty well.
      At a signal vector of 4, I can't hear any artifacts, and the pitch is
      perfectly stable for frequencies -20 through 20 (haven't tried other
      vector sizes). If you keep going higher, eventually the pitch is going
      to drift because the wave is not stable enough for long enough to
      produce a decent pitch, but this is just the nature of sampling, not of
      this particular system. To further optimize it, you could wrap just
      the phasor~ and related code in a poly~.
      Just out of curiosity, what do you need the precision for? Reason
      being, phasor~ by its nature is imprecise. It interpolates on both x
      and y dimensions. If you want precision on both dimensions, then you
      use count~. What would be nice on count~ is to have a way to set the
      maximum at signal rate so that it's updated on the next cycle. Throw
      in a /~ and you have a sample accurate phasor.
      Peter McCulloch
      max v2;
    • Jun 05 2007 | 11:40 pm
      Hi Pierre, in the Pure Data examples, included there is an example how to do
      this. That is changing the frequency on the zero crossing.
      On 22/05/07, pierre wrote:
      >
      >
      > hi ,anyone has solved that problem?
      > i include the following patch that explains what i want to do exactly.
      >
      > im trying to avoid making it with a signal vectorsize dependant logic
      > (like with send~ - receive~ and a 1 sample svs for the feedback).
      > i thought of using poke~ to write 1 sample per time in a buffer~ and then
      > use index~ for playing it back 1 sample later but i cant get it to work.
      >
      > any opinions?
      >
      > thanks
      > -peter
      > (yx6@in.gr)
      >
      >
      > max v2;
      > #N vpatcher 15 55 740 541;
      > #P outlet 178 343 15 0;
      > #P window setfont "Sans Serif" 9.;
      > #P user number~ 255 61 294 76 9 139 3 1 0. 0. 0 45. 250 0. 0 0 0 221 221
      > 221 222 222 222 0 0 0;
      > #P newex 256 116 48 9109513 sah~ 0.01;
      > #P newex 179 208 54 9109513 pong~ 1 0 1;
      > #P newex 179 156 87 9109513 *~;
      > #P newex 178 92 48 9109513 phasor~ 1;
      > #P comment 197 343 100 9109513 my output;
      > #P comment 311 109 119 9109513 change the frequency only when the signal =
      > 0.01;
      > #P comment 298 61 119 9109513 > #P connect 5 0 8 0;
      > #P connect 3 0 4 0;
      > #P connect 4 0 5 0;
      > #P connect 7 0 6 0;
      > #P connect 6 0 4 1;
      > #P fasten 5 0 6 1 184 266 483 266 483 86 299 86;
      > #P pop;
      >
      >
      >
      --
      www.centuryofnoise.com
      www.perevillez.com