<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to make a slider have a limit and change direction?]]></title><description><![CDATA[<p>Ok, here's a better explanation. 4.414 is zero (value at which the pitch of my sample is unaffected). I want to have a slider that can go either above 4.414 or below to set a limit. If the number is under 4.414 the number decreases going below up to that limit number (in this example limit is 0.885)</p>
<p>And I'd like it to do the opposite direction, so that if the slider is above 4.414 the number would increase up to the limit, (on this second example 2.070)</p>
<p>Once it hits the limit stays at that value until. I press stop and it resets.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction</link><generator>RSS for Node</generator><lastBuildDate>Thu, 14 May 2026 08:26:32 GMT</lastBuildDate><atom:link href="http://forum.pdpatchrepo.info/topic/13780.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 13 Jan 2022 04:02:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to make a slider have a limit and change direction? on Thu, 13 Jan 2022 04:02:45 GMT]]></title><description><![CDATA[<p>Ok, here's a better explanation. 4.414 is zero (value at which the pitch of my sample is unaffected). I want to have a slider that can go either above 4.414 or below to set a limit. If the number is under 4.414 the number decreases going below up to that limit number (in this example limit is 0.885)</p>
<p>And I'd like it to do the opposite direction, so that if the slider is above 4.414 the number would increase up to the limit, (on this second example 2.070)</p>
<p>Once it hits the limit stays at that value until. I press stop and it resets.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction</guid><dc:creator><![CDATA[eblanc88]]></dc:creator><pubDate>Thu, 13 Jan 2022 04:02:45 GMT</pubDate></item><item><title><![CDATA[Reply to How to make a slider have a limit and change direction? on Thu, 13 Jan 2022 04:05:06 GMT]]></title><description><![CDATA[<p><img src="/uploads/files/1642046656145-pitich-down.png" alt="pitich down.PNG" class="img-responsive img-markdown" /> <img src="/uploads/files/1642046661260-pitch-up.png" alt="pitch up.PNG" class="img-responsive img-markdown" /></p>
<p>I've been having trouble wrapping my head around how to start with this.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/2</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/2</guid><dc:creator><![CDATA[eblanc88]]></dc:creator><pubDate>Thu, 13 Jan 2022 04:05:06 GMT</pubDate></item><item><title><![CDATA[Reply to How to make a slider have a limit and change direction? on Fri, 14 Jan 2022 20:49:43 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/eblanc88">@eblanc88</a> This might not be exactly what you are looking for, but will introduce you to some other tools.<br />
The limits for faders can be set in their properties....... right-click the fader to open the properties.<br />
<a href="/uploads/files/1642056984201-fader_lim.pd">fader_lim.pd</a><br />
David.<br />
<img src="/uploads/files/1642057023852-capture.jpg" alt="Capture.JPG" class="img-responsive img-markdown" /></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/3</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/3</guid><dc:creator><![CDATA[whale-av]]></dc:creator><pubDate>Fri, 14 Jan 2022 20:49:43 GMT</pubDate></item><item><title><![CDATA[Reply to How to make a slider have a limit and change direction? on Fri, 21 Jan 2022 19:39:41 GMT]]></title><description><![CDATA[<p>you solve this kind of range conversion stuff like you should solve most prgoramming problems anyway: break the problem down into smaller parts.</p>
<ol>
<li>
<p>what range has the GUI element and what does this represent? aha.</p>
</li>
<li>
<p>what numbers you want to get of it in the end and what do they represent? so so.</p>
</li>
<li>
<p>now if you dont get the conversion to work by rule of three kind of equations, the chance is high that it is a combination of more than one times rule of three.</p>
</li>
<li>
<p>and when you notice that &quot;playspeed&quot; has the habit to work differently below 0. than above 0., try to do this conversion using 0.-2. first, and not with the values currently required for a specific app.</p>
</li>
</ol>
<p>i could tell you something about your specific patch, too, but i dont understand it.  (is there no [slide] object for pd?)</p>
<p>however, in case you are doing somethign with picth modulation it is in most (yet not in all) situations more useful to do what you want to do on the linear layer, i.e. -&gt; ftom -&gt; myalgorithm -&gt; mtof -&gt;</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/4</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/4</guid><dc:creator><![CDATA[Obineg]]></dc:creator><pubDate>Fri, 21 Jan 2022 19:39:41 GMT</pubDate></item><item><title><![CDATA[Reply to How to make a slider have a limit and change direction? on Fri, 21 Jan 2022 19:38:27 GMT]]></title><description><![CDATA[<p>and while GUI objects might be able to understand a message to set new min and max values, it is not good practice to use this feature to perform math operations.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/5</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/5</guid><dc:creator><![CDATA[Obineg]]></dc:creator><pubDate>Fri, 21 Jan 2022 19:38:27 GMT</pubDate></item><item><title><![CDATA[Reply to How to make a slider have a limit and change direction? on Sat, 22 Jan 2022 02:26:56 GMT]]></title><description><![CDATA[<p>Obineg says: &quot;and while GUI objects might be able to understand a message to set new min and max values, it is not good practice to use this feature to perform math operations&quot;</p>
<p>I'd absolutely agree with this. Program logic should be program logic. GUIs should be for input or display. GUIs should not be performing program logic!</p>
<p>For that matter, sliders' min/max limits don't apply to values coming in:</p>
<p><img src="/uploads/files/1642817846772-pd-gui-limits.png" alt="pd-gui-limits.png" class="img-responsive img-markdown" /></p>
<p>The slider has set a limit max = 127. I sent in the number 150, and the slider sent out the number... 150. <em>Not</em> clipped to 127.</p>
<p>So you <em>cannot</em> use the GUI to enforce numeric limits at all. That is, the title of this thread is already leading in the wrong direction. A slider having a limit is irrelevant to what you're trying to do.</p>
<p>It seems like you're looking for an increment/decrement behavior that stops once it reaches a certain value (and then maybe triggers a different increment/decrement -- though this is unclear in your description because you say both &quot;and change direction&quot; and &quot;once it hits the limit stays at that value until I press stop&quot;).</p>
<p>So, first, increment and decrement. You have the right idea with the float box. You don't need both a [+] and a [-] box because you can set the second operand: you can [+ 0.01] or [+ -0.01] using the same object.</p>
<p>Then, you need something that will decide whether the number is in range or out of range, i.e., you need numeric comparisons. I like [moses] for this but you could also use [&gt;], [&lt;] if you wanted.</p>
<p>So the way I would design &quot;increment or decrement, and stop when the value goes out of range&quot; might be like this.</p>
<p><img src="/uploads/files/1642818413075-pd-incr-limit.png" alt="pd-incr-limit.png" class="img-responsive img-markdown" /></p>
<p><em>Both</em> buttons set the same initial value and start the metronome. The third outlet of the [t b b b] objects sets the up or down direction. Remember [t] outputs right to left, so the order is: 1/ set direction, 2/ set counter initial value, 3/ run the [metro].</p>
<p>At the top right is the &quot;stop&quot; signal (triggered by a too-low or too-high value). If you wanted to trigger some other action, you could put that here.</p>
<p>hjh</p>
<p>PS (edit) Actually the initializer could have slightly fewer crossing wires by splitting the [t] objects:</p>
<p><img src="/uploads/files/1642818413075-pd-incr-limit.png" alt="pd-incr-limit.png" class="img-responsive img-markdown" /></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/6</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/6</guid><dc:creator><![CDATA[ddw_music]]></dc:creator><pubDate>Sat, 22 Jan 2022 02:26:56 GMT</pubDate></item><item><title><![CDATA[Reply to How to make a slider have a limit and change direction? on Sat, 22 Jan 2022 06:25:34 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/ddw_music">@ddw_music</a> I am not certain but maybe [line] is more efficient than [metro] as in my post above...... but it probably doesn't matter for such a simple application.<br />
Yes the slider GUI does not impose limits, but is useful for display purposes.  But changing that programmatically usually just adds confusion for the observer.<br />
David.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/7</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/7</guid><dc:creator><![CDATA[whale-av]]></dc:creator><pubDate>Sat, 22 Jan 2022 06:25:34 GMT</pubDate></item><item><title><![CDATA[Reply to How to make a slider have a limit and change direction? on Sat, 22 Jan 2022 09:51:04 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/whale-av">@whale-av</a> said:</p>
<blockquote>
<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/ddw_music">@ddw_music</a> I am not certain but maybe [line] is more efficient than [metro] as in my post above...... but it probably doesn't matter for such a simple application.</p>
</blockquote>
<p>I guess it depends whether the specific increment is important or not. If the increment isn't important (but the endpoints and time are), then yes, use [line]. If the important feature is that the increment be exactly +/-0.01, then I'd spell out the specific addition. (Sure, you can calculate the endpoints, time, and output interval to get the exact increment more or less, maybe some floating point rounding error though.)</p>
<p>But beyond that: a counter with a stop limit is an extremely common pattern of objects, IMO part of basic literacy for using Pd or Max. Yet somehow this is seldom taught as a foundational pattern (so, users often stumble over it -- as did I, at first). So I think it's worth illustrating, even if it's slightly less efficient than [line].</p>
<blockquote>
<p>Yes the slider GUI does not impose limits, but is useful for display purposes.  But changing that programmatically usually just adds confusion for the observer.</p>
</blockquote>
<p>Useful for display, definitely. But, I see in SuperCollider as well, often users want GUIs to do actual work: flow of control, or sometimes even calculation (in SC, GUI action functions can be complex). IMO that's usually a mistake. Specifically here, the way the question is worded makes it sound like OP expects the slider to determine when the limit has been reached. I thought it was worth discouraging that expectation.</p>
<p>hjh</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/8</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/13780/how-to-make-a-slider-have-a-limit-and-change-direction/8</guid><dc:creator><![CDATA[ddw_music]]></dc:creator><pubDate>Sat, 22 Jan 2022 09:51:04 GMT</pubDate></item></channel></rss>