Hello, I’m trying to get different values for some indexes of samples but I’m stuck.
I’ve been trying different stuff but I’m getting all sorts of errors.
For example I tried using random.randint(0, 40) but I got an error saying random was not defined. I apologize for any broadness on my side for the script part.
Edit: I got as far as this. It works but now my frames are stopping every 2 seconds as well. How can I work around this? ( I used time() because the numbers would change too fast.)
It’s more efficient to do this using CHOPs first and only reference the uniform scale to a channel in the CHOP. You can then prepare the random numbers & lookups you want.
I’m not sure what ../null3 in your screenshot represents, but I assume this is a TOP and you are sampling a pixel to use as the scale value. This means it’s downloading information from the GPU back to the CPU which is quite an ‘expensive’ procedure (on windows machines that is).
If you do need to sample from a TOP, better is to do it once using the TOPtoCHOP and then referencing to the CHOP instead (which exists in CPU memory).
A way to animate the values over time could be to use a lookupCHOP, trimCHOP and timerCHOP to random pick a value from your samples.
I’ve added a screenshot with the parameters collapsed so you see what is changed in the operators, but after making this I realized might be easier just to send the tox
just comes to mind: it might also be ok to use a instancing workflow for this.
Take a Noise TOP (and animate it via its Transform page) and extract a single Pixel with a Crop TOP which then can be used as the instancing value for the Instancing Scale parameter.
Definitely a better approach to keep everything on the gpu indeed if possible. But I was not sure where @ciuppo was sampling from (could be a predefined image).
But yes best is to avoid going back from gpu to cpu all together.
Edit: Come to mind now that even if it is a predefined image @snaut approach is the way to go
Hello there! I’ve read your answer from above, thanks for the tip on the gpu to cpu process there, didn’t know before that.
Indeed I was using a TOP to get my samples from, here’s what that looks like
I managed to find a sketchy workaround to the last edit I made to my post using the OnToOff method from the ChopExec and an LFO set to triangle, like this
However now that I look at it the result is too “jaggy”. My main issue was that always the same balls in the video change their size on the beat while and I wanted to have a little randomness to it, hence the code I’m trying for(the link is safe by the way, sorry for resorting to it but derivative doesn’t allow to upload videos appearently for some reason)
You can see it’s not a very smooth transition but rather “loud to the eye” or something like that.
I am now trying to solve that, I was thinking I could have them change in the moments where the sound is low so that once they go big again you don’t notice the sudden change and it’s more smooth.
Here you can see what I mean, there are moments when the song is more quiet. I am now trying to find a way to call all the samples somehow so that I can tell it something like “if all the samples go below 0.5 then change their index to a new one”. I tried op('scale')['chan1'].eval(*) but it gave me a syntax error so I’m guessing that’s not a viable solution.
Do you know how I could solve this? maybe by using some specific CHOP?
edit:the first link was somehow broken, made a new one that should work, let me know if it doesn’t
edit2: Nevermind, I figured it out. I retraced my steps (went back to the tutorial) and realized I only needed to animate the Sort CHOP’s seed. Now it’s working like I wanted it to
Hello! Thank you for the answer, I managed to find a solution to it somehow, you can find it in my answer to @timgerritsen 's last comment
That instancing workflow looks really interesting, I might give it a try, thanks!