Poly~ instances individual pan

hzd's icon

Hi there.

I'm working on a Poly~ synth patch and I'm trying to have this elaborate panning system, where each poly voice gets its individual pan acordingly to haw many voices are playing at the time. And I wan't the panning to change if I release one voice, the remaining ones change their pan acordingly.
My idea for panning scheme is.
1 voice: center
2 voices: one voice left .5 and one voice right .5
3 voices: one voice left .666 one voice center one voice right .666
4 voices: one voice left .75 one voice left .25 one voice right .25 one voice right .75
and so on.

What I've managed to do, is monitor how many voices are active and wich ones. What I'm asking help for, is how to route the pan messages to the active voices. Because the active voices aren't neccesarely 1, 2, 3, 4, 5. It is also 2, 5, 8, 11 and how do I route the 4 voices pan message to these different instances?

Thx so far. I wouldn't have gotten this far without this forum.

Max Patch
Copy patch and select New From Clipboard in Max.

Here is the Poly~ patch I'm working on:

Luke Hall's icon

Could you also post the contents of "hzd_filter_synth_voice_spread", your [poly~] patch so we can see what you have set up inside so far? It's treated as a completely separate patch so it isn't included when you paste a compressed patch to the forum.

hzd's icon

Thanks for your interrest :)

Max Patch
Copy patch and select New From Clipboard in Max.

Here is the voice_spread patch.

hzd's icon

I changed the panning scheme, but the principle is the same, and my problem remains...

Roman Thilenius's icon

you said they arent neccessarily 1,2,3,4. why not? couldnt oyu just organize the voicing like this?

hzd's icon

Well if I play a six voice chord, and release two voices these mught be voice 3 and 5 then voice 1, 2, 4 and 6 are playing and they need to panned like there are four voices. And if the release time is long and I play some sort of melody with chord the voices are al over the place.

Not sure if I'm being clear enough...

Roman Thilenius's icon

right, releasing some is another issue. however, i would try to have total control over voices in a patch outside the poly, it makes it much easier.
alternatively try to make use of the busy messages and/or thispoly~ information about what and how many voices are playing.

hzd's icon

I have managed to have a count of active voices and idenfy what number these have. I'm looking for an elegant way of routing the pan message to the active voices.
I imagine I could run through every voice every time the count changes. So the count triggers what the panning scheme is, and I somehow run through the voices. Voice 1 - on - gets pan message, voice 2 - off - move on to next, and so on

I maybe to impatient, just need to spend more time with this.

But thanks so far.

Floating Point's icon

this is how i'd do it-- get the busymap from your poly~ and then you can calculate how many voices are active and which ones they are:

Max Patch
Copy patch and select New From Clipboard in Max.

--T

ak's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Just what Terry did (busymap), but for any number of voices (yet another way):

Floating Point's icon

ok, yes zl sub is better

hzd's icon

This is beautiful...

thx

hzd's icon

This is good. But I had to modify, how I was getting messages to all the targets. Had to send them through a "target 0, $1" message before the inlet. But works like a charm now.
However, I am now trying to make it so, that when only one voice is playing it is panned centre. As is, it goes to the left.
This should be easy though...

Thx for now.

ak's icon
Max Patch
Copy patch and select New From Clipboard in Max.

this should do it. Adding exception to an algorithm is not that obvious in Max. It feels like assembling a toy railroad set... :)

hzd's icon

Nice. Neatly done.

I managed with this one, where I just send a message 0.5 if the zl sum is 1. The target will be set by the previous message that state, there is one voice playing, target (something), pan 0.0. The target will then be set, and I then tell it to go from 0.0 to 0.5. Right? Works so far :)

But yours looks more robust or correct.

Max Patch
Copy patch and select New From Clipboard in Max.

cheers.

ak's icon

You get exactly the same value from [zl sum] and the right outlet of [zl sub 1].
Everything is ok as long as your pan impl. is immune to receiving redundant messages.