Csound Csound-dev Csound-tekno Search About

Re: usage of arrays at i-time and k-time in Csound 6.08/6.09 - may by another dirty programming I did

Date2017-06-24 17:40
FromKarin Daum
SubjectRe: usage of arrays at i-time and k-time in Csound 6.08/6.09 - may by another dirty programming I did
Hi,

-maybe the first attempt got lost - sorry if I posted it twice-

I'm heavily using global variables/arrays to pass information across instruments and UDOs

For an application I need to normalise the pitch of spoken phonemes such that I can do afterwards the intonation in a controlled way. To do the normalisation I use a csd which does the following thing ordered in time (there step procedure):

1st step: analyse the input - phonemes and store the results (pitch, amplitudes) in global gk-arrays (instr 1)

2nd step: calculated mean pitch for the individual phonemes and the total sample in instrument 2 which starts after inst 1 has finished. This I did so far at i-time of instr2 the results are stored in global gi-arrays 
using something like

giarr[i]=i(gkarr[i])/i(gkarr2[i])

3rd step: read information on the pitch normalisation from the gi-arrays in instrument 3 at i-time and triggers via event_i instances of an instrument which then do the output of the calibrated phonemes via fout phoneme by phoneme

This worked in 6.07 because gkarr was filled before the initialisation step of instr 2 was executed. It does not work in 6.08/6.09
although instr 2 starts well after instr 1 has finished. Statements like the above set giarr[i] to zero.

Is this another dirty trick I'm doing or is this a bug?

best regards

Karin

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-06-24 17:48
Fromjpff
SubjectRe: usage of arrays at i-time and k-time in Csound 6.08/6.09 - may by another dirty programming I did
>From te manual

i(x) (control-rate or init-rate arg)

i(karray,index1, ...) (k-array with indices)

Value converters perform arithmetic translation from units of one kind to 
units of another. The result can then be a term in a further expression.
[Note] 	Note

Using i() with a k-rate expression argument is not recommended, and can 
produce unexpected results.

To get the value from an array element reliably the second form should be 
used.



On Sat, 24 Jun 2017, Karin Daum wrote:

> Hi,
>
> -maybe the first attempt got lost - sorry if I posted it twice-
>
> I'm heavily using global variables/arrays to pass information across instruments and UDOs
>
> For an application I need to normalise the pitch of spoken phonemes such that I can do afterwards the intonation in a controlled way. To do the normalisation I use a csd which does the following thing ordered in time (there step procedure):
>
> 1st step: analyse the input - phonemes and store the results (pitch, amplitudes) in global gk-arrays (instr 1)
>
> 2nd step: calculated mean pitch for the individual phonemes and the total sample in instrument 2 which starts after inst 1 has finished. This I did so far at i-time of instr2 the results are stored in global gi-arrays
> using something like
>
> giarr[i]=i(gkarr[i])/i(gkarr2[i])
>
> 3rd step: read information on the pitch normalisation from the gi-arrays in instrument 3 at i-time and triggers via event_i instances of an instrument which then do the output of the calibrated phonemes via fout phoneme by phoneme
>
> This worked in 6.07 because gkarr was filled before the initialisation step of instr 2 was executed. It does not work in 6.08/6.09
> although instr 2 starts well after instr 1 has finished. Statements like the above set giarr[i] to zero.
>
> Is this another dirty trick I'm doing or is this a bug?
>
> best regards
>
> Karin
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-06-24 17:50
Fromjpff
SubjectRe: usage of arrays at i-time and k-time in Csound 6.08/6.09 - may by another dirty programming I did
and from 6.08 releasenotes

- Array access semantics have been clarified:

 	- i[i]  => reading at i-time and perf-time, writing at i-time
     only.
 	- i[k] =>  reading at perf-time, writing yields a runtime error
 	- k[i], k[k] =>  reading at perf-time, writing at perf-time
 	- a[i], a[k] => reading at perf-time, writing at perf-time
     - other (S[], f[]) => reading and writing according to index type 
(i,k).

In particular, i(k[i]) will continue not to work, as before, but the new 
operator
i(k[],i) is provided to cover this case.

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-06-24 17:54
FromKarin Daum
SubjectRe: usage of arrays at i-time and k-time in Csound 6.08/6.09 - may by another dirty programming I did
thanks, I remembered that I read recently something about this, but did not remember where

