Csound Csound-dev Csound-tekno Search About

[Csnd] What is the optimal way of spreading incoming notes b/w channels

Date2014-01-09 18:37
FromGleb
Subject[Csnd] What is the optimal way of spreading incoming notes b/w channels
Hi everybody!

This time I am trying to spread each new incoming note between two channels,
i.e. first note goes to left channel, second one - to the right, third - to
the left again etc.
My solution is something like following:

giPanMod = 1
instr 1
iveloc	 ampmidi 1
iPanMod = 1
if (iveloc >=0) then
	giPanMod = -giPanMod
	print giPanMod
endif
endin

I use global giPanMod to prevent it re-initialization inside instr. Every
next incoming note sign of giPanMod changes so I can control if it is even
or odd. Sure could use mod() or something in this way, but in case there are
only two values, I think this solution is better.

My question is anybody sees more optimal solution of given problem?

Thank you dear Csounders!




-----
Gleb Rogozinsky, PhD
Associated Professor
Interactive Arts Department
Saint-Petersburg University of Film and Television

Deputy Director of Medialab
Saint-Petersburg University of Telecommunications
--
View this message in context: http://csound.1045644.n5.nabble.com/What-is-the-optimal-way-of-spreading-incoming-notes-b-w-channels-tp5731414.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-01-09 19:16
Fromjpff@cs.bath.ac.uk
Subject[Csnd] Re:
AttachmentsNone  

Date2014-01-09 19:40
FromTarmo Johannes
SubjectRe: [Csnd] Re:
Hi,

John might have thought something like:

giCounter init 0

instr 1
iveloc   ampmidi 1
iPanMod = 1
asig = rnd(0.1) 
if (iveloc >=0) then
	giCounter += 1
	print giCounter%2
	outch giCounter%2, asig ; or maybe 1+ giCounter%2 ; or maybe it should be 
gkCounter...
endif
endin

not tested. While  giCoiunter increases, giCounter%d (modulus) returns 0,1,0,1 
etc

best!
tarmo


On Thursday 09 January 2014 19:16:55 jpff@cs.bath.ac.uk wrote:
> Using outch and the mod opcode (mod 2) you can do this simply.
> Sorry not to give full solution -- up to my eyes in other code
> ==John
> 
> Quoting Gleb :
> > Hi everybody!
> > 
> > This time I am trying to spread each new incoming note between two
> > channels, i.e. first note goes to left channel, second one - to the
> > right, third - to the left again etc.
> > My solution is something like following:
> > 
> > giPanMod = 1
> > instr 1
> > iveloc	 ampmidi 1
> > iPanMod = 1
> > if (iveloc >=0) then
> > 
> > 	giPanMod = -giPanMod
> > 	print giPanMod
> > 
> > endif
> > endin
> > 
> > I use global giPanMod to prevent it re-initialization inside instr. Every
> > next incoming note sign of giPanMod changes so I can control if it is even
> > or odd. Sure could use mod() or something in this way, but in case there
> > are only two values, I think this solution is better.
> > 
> > My question is anybody sees more optimal solution of given problem?
> > 
> > Thank you dear Csounders!
> > 
> > 
> > 
> > 
> > -----
> > Gleb Rogozinsky, PhD
> > Associated Professor
> > Interactive Arts Department
> > Saint-Petersburg University of Film and Television
> > 
> > Deputy Director of Medialab
> > Saint-Petersburg University of Telecommunications
> > --
> > View this message in context:
> > http://csound.1045644.n5.nabble.com/What-is-the-optimal-way-of-spreading-i
> > ncoming-notes-b-w-channels-tp5731414.html Sent from the Csound - General
> > mailing list archive at Nabble.com.
> > 
> > 
> > Send bugs reports to the Sourceforge bug trackers
> > 
> > csound6:
> >             https://sourceforge.net/p/csound/tickets/
> > 
> > csound5:
> >             https://sourceforge.net/p/csound/bugs/
> > 
> > Discussions of bugs and features can be posted here
> > To unsubscribe, send email sympa@lists.bath.ac.uk with body
> > "unsubscribe csound"
> 
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>             https://sourceforge.net/p/csound/tickets/
> csound5:
>             https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"

Date2014-01-09 19:47
FromGleb
Subject[Csnd] Re: Re:
Thanks John!

it is an interesting opcode. The only problem with it, I want to modulate
this spread. So strictly right and strictly left is the most radical case.
So it could be like this:

                 L         R
1st note     0.7      0.3
2nd note    0.3      0.7
3rd note     0.7      0.3
....

or using bipolar signals:
                 L                R
1st note     0.5+iPan  0.5-iPan
2nd note    0.5+iPan  0.5-iPan
3rd note     0.5+iPan  0.5-iPan,
...

where iPan=0.2 changes its sign on every incoming note.



-----
Gleb Rogozinsky, PhD
Associated Professor
Interactive Arts Department
Saint-Petersburg University of Film and Television

Deputy Director of Medialab
Saint-Petersburg University of Telecommunications
--
View this message in context: http://csound.1045644.n5.nabble.com/What-is-the-optimal-way-of-spreading-incoming-notes-b-w-channels-tp5731414p5731420.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-01-10 02:34
FromJim Aikin
Subject[Csnd] Re: Re:
Untested, but if I were trying to do something like this, I'd try defining,
let's say, gkFlipFlop in the orchestra header:

gkFlipFlop init 0.2

Then, in the instrument code, I'd say something like:

if (gkFlipFlop == 0.2) then
    gkFlipFlop = -0.2
else
    gkFlipFlop = 0.2
endif

And then, of course:

iPan = 0.5 + gkFlipFlop
aL, aR     pan2    asig, iPan
             outs     aL, aR

This should cause every other note to flop to the opposite side, which I
think is what you're after.





--
View this message in context: http://csound.1045644.n5.nabble.com/What-is-the-optimal-way-of-spreading-incoming-notes-b-w-channels-tp5731414p5731431.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-01-16 05:49
FromGleb
Subject[Csnd] Re: Re:
Yeah)

So to my opinion it is almost the same what I did. Although you do not use
multiplication, so maybe your solution is better.

Thanks



-----
Gleb Rogozinsky, PhD
Associated Professor
Interactive Arts Department
Saint-Petersburg University of Film and Television

Deputy Director of Medialab
Saint-Petersburg University of Telecommunications
--
View this message in context: http://csound.1045644.n5.nabble.com/What-is-the-optimal-way-of-spreading-incoming-notes-b-w-channels-tp5731414p5731708.html
Sent from the Csound - General mailing list archive at Nabble.com.