• ### Help regarding a loop (I'm very new)

Here is a complicated loop I am working on..

Hello, I've been stuck on this for 3 hours now, what I'm attempting to do is create a loop here, so that the sound can go up and down like a wave. When the value hits 260, the number decreases by 1 every 0.1 seconds, when finally the number value hits 200, the number increases by 1 every 0.1 seconds again until it hits 260, so that it is stuck in a loop where it increments by 1 from 200 to 260 and back again etc..However this does not work correctly. Does anyone have an idea of how I can solve this monstrosity I have created? it kind of works, however produces a nasty stack overflow and my brain is fried, If there is any suggestions on how I could do my back and fourth loop I would greatly appreciate it as it is for my uni assignment, Thanks so much!

• Posts 10 | Views 364
• @Simone This will do it, although 200 and 260 are repeated once. If that is a problem you can remove the second one with [change] after the [i].......... but the timing is then incorrect.
200_260.pd ... vanilla

But here is a better option, that is more cpu friendly........ and accurate.
200_260again.pd

And using [moses] .... 200_260moses.pd

I like this challenge..... it is forcing me to look for ways to do stuff in Vanilla.
I like this one best.... it's smaller...... you will have to drag the bits apart to see what is happening.
200_260compact.pd

As an abstraction bounce 3.zip (final maybe).

Of course, it's a trivial exercise in Pd extended...... 200_260ext.pd
David.

• @whale-av You certainly solved my problem alright! Thank you so much for your help man, I really appreciate it.

• @Simone re: chat.........
Nice sound!....... I have placed it as an "abstraction" within your main patch.

Try this....... You will need to get values between zero and one into your volume control, derived from your distance values........ new.zip
Audio values in Pd are from 0.....off to 1....full. You must keep within those limits when you send to the [dac~]

You will see that your sound patch name no longer has any spaces in it. I could not have used it as an abstraction with the spaces. 2nd rule of Pd'ing ..... no spaces in file names......

If you want the sound to pan across as well then put 2 volume controls, one to the left inlet and one to the right inlet of the [dac~] ........ and ramp one volume up (and then down again) as the other volume goes down.
David.

• Thanks very much David! Do you think I should send the distance values to the volume control using the send object?/if not if I'm completely wrong an example would be lovely please as I struggle to understand

thanks so much for your help I really appreciate it.

Gonna give this a crack tomorrow, been at PD all day/week handing in a huge portfolio I've been working on for a year, in for Monday ahah so let the challenge begin! Been working on a whole range of cinematic sounds, this software doesn't fail to fry my brain, I don't know how you do it!

• @Simone new3.zip ........ try to understand it if you are going to have to explain it...!
I have used the numbers from "passing point b" to produce the effect. If you want to use some other numbers you will have to do the same, but divide the incoming data by it's biggest value...... and if some of the data is negative, offset it first.......so as to keep the sound level control values between 0 and 1 (0= the maximum distance left, 1= the maximum distance right)
The [pow 2] creates the relationship between distance and volume for the sound.... 1/4 of power for a doubling of distance.
David.

• @Simone Hi!, David send you fantastic answers to your question, but just to give an other way to do the same, you can do it whit the [expr] object and the [counter]. 200_260-expr.pd

• @Theorix Hello Theorix... you don't even need the [expr] object. Many things are so much easier in Extended. The [counter] has an up+down switch........ see 200_260ext.pd above.
David.

• @whale-av Hi David, the 200-260ext.pd don't seem go up when it reach 200 but when it reach 0. But looking more closely, we don't even need any thing me than the [count] obj. Just set it like this [count 2 200 260] et voilà! 200-260ext_2.pd
Cheers

• @Theorix You are right!....... and I thought I had checked it. And as you say... it is even easier. I do like extended! I have modified mine above to match yours..... just in case someone does not read to the end of the thread.
David.

Posts 10 | Views 364
Internal error.

Oops! Looks like something went wrong!