| 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"
|