Forums > MaxMSP

specifying pulse width in samples

April 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?



ct
April 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


April 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/



ct
April 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!


April 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.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 124 185 72 196617 loadmess 888;
#P newex 162 34 66 196617 loadmess 16;
#P outlet 207 416 15 0;
#P outlet 175 415 15 0;
#P inlet 363 118 15 0;
#P inlet 342 118 15 0;
#P comment 171 209 115 196617 amount ( 0 – 1000 );
#P newex 162 82 27 196617 + 1;
#P number 124 208 45 9 0 1000 3 3 0 0 0 255 243 141 222 222 222 0 0 0;
#P newex 124 228 47 196617 * 0.002;
#P newex 81 252 36 196617 !-~ 1.;
#P newex 81 222 32 196617 *~ 1;
#P number 162 62 35 9 0 0 0 3 0 0 0 255 240 157 222 222 222 0 0 0;
#P newex 207 329 27 196617 *~;
#P newex 175 330 27 196617 *~;
#P number 115 143 29 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 81 75 15 0;
#P newex 81 142 30 196617 < ~ 1;
#P newex 81 102 91 196617 count~ 0 44100 1;
#P comment 200 64 32 196617 leap;
#P comment 387 118 100 196617 input;
#P comment 146 145 177 196617 for more fun , play with this one too.;
#P connect 17 0 8 1;
#P connect 8 0 19 0;
#P connect 11 0 7 0;
#P connect 11 0 8 0;
#P connect 16 0 7 1;
#P connect 7 0 18 0;
#P connect 14 0 3 1;
#P connect 9 0 14 0;
#P connect 20 0 9 0;
#P connect 13 0 12 0;
#P connect 21 0 13 0;
#P connect 12 0 10 1;
#P connect 6 0 4 1;
#P connect 10 0 11 0;
#P connect 4 0 10 0;
#P connect 3 0 4 0;
#P connect 5 0 3 0;
#P window clipboard copycount 22;


April 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
:)


Viewing 6 posts - 1 through 6 (of 6 total)