Csound Csound-dev Csound-tekno Search About

[Csnd] Global k-rate arrays

Date2014-05-17 11:35
Frommesca
Subject[Csnd] Global k-rate arrays
Hi, 

I am still discovering csound, so please bear with me if my question is
stupid ;) 

In the following example, I try to update the frequency of a simple sine
instrument while the note is still playing. It works as expected if I use a
global k-rate variable (sine1), but if I use an array value instead (sine2),
well... it doesn't. 

What am I missing? 

Thanks for your help! 





--
View this message in context: http://csound.1045644.n5.nabble.com/Global-k-rate-arrays-tp5735328.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-05-17 11:57
FromVictor Lazzarini
SubjectRe: [Csnd] Global k-rate arrays
You did not show  your example? 
========================
Dr Victor Lazzarini
Senior Lecturer
NUI Maynooth, Ireland
victor dot lazzarini at nuim dot ie




On 17 May 2014, at 11:35, mesca  wrote:

> Hi, 
> 
> I am still discovering csound, so please bear with me if my question is
> stupid ;) 
> 
> In the following example, I try to update the frequency of a simple sine
> instrument while the note is still playing. It works as expected if I use a
> global k-rate variable (sine1), but if I use an array value instead (sine2),
> well... it doesn't. 
> 
> What am I missing? 
> 
> Thanks for your help! 
> 
> 
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Global-k-rate-arrays-tp5735328.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 



Date2014-05-17 12:02
FromPierre Clisson
SubjectRe: [Csnd] Global k-rate arrays
Oops, I wrote the message from the Nabble website, and it seems it didn't like the rich text tags... Here it is again:






sr = 44100
ksmps = 128
nchnls = 1
0dbfs = 1.0

giSine ftgen 0, 0, 2^10, 10, 1
gkFreq init 0
gkFreqArr[] init 8

instr sine1
  gkFreq init p4
  a1 poscil .5, gkFreq, giSine
  a2 linen a1, .1, p3, .1
  out a2
endin

instr sine2
  gkFreqArr[0] init p4
  a1 poscil .5, gkFreqArr[0], giSine
  a2 linen a1, .1, p3, .1
  out a2
endin

instr changefreq
  gkFreq = p4
  gkFreqArr[0] = p4  
endin




i "sine1" 0 2 220
i "sine2" 0 2 220
i "changefreq" 1 1 440 ; sine1 frequency is changed, sine2 is not





Le 17 mai 2014 à 12:57, Victor Lazzarini  a écrit :

> 
> You did not show  your example? 
> ========================
> Dr Victor Lazzarini
> Senior Lecturer
> NUI Maynooth, Ireland
> victor dot lazzarini at nuim dot ie
> 
> 
> 
> 
> On 17 May 2014, at 11:35, mesca  wrote:
> 
>> Hi, 
>> 
>> I am still discovering csound, so please bear with me if my question is
>> stupid ;) 
>> 
>> In the following example, I try to update the frequency of a simple sine
>> instrument while the note is still playing. It works as expected if I use a
>> global k-rate variable (sine1), but if I use an array value instead (sine2),
>> well... it doesn't. 
>> 
>> What am I missing? 
>> 
>> Thanks for your help! 
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context: http://csound.1045644.n5.nabble.com/Global-k-rate-arrays-tp5735328.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>> 
>> 
>> Send bugs reports to
>>       https://github.com/csound/csound/issues
>> 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
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 



Date2014-05-17 14:26
FromVictor Lazzarini
SubjectRe: [Csnd] Global k-rate arrays
The line

gkFreqArr[0] init p4

translates into

#k0 init.k 	p4
gkFreqArr array_set.k   #k0	0

and the second statement runs at k-time setting gkFreqArr[0] to #k0 (p4) all the time,
so that is why the frequency never changes.

It’s a bug, we’ll need to look into it.
========================
Dr Victor Lazzarini
Senior Lecturer
NUI Maynooth, Ireland
victor dot lazzarini at nuim dot ie




On 17 May 2014, at 12:02, Pierre Clisson  wrote:

