Forums > MaxMSP

### simulated pull-up resistor (make a signal slowly gravitate toward toward 1.0)

Mar 23 2011 | 11:00 pm

I have an audio signal that i’m using to modulate other signals. Sometimes it goes dead, stopping at a value of 0.0 — when this happens, it silences the other signals, which is not what i want. How do i make it so that if the signal goes dead, it pulls back to a value of 1. instead of 0. ?

Mar 23 2011 | 11:03 pm

If it just fluctuates between 0 and 1, then you could just invert it [!-~ 1] … so when it goes "dead" it’s on 1 instead of 0. Would that work?

Mar 23 2011 | 11:04 pm

i guess i could use a snapshot~ and a counter and a crossfader, and crossfade to a signal of 1 whenever it counts to a certain number of 0 values in a row. But this seems like a really janky solution. Surely there’s a more elegant way?

Mar 23 2011 | 11:06 pm

Tim — that’s a cool idea, but the signal actually fluctuates between -1. and +1. I’d rather not have to do like a system-wide overhaul where i change all of the signal values.

Mar 23 2011 | 11:09 pm

I guess i could do a temporary downsample to take the signal to the 0-1 range, then invert it, then upsample it back to standard. but then i would lose some audio resolution, right?

edit: just realized this wouldn’t work at all; when upsampled the "dead" signal would sit at .5 instead of 0 or 1.

Mar 24 2011 | 9:49 am

i think i know what you mean … but this is not possible with a
"dead" signal, you have to make sure that you know at which sample
(or vector) the modulation signal goes back to "no modulation" (i.e. 1).

then you have to replace this signal with the desired steady signal for
"no mnodulation".

i use two poly~n for this … one holding a [sig~ 1] and the other one
lets pass the signal which is comsing from the user control or LFO
or whatever. and when one is turned on – the other one is turned off.

Mar 24 2011 | 3:27 pm

What kind of modulation? If its amplitude modulation, just add a fixed value, and eventually scale it back.
In amplitude modulation you should avoid zero crossings anyway, as that would create a reversed phase…

Stefan

Mar 24 2011 | 5:33 pm

This is how I would do it…
According to what you use it for, you might want to smooth the jump back to the incoming value when it goes back to != 0
hth
aa

``````
-- Pasted Max  Patch, click to expand. --

```
```
Viewing 8 posts - 1 through 8 (of 8 total)

Forums > MaxMSP