Randomising gswitch2 panning
Hi all,
I've made the patch below (video, then still image) to pan an audio source across a 32 speaker array using gswitch2. I need to randomise the direction somewhat, so that it doesn't just pan left to right and back, and the distance - so it might pan 3 outlets to the right then 8 to the left then 5 to the right then 20 to the left etc etc.
Anyone have any tips on how to make this happen?

From a look at it, this has nothing to do with audio panning ..???
What are all those bangs -> 0 to groove supposed to represent ?
If You want to randomise center of output between 1 and 32,
and spread arround it, I would use rslider as first to see how it sounds.
matrix~ with 1 input and 32 outputs, some ramp time
could serve as panner.
Creating randomised values depends of panning situation.
If it is surrounding, then there is no left and right end,
but circular panner.
If it is meant to be just left to right spread, that
makes things different, because You must clip minimum to 1
and maximum to 32.
Thanks very much for the reply. To give more context, I'm running an experiment investigating subject's ability to localise a moving sound source. As long as the audio sample is 50ms or less and the gap between each iteration is less than 50ms, a single sample can be made to sound like a continuous sound source when played through consecutive speakers. Obviously if the subject knows the sound is just going to pan L-R or vice versa each time there'll be an element of prediction rather than localisation, so I need to pseudo-randomise the direction/distance.
The bangs are partly for visual assistance, to make sure every outlet is firing. Also, when they bang the '0' it plays the sample loaded into the buffer~ to give an audio "notification". The intention was for each outlet to be linked to one of 32 speakers and play a sample through it. It's not a circular array, just left to right.
That makes it easier for You.
You need fast On/Off on each of 32 Outputs.
matrix with short ramp like 2-5 would be fast enough.
So let's go abour randomising, You need 2 values,
actually more important one is width of sound or how many speakers should sound.
You are calling this distance, but that's not really correct.
More speakers would be louder and wider.
Anyway, using that parameter and center of the group of speakers,
with respect to - max left - max right is the goal.
So You can't have center at 4 , width 8 speakers.
that would mean 4 of the speakers are out of range ...
Here is one possible example :
I can see now I've explained myself badly when talking about distance, sorry! Only one speaker will sound at a time. So for the sound source to pan all the way from left to right, it would play through speaker 1, then 2, then 3 etc. individually up to 32, never together. The "width" you refer to will always be one speaker. So when I've said distance, I should have specified that it's distance travelled.
Ideally the sound will start centrally (speaker 15), then move speaker by speaker to the left or right by a random number of speakers, then back the other way by a random number of speakers. I massively appreciate this help btw so thank you! I last used Max about 8 years ago for 6 months and that's it.
I see, now that makes it almost trivial task...
But it is still not easy to understand how the sound has to travel.
What means "than back the other way arround. " ?
Does sound move till end of either direction is reached,
and then goes to opposite direction, or
restarts from the middle again ... there are many possible movements.
Or is it totally random - each time new direction and distance ...
The sound will get to the end of one direction, then travel in the opposite direction. So basically:
- Sound will start at the centre speaker
- When started it will move either left or right, 1 speaker at a time
- It will travel for a random number of speakers before going in the opposite direction for a random number of speakers.
The main rules are:
- That only one speaker must be triggered at any time
- Speakers must be triggered in consecutive sequences
I think I misunderstood the "end of one direction".
I thouhght the end is maximum left or right, speaker 1 and 31.
The way I understand it now is that random value of for example 8 means :
move from center towards left for 8 speakers, one at the time.
When step 8 is reached move to opposite direction, random value for example 5.
When 5 steps to right are done move again towards left
for random value, for example 11, and so on.
Is that right ?
Yes that's right, sorry for the confusion.
Here is one possible way.
It stops the progress and points to oposite direction
in case minimum or maximum points are reached ( 0 & 31).
Other possibility would be to take another approach -
to calculate random maximum range from current speaker
distance to min/max, so that position + number of steps never
exceeds minimum and maximum.
Well it's up to You if You want to try that.
Here is the simpler way :
That's exactly what I need it to do. Thank you so much for taking the time, I really appreciate it!