> Oops, I wrote the message from the Nabble website, and it seems it didn't like the rich text tags... Here it is again:
> 
> 
> 
> 
> 
> 
> sr = 44100
> ksmps = 128
> nchnls = 1
> 0dbfs = 1.0
> 
> giSine ftgen 0, 0, 2^10, 10, 1
> gkFreq init 0
> gkFreqArr[] init 8
> 
> instr sine1
>  gkFreq init p4
>  a1 poscil .5, gkFreq, giSine
>  a2 linen a1, .1, p3, .1
>  out a2
> endin
> 
> instr sine2
>  gkFreqArr[0] init p4
>  a1 poscil .5, gkFreqArr[0], giSine
>  a2 linen a1, .1, p3, .1
>  out a2
> endin
> 
> instr changefreq
>  gkFreq = p4
>  gkFreqArr[0] = p4  
> endin
> 
> 
> 
> 
> i "sine1" 0 2 220
> i "sine2" 0 2 220
> i "changefreq" 1 1 440 ; sine1 frequency is changed, sine2 is not
> 
> 
> 
> 
> 
> Le 17 mai 2014 à 12:57, Victor Lazzarini  a écrit :
> 
>> 
>> You did not show  your example? 
>> ========================
>> Dr Victor Lazzarini
>> Senior Lecturer
>> NUI Maynooth, Ireland
>> victor dot lazzarini at nuim dot ie
>> 
>> 
>> 
>> 
>> On 17 May 2014, at 11:35, mesca  wrote:
>> 
>>> Hi, 
>>> 
>>> I am still discovering csound, so please bear with me if my question is
>>> stupid ;) 
>>> 
>>> In the following example, I try to update the frequency of a simple sine
>>> instrument while the note is still playing. It works as expected if I use a
>>> global k-rate variable (sine1), but if I use an array value instead (sine2),
>>> well... it doesn't. 
>>> 
>>> What am I missing? 
>>> 
>>> Thanks for your help! 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> View this message in context: http://csound.1045644.n5.nabble.com/Global-k-rate-arrays-tp5735328.html
>>> Sent from the Csound - General mailing list archive at Nabble.com.
>>> 
>>> 
>>> Send bugs reports to
>>>      https://github.com/csound/csound/issues
>>> 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
>>       https://github.com/csound/csound/issues
>> 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
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 



Date2014-05-17 14:44
FromPierre Clisson
SubjectRe: [Csnd] Global k-rate arrays
Thanks. Is there a way to follow the resolution of this bug?
I can't see anything at https://github.com/csound/csound/issues?labels=bug&page=1&state=open

Le 17 mai 2014 à 15:26, Victor Lazzarini  a écrit :

> 
> The line
> 
> gkFreqArr[0] init p4
> 
> translates into
> 
> #k0 init.k 	p4
> gkFreqArr array_set.k   #k0	0
> 
> and the second statement runs at k-time setting gkFreqArr[0] to #k0 (p4) all the time,
> so that is why the frequency never changes.
> 
> It’s a bug, we’ll need to look into it.
> ========================
> Dr Victor Lazzarini
> Senior Lecturer
> NUI Maynooth, Ireland
> victor dot lazzarini at nuim dot ie
> 
> 
> 
> 
> On 17 May 2014, at 12:02, Pierre Clisson  wrote:
> 
>> Oops, I wrote the message from the Nabble website, and it seems it didn't like the rich text tags... Here it is again:
>> 
>> 
>> 
>> 
>> 
>> 
>> sr = 44100
>> ksmps = 128
>> nchnls = 1
>> 0dbfs = 1.0
>> 
>> giSine ftgen 0, 0, 2^10, 10, 1
>> gkFreq init 0
>> gkFreqArr[] init 8
>> 
>> instr sine1
>> gkFreq init p4
>> a1 poscil .5, gkFreq, giSine
>> a2 linen a1, .1, p3, .1
>> out a2
>> endin
>> 
>> instr sine2
>> gkFreqArr[0] init p4
>> a1 poscil .5, gkFreqArr[0], giSine
>> a2 linen a1, .1, p3, .1
>> out a2
>> endin
>> 
>> instr changefreq
>> gkFreq = p4
>> gkFreqArr[0] = p4  
>> endin
>> 
>> 
>> 
>> 
>> i "sine1" 0 2 220
>> i "sine2" 0 2 220
>> i "changefreq" 1 1 440 ; sine1 frequency is changed, sine2 is not
>> 
>> 
>> 
>> 
>> 
>> Le 17 mai 2014 à 12:57, Victor Lazzarini  a écrit :
>> 
>>> 
>>> You did not show  your example? 
>>> ========================
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> NUI Maynooth, Ireland
>>> victor dot lazzarini at nuim dot ie
>>> 
>>> 
>>> 
>>> 
>>> On 17 May 2014, at 11:35, mesca  wrote:
>>> 
>>>> Hi, 
>>>> 
>>>> I am still discovering csound, so please bear with me if my question is
>>>> stupid ;) 
>>>> 
>>>> In the following example, I try to update the frequency of a simple sine
>>>> instrument while the note is still playing. It works as expected if I use a
>>>> global k-rate variable (sine1), but if I use an array value instead (sine2),
>>>> well... it doesn't. 
>>>> 
>>>> What am I missing? 
>>>> 
>>>> Thanks for your help! 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> View this message in context: http://csound.1045644.n5.nabble.com/Global-k-rate-arrays-tp5735328.html
>>>> Sent from the Csound - General mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> Send bugs reports to
>>>>     https://github.com/csound/csound/issues
>>>> 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
>>>      https://github.com/csound/csound/issues
>>> 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
>>       https://github.com/csound/csound/issues
>> 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
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 



