specifying pulse width in samples


    Apr 26 2006 | 2:51 am
    hi everybody.
    my first post :)
    i want to duplicate the effect of the 'polarizer' vst by destroyfx ( http://destroyfx.smartelectronix.com/extras/ ), which seems to do the following: it takes every nth sample and multiplies it by -1 (it does a bit more than that but let's start by duplicating that effect). To accomplish this i need to be able to make a pulse wave where i specify the period and pulse width in samples. Once i can do that it's trivial to scale the pulse to the range i want it to have.
    i tried using the ==~ object on a phasor~ but that didn't do it, i'm afraid (i used 0.4 as the argument btw, tho it shouldn't matter). I also tried using >~ 0.99999 but that didn't really work either. with 5 digits it made a really minor difference, and with less digits it really worked pitifully.
    is this possible?

    • Apr 26 2006 | 8:53 am
      hi george, not sure i understood your question, btw: phasor~ doesn't output a line between 0. and 1., (there's some waving at the end of the ramp i think you can see this if you record in a buffer~ its output and have a look at it in your wave editor). but IMHO
      phasor~ (with phase 2nd inlet set to 0.5) ==~ 0.5 +~ 1. gate~ 2
      should work (i'm not sure cos i don't have msp on this machine) you'll have a ramp that starts at 0.5, opening gate~ outlet 2 (because of ==~ 0.5) after which you should place a *~ -1. to accomplish your task of multipling by -1 every N samples. the frequency of the phasor~ specifies N.
      either you could try using a conbination of multislider-iter-trigger-counter-peek~ to specify 512 samples (with multislider) whose values are between 0 and 1 only. every time you change a value in the multislider iter (after which you place a "t b i" + "counter 0 0 511" to index the values of multislider in peek~) routes their values to peek~. then put the peeked multislider in cycle~ and you'll (hopefully) have a waveform that change between 0 and 1 the way you like it to do.
      also rect~ generates pulses with variable pulsewidth. hope this helps.
      cheers
    • Apr 26 2006 | 11:27 am
      On 26-Apr-2006, at 10:53, Corrado Tirelli wrote:
      > phasor~ (with phase 2nd inlet set to 0.5) > ==~ 0.5
      you might find [>~ 0.5] -> change~ more reilable.
      Number one rule for beginners: avoid ==~ and == with floating point values unless you understand floating point idiosyncracies. Two floats are almost never equal, just close. Particularly with signals.
      > +~ 1. > gate~ 2
      -------------- http://www.bek.no/~pcastine/Litter/ ------------- Peter Castine +--> Litter Power & Litter Bundle for Jitter
      iCE: Sequencing, Recording & |home | chez nous| Interface Building for |bei uns | i nostri| Max/MSP Extremely cool http://www.castine.de http://www.dspaudio.com/
    • Apr 26 2006 | 1:03 pm
      >Number one rule for beginners: avoid ==~ and == with floating point >values unless you understand floating point idiosyncracies. Two >floats are almost never equal, just close. Particularly with >signals.
      much appreciated, thanks!
    • Apr 28 2006 | 10:42 am
      On 26 Apr 2006, at 04:51, George Locke wrote: > i want to duplicate the effect of the 'polarizer' vst by destroyfx > ( http://destroyfx.smartelectronix.com/extras/ ), which seems to do > the following: it takes every nth sample and multiplies it by -1 > (it does a bit more than that but let's start by duplicating that > effect). To accomplish this i need to be able to make a pulse wave > where i specify the period and pulse width in samples. Once i can > do that it's trivial to scale the pulse to the range i want it to > have. > > i tried using the ==~ object on a phasor~ but that didn't do it, > i'm afraid (i used 0.4 as the argument btw, tho it shouldn't > matter). I also tried using >~ 0.99999 but that didn't really work > either. with 5 digits it made a really minor difference, and with > less digits it really worked pitifully. > > is this possible?
      yes, but i wouln't try using a phasor~ but [count~] and [ below is an emulation of this polarizer effect (without "implosion"). volker.
    • Apr 28 2006 | 3:05 pm
      awesome. i was just going to post that i htink count~ might work, but you've confirmed it. rockin. my first query to the list is hereby solved :)