[Csnd] genarray is strange...
Date | 2018-10-02 14:22 |
From | Mauro Giubileo |
Subject | [Csnd] genarray is strange... |
Hi, this code generates an array of 128 elements and then prints its size (128): instr 1 But this k-time version prints -1... Why? instr 1
|
Date | 2018-10-02 15:38 |
From | Victor Lazzarini |
Subject | Re: [Csnd] genarray is strange... |
Because you are using the i-rate version of the function, as printk has no way of selecting k- or i-rate versions, so it defaults to i-rate To select the desired overload use a hint (:k) lenarray:k(kArr) or use the opcode form rather the function form klen lenarray kArr printk 1, klen where the correct overload is chosen. This is how the type system in Csound 6 currently works. It is discussed in the Csound springer book. best ======================== 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 2 Oct 2018, at 14:22, Mauro Giubileo |
Date | 2018-10-02 16:02 |
From | Mauro Giubileo |
Subject | Re: [Csnd] genarray is strange... |
Oh, right... I always tend to forget to add the hint (:k) in such situations when I use the function syntax. Thanks! P.S.: I don't know if it is feasible, but I think it would be very nice if in such situations Csound could give you a "warning" in the console output to make the user know that the parser doesn't know what rate version of a function it should use and so it defaults to the i-rate one.
Il 2018-10-02 16:38 Victor Lazzarini ha scritto:
|
Date | 2018-10-02 17:05 |
From | Victor Lazzarini |
Subject | Re: [Csnd] genarray is strange... |
If we were able to detect what rate was required then we would just select the right opcode, so a warning then would not be needed. ======================== 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 2 Oct 2018, at 16:02, Mauro Giubileo |
Date | 2018-10-02 18:47 |
From | Mauro Giubileo |
Subject | Re: [Csnd] genarray is strange... |
Yes, that would be better, but I don't know if it is always possible to detect the right rate the user want. Il 2018-10-02 18:05 Victor Lazzarini ha scritto:
|
Date | 2018-10-02 19:31 |
From | Victor Lazzarini |
Subject | Re: [Csnd] genarray is strange... |
That's my point, without the extra annotation, it is not possible. Therefore we can't display a warning, because there might be nothing wrong with the code, and it
would be extremely annoying to the user.
Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
Date | 2018-10-02 19:51 |
From | Mauro Giubileo |
Subject | Re: [Csnd] genarray is strange... |
Maybe with a flag to make the user choice if he wants the warnings? Something like "-noRateWarnings" ? Il 2018-10-02 20:31 Victor Lazzarini ha scritto: That's my point, without the extra annotation, it is not possible. Therefore we can't display a warning, because there might be nothing wrong with the code, and it |
Date | 2018-10-03 16:52 |
From | Mauro Giubileo |
Subject | Re: [Csnd] genarray is strange... |
Another problem on genarray... This works: kArr[] genarray 1, 128 But this gives to me an error message in the console output: kArr[] = genarray:k(1, 128) What I missed this time? Genarray should have i-time and k-time versions... Regards, Il 2018-10-02 17:02 Mauro Giubileo ha scritto:
|