Date2014-05-17 16:35
FromVictor Lazzarini
SubjectRe: [Csnd] Global k-rate arrays
No, we’ve just discovered it. You could open an issue, if it’s alright.
========================
Dr Victor Lazzarini
Senior Lecturer
NUI Maynooth, Ireland
victor dot lazzarini at nuim dot ie




On 17 May 2014, at 14:44, Pierre Clisson  wrote:

> Thanks. Is there a way to follow the resolution of this bug?
> I can't see anything at https://github.com/csound/csound/issues?labels=bug&page=1&state=open
> 
> Le 17 mai 2014 à 15:26, Victor Lazzarini  a écrit :
> 
>> 
>> The line
>> 
>> gkFreqArr[0] init p4
>> 
>> translates into
>> 
>> #k0 init.k 	p4
>> gkFreqArr array_set.k   #k0	0
>> 
>> and the second statement runs at k-time setting gkFreqArr[0] to #k0 (p4) all the time,
>> so that is why the frequency never changes.
>> 
>> It’s a bug, we’ll need to look into it.
>> ========================
>> Dr Victor Lazzarini
>> Senior Lecturer
>> NUI Maynooth, Ireland
>> victor dot lazzarini at nuim dot ie
>> 
>> 
>> 
>> 
>> On 17 May 2014, at 12:02, Pierre Clisson  wrote:
>> 
>>> Oops, I wrote the message from the Nabble website, and it seems it didn't like the rich text tags... Here it is again:
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> sr = 44100
>>> ksmps = 128
>>> nchnls = 1
>>> 0dbfs = 1.0
>>> 
>>> giSine ftgen 0, 0, 2^10, 10, 1
>>> gkFreq init 0
>>> gkFreqArr[] init 8
>>> 
>>> instr sine1
>>> gkFreq init p4
>>> a1 poscil .5, gkFreq, giSine
>>> a2 linen a1, .1, p3, .1
>>> out a2
>>> endin
>>> 
>>> instr sine2
>>> gkFreqArr[0] init p4
>>> a1 poscil .5, gkFreqArr[0], giSine
>>> a2 linen a1, .1, p3, .1
>>> out a2
>>> endin
>>> 
>>> instr changefreq
>>> gkFreq = p4
>>> gkFreqArr[0] = p4  
>>> endin
>>> 
>>> 
>>> 
>>> 
>>> i "sine1" 0 2 220
>>> i "sine2" 0 2 220
>>> i "changefreq" 1 1 440 ; sine1 frequency is changed, sine2 is not
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Le 17 mai 2014 à 12:57, Victor Lazzarini  a écrit :
>>> 
>>>> 
>>>> You did not show  your example? 
>>>> ========================
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> NUI Maynooth, Ireland
>>>> victor dot lazzarini at nuim dot ie
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On 17 May 2014, at 11:35, mesca  wrote:
>>>> 
>>>>> Hi, 
>>>>> 
>>>>> I am still discovering csound, so please bear with me if my question is
>>>>> stupid ;) 
>>>>> 
>>>>> In the following example, I try to update the frequency of a simple sine
>>>>> instrument while the note is still playing. It works as expected if I use a
>>>>> global k-rate variable (sine1), but if I use an array value instead (sine2),
>>>>> well... it doesn't. 
>>>>> 
>>>>> What am I missing? 
>>>>> 
>>>>> Thanks for your help! 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> View this message in context: http://csound.1045644.n5.nabble.com/Global-k-rate-arrays-tp5735328.html
>>>>> Sent from the Csound - General mailing list archive at Nabble.com.
>>>>> 
>>>>> 
>>>>> Send bugs reports to
>>>>>    https://github.com/csound/csound/issues
>>>>> 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
>>>>     https://github.com/csound/csound/issues
>>>> 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
>>>      https://github.com/csound/csound/issues
>>> 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
>>       https://github.com/csound/csound/issues
>> 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
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 



