Csound Csound-dev Csound-tekno Search About

[Csnd-dev] how to se values in a k-rate array at i-time

Date2023-09-11 14:49
FromJohn ff
Subject[Csnd-dev] how to se values in a k-rate array at i-time
I am writing an csd file which relies on vectors ; so there are 8 pitches
and I would like to set one of them at i-time in an instrument.  I
cannot think of a way to do this that is not insane.

Ideally I would say

gkpitch[5] init 440

but the syntax does not allow an array location,  only a complete array as
gkpitch[] init 0,1,2,3,4,5,6,7,8

I can think of using gkpitch[] init gkpitch[0], gkpitch[1],
gkpitch[2], inew, gkpitch[4],... gkpictch[8] but this is bizarre

This is just one instance that I have hit; I think they all could be
alleviated if we had explicit left values such as
lv(gkpitch[5]) to create a temporary variable that shares allocation with
gkpitch[5].  Then "lv(gkpitch[5] init inew" could be made to work

Could use other syntax such as @gkpitch[5] as in BCPL (but I think
this clashes with MAP)

Any thoughts?  If we go this way it has implications for structures,
multidimensional arrays and I am sure more.

==John ffitch