> On 24 Jun 2017, at 18:50, jpff  wrote:
> 
> and from 6.08 releasenotes
> 
> - Array access semantics have been clarified:
> 
> 	- i[i]  => reading at i-time and perf-time, writing at i-time
>    only.
> 	- i[k] =>  reading at perf-time, writing yields a runtime error
> 	- k[i], k[k] =>  reading at perf-time, writing at perf-time
> 	- a[i], a[k] => reading at perf-time, writing at perf-time
>    - other (S[], f[]) => reading and writing according to index type (i,k).
> 
> In particular, i(k[i]) will continue not to work, as before, but the new operator
> i(k[],i) is provided to cover this case.
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>       https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-06-24 17:58
FromKarin Daum
SubjectRe: usage of arrays at i-time and k-time in Csound 6.08/6.09 - may by another dirty programming I did
thanks, it works :)
> On 24 Jun 2017, at 18:50, jpff  wrote:
> 
> and from 6.08 releasenotes
> 
> - Array access semantics have been clarified:
> 
> 	- i[i]  => reading at i-time and perf-time, writing at i-time
>    only.
> 	- i[k] =>  reading at perf-time, writing yields a runtime error
> 	- k[i], k[k] =>  reading at perf-time, writing at perf-time
> 	- a[i], a[k] => reading at perf-time, writing at perf-time
>    - other (S[], f[]) => reading and writing according to index type (i,k).
> 
> In particular, i(k[i]) will continue not to work, as before, but the new operator
> i(k[],i) is provided to cover this case.
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>       https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-06-24 18:07
FromGuillermo Senna
SubjectRe: usage of arrays at i-time and k-time in Csound 6.08/6.09 - may by another dirty programming I did
Is "k[i] init i" allowed to write to a k[] at i-time? It works over
here, but is it supposed to?


On 24/06/17 13:50, jpff wrote:
> and from 6.08 releasenotes
>
> - Array access semantics have been clarified:
>
>     - i[i]  => reading at i-time and perf-time, writing at i-time
>     only.
>     - i[k] =>  reading at perf-time, writing yields a runtime error
>     - k[i], k[k] =>  reading at perf-time, writing at perf-time
>     - a[i], a[k] => reading at perf-time, writing at perf-time
>     - other (S[], f[]) => reading and writing according to index type
> (i,k).
>
> In particular, i(k[i]) will continue not to work, as before, but the
> new operator
> i(k[],i) is provided to cover this case.
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-06-24 18:28
Fromjpff
SubjectRe: usage of arrays at i-time and k-time in Csound 6.08/6.09 - may by another dirty programming I did
On Sat, 24 Jun 2017, Guillermo Senna wrote:

> Is "k[i] init i" allowed to write to a k[] at i-time? It works over
> here, but is it supposed to?

Yes ad yes.

init runs only at -time

>
>
> On 24/06/17 13:50, jpff wrote:
>> and from 6.08 releasenotes
>>
>> - Array access semantics have been clarified:
>>
>>     - i[i]  => reading at i-time and perf-time, writing at i-time
>>     only.
>>     - i[k] =>  reading at perf-time, writing yields a runtime error
>>     - k[i], k[k] =>  reading at perf-time, writing at perf-time
>>     - a[i], a[k] => reading at perf-time, writing at perf-time
>>     - other (S[], f[]) => reading and writing according to index type
>> (i,k).
>>
>> In particular, i(k[i]) will continue not to work, as before, but the
>> new operator
>> i(k[],i) is provided to cover this case.
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-06-24 18:37
FromGuillermo Senna
SubjectRe: usage of arrays at i-time and k-time in Csound 6.08/6.09 - may by another dirty programming I did
Great. Thanks John. I think all cases are covered then.


On 24/06/17 14:28, jpff wrote:
> On Sat, 24 Jun 2017, Guillermo Senna wrote:
>
>> Is "k[i] init i" allowed to write to a k[] at i-time? It works over
>> here, but is it supposed to?
>
> Yes ad yes.
>
> init runs only at -time
>
>>
>>
>> On 24/06/17 13:50, jpff wrote:
>>> and from 6.08 releasenotes
>>>
>>> - Array access semantics have been clarified:
>>>
>>>     - i[i]  => reading at i-time and perf-time, writing at i-time
>>>     only.
>>>     - i[k] =>  reading at perf-time, writing yields a runtime error
>>>     - k[i], k[k] =>  reading at perf-time, writing at perf-time
>>>     - a[i], a[k] => reading at perf-time, writing at perf-time
>>>     - other (S[], f[]) => reading and writing according to index type
>>> (i,k).
>>>
>>> In particular, i(k[i]) will continue not to work, as before, but the
>>> new operator
>>> i(k[],i) is provided to cover this case.
>>>
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>        https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-06-24 18:38
FromVictor Lazzarini
SubjectRe: usage of arrays at i-time and k-time in Csound 6.08/6.09 - may by another dirty programming I did
I think k[i] init i works OK and it was not a problem originally because the array is in the lhs, 
so I think it will continue to work. 

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 24 Jun 2017, at 18:07, Guillermo Senna  wrote:
> 
> Is "k[i] init i" allowed to write to a k[] at i-time? It works over
> here, but is it supposed to?
> 
> 
> On 24/06/17 13:50, jpff wrote:
>> and from 6.08 releasenotes
>> 
>> - Array access semantics have been clarified:
>> 
>>    - i[i]  => reading at i-time and perf-time, writing at i-time
>>    only.
>>    - i[k] =>  reading at perf-time, writing yields a runtime error
>>    - k[i], k[k] =>  reading at perf-time, writing at perf-time
>>    - a[i], a[k] => reading at perf-time, writing at perf-time
>>    - other (S[], f[]) => reading and writing according to index type
>> (i,k).
>> 
>> In particular, i(k[i]) will continue not to work, as before, but the
>> new operator
>> i(k[],i) is provided to cover this case.
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>       https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here