Date2014-05-17 16:52
FromVictor Lazzarini
SubjectRe: [Csnd] Global k-rate arrays
By the way, try using fillarray instead of init

kFreqArray fillarray  p4

because that will run at init-time only and will do what you want.

========================
Dr Victor Lazzarini
Senior Lecturer
NUI Maynooth, Ireland
victor dot lazzarini at nuim dot ie




On 17 May 2014, at 16:35, Victor Lazzarini  wrote:

> No, we’ve just discovered it. You could open an issue, if it’s alright.
> ========================
> Dr Victor Lazzarini
> Senior Lecturer
> NUI Maynooth, Ireland
> victor dot lazzarini at nuim dot ie
> 
> 
> 
> 
> On 17 May 2014, at 14:44, Pierre Clisson  wrote:
> 
>> Thanks. Is there a way to follow the resolution of this bug?
>> I can't see anything at https://github.com/csound/csound/issues?labels=bug&page=1&state=open
>> 
>> Le 17 mai 2014 à 15:26, Victor Lazzarini  a écrit :
>> 
>>> 
>>> The line
>>> 
>>> gkFreqArr[0] init p4
>>> 
>>> translates into
>>> 
>>> #k0 init.k 	p4
>>> gkFreqArr array_set.k   #k0	0
>>> 
>>> and the second statement runs at k-time setting gkFreqArr[0] to #k0 (p4) all the time,
>>> so that is why the frequency never changes.
>>> 
>>> It’s a bug, we’ll need to look into it.
>>> ========================
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> NUI Maynooth, Ireland
>>> victor dot lazzarini at nuim dot ie
>>> 
>>> 
>>> 
>>> 
>>> On 17 May 2014, at 12:02, Pierre Clisson  wrote:
>>> 
>>>> Oops, I wrote the message from the Nabble website, and it seems it didn't like the rich text tags... Here it is again:
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> sr = 44100
>>>> ksmps = 128
>>>> nchnls = 1
>>>> 0dbfs = 1.0
>>>> 
>>>> giSine ftgen 0, 0, 2^10, 10, 1
>>>> gkFreq init 0
>>>> gkFreqArr[] init 8
>>>> 
>>>> instr sine1
>>>> gkFreq init p4
>>>> a1 poscil .5, gkFreq, giSine
>>>> a2 linen a1, .1, p3, .1
>>>> out a2
>>>> endin
>>>> 
>>>> instr sine2
>>>> gkFreqArr[0] init p4
>>>> a1 poscil .5, gkFreqArr[0], giSine
>>>> a2 linen a1, .1, p3, .1
>>>> out a2
>>>> endin
>>>> 
>>>> instr changefreq
>>>> gkFreq = p4
>>>> gkFreqArr[0] = p4  
>>>> endin
>>>> 
>>>> 
>>>> 
>>>> 
>>>> i "sine1" 0 2 220
>>>> i "sine2" 0 2 220
>>>> i "changefreq" 1 1 440 ; sine1 frequency is changed, sine2 is not
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Le 17 mai 2014 à 12:57, Victor Lazzarini  a écrit :
>>>> 
>>>>> 
>>>>> You did not show  your example? 
>>>>> ========================
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> NUI Maynooth, Ireland
>>>>> victor dot lazzarini at nuim dot ie
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> On 17 May 2014, at 11:35, mesca  wrote:
>>>>> 
>>>>>> Hi, 
>>>>>> 
>>>>>> I am still discovering csound, so please bear with me if my question is
>>>>>> stupid ;) 
>>>>>> 
>>>>>> In the following example, I try to update the frequency of a simple sine
>>>>>> instrument while the note is still playing. It works as expected if I use a
>>>>>> global k-rate variable (sine1), but if I use an array value instead (sine2),
>>>>>> well... it doesn't. 
>>>>>> 
>>>>>> What am I missing? 
>>>>>> 
>>>>>> Thanks for your help! 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> View this message in context: http://csound.1045644.n5.nabble.com/Global-k-rate-arrays-tp5735328.html
>>>>>> Sent from the Csound - General mailing list archive at Nabble.com.
>>>>>> 
>>>>>> 
>>>>>> Send bugs reports to
>>>>>>   https://github.com/csound/csound/issues
>>>>>> 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
>>>>>    https://github.com/csound/csound/issues
>>>>> 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
>>>>     https://github.com/csound/csound/issues
>>>> 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
>>>      https://github.com/csound/csound/issues
>>> 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
>>       https://github.com/csound/csound/issues
>> 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
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 



Date2014-05-17 18:40
Frommesca
Subject[Csnd] Re: Global k-rate arrays

> By the way, try using fillarray instead of init
>
> kFreqArray fillarray  p4
>
> because that will run at init-time only and will do what you want.

Yes, that works... until you need to work with multidimensional arrays.
In real life, I need to do something like this:

gkTracks[][] init 16, 2 ; 16 tracks, 2 properties per track: amplitude and frequency

instr 1001
  iti TrackIndex p1 ; a UDO to get the track index for the current instrument
  gkTracks[iti] fillarray p4, p5
  a1 poscil gkTracks[iti][0], gkTracks[iti][1], giSine
  a2 linen a1, .1, p3, .1
  out a2
endin

i 1000.1 0 2 .5 220
i "update" 1 1 .1 440

And obviously, the line "gkTracks[iti] fillarray p4, p5" breaks the parsing.

> > No, we’ve just discovered it. You could open an issue, if it’s alright.

Done.

View this message in context: Re: Global k-rate arrays
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-05-17 19:48
FromVictor Lazzarini
SubjectRe: [Csnd] Re: Global k-rate arrays
you can also use this until init is fixed.

k1 init 0

if k1 == 0 then
  karr[0] = p4
  k1 = 1
endif

========================
Dr Victor Lazzarini
Senior Lecturer
NUI Maynooth, Ireland
victor dot lazzarini at nuim dot ie




On 17 May 2014, at 18:40, mesca  wrote:

> 
> > By the way, try using fillarray instead of init 
> > 
> > kFreqArray fillarray  p4 
> > 
> > because that will run at init-time only and will do what you want. 
> 
> Yes, that works... until you need to work with multidimensional arrays. 
> In real life, I need to do something like this: 
> 
> gkTracks[][] init 16, 2 ; 16 tracks, 2 properties per track: amplitude and frequency 
> 
> instr 1001 
>   iti TrackIndex p1 ; a UDO to get the track index for the current instrument 
>   gkTracks[iti] fillarray p4, p5 
>   a1 poscil gkTracks[iti][0], gkTracks[iti][1], giSine 
>   a2 linen a1, .1, p3, .1 
>   out a2 
> endin 
> 
> i 1000.1 0 2 .5 220 
> i "update" 1 1 .1 440 
> 
> And obviously, the line "gkTracks[iti] fillarray p4, p5" breaks the parsing. 
> 
> > > No, we’ve just discovered it. You could open an issue, if it’s alright. 
> 
> Done. 
> View this message in context: Re: Global k-rate arrays
> Sent from the Csound - General mailing list archive at Nabble.com.



Date2014-05-17 19:59
FromPierre Clisson
SubjectRe: [Csnd] Re: Global k-rate arrays
Ok. Thanks for the workaround. I have thought of this before, but since it is not particularly elegant, I was wondering if another solution was possible. Anyway, I will use this until a bugfix is available.

Thanks for your help!



> 
> you can also use this until init is fixed.
> 
> k1 init 0
> 
> if k1 == 0 then
>  karr[0] = p4
>  k1 = 1
> endif