Csound Csound-dev Csound-tekno Search About

Re: [Csnd] getting fgens via API

Date2017-09-11 19:19
FromFrancesco Porta
SubjectRe: [Csnd] getting fgens via API
Thanks Rory,
but i do not understand (as usual :)).
I am doing this:
1 retrieve the fgen number reading a csd as text
2 retrieve length and values using

    cs:TableLength(numeroTavola)
    for i=1, length do
	value = cs:TableGet(numeroTavola, i)
    end

this is working ok. But what if i have an orchestra ftgen with automatic number assigned,
i.e. something like gisine ftgen 0, 0, 1024, 10, 1?
How can i retreive the assigned number?

Thanks again,
ciao,
francesco,

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-09-11 19:58
Fromjpff
SubjectRe: [Csnd] getting fgens via API
As far as I can tell you could search in a loop as GetTable returns -1 for a 
nonexistent table, or you could use a channel to transmit gisine.  It might be 
nice to know maxfnum (largest table number) but I think it is not available

On Mon, 11 Sep 2017, Francesco Porta wrote:

> Thanks Rory,
> but i do not understand (as usual :)).
> I am doing this:
> 1 retrieve the fgen number reading a csd as text
> 2 retrieve length and values using
>
>    cs:TableLength(numeroTavola)
>    for i=1, length do
> 	value = cs:TableGet(numeroTavola, i)
>    end
>
> this is working ok. But what if i have an orchestra ftgen with automatic number assigned,
> i.e. something like gisine ftgen 0, 0, 1024, 10, 1?
> How can i retreive the assigned number?
>

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-09-11 23:57
FromRory Walsh
SubjectRe: [Csnd] getting fgens via API
To get around this issue I've simply set the table number. But I agree, it would be nice to be able to use these tables. It doesn't work with Cabbage either. It can be done via the API, but it's a hack. You can parse the Csd for the global table variables. When you have their name you can run Csound in debug mode for a single cycle and grab the value of the global variables. Their order of appearance in the header section plus 100 will give you the table number. I always thought it would be nice to have an API function to query the value of any variable at any given time, but I don't think it's possible without serious restructuring. Perhaps this is why use channels instead!   

On 11 September 2017 at 19:58, jpff <jpff@codemist.co.uk> wrote:
As far as I can tell you could search in a loop as GetTable returns -1 for a nonexistent table, or you could use a channel to transmit gisine.  It might be nice to know maxfnum (largest table number) but I think it is not available

On Mon, 11 Sep 2017, Francesco Porta wrote:

Thanks Rory,
but i do not understand (as usual :)).
I am doing this:
1 retrieve the fgen number reading a csd as text
2 retrieve length and values using

   cs:TableLength(numeroTavola)
   for i=1, length do
        value = cs:TableGet(numeroTavola, i)
   end

this is working ok. But what if i have an orchestra ftgen with automatic number assigned,
i.e. something like gisine ftgen 0, 0, 1024, 10, 1?
How can i retreive the assigned number?


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-09-12 00:44
FromJohn ff
SubjectRe: [Csnd] getting fgens via API
Not entirely true. It allocates from 100 but skips already existing used table numbers.  Basically you say I do not care about the number when you ask for some value and it may change how it is done.

⁣Sent from TypeApp ​

On Sep 11, 2017, 23:58, at 23:58, Rory Walsh  wrote:
>To get around this issue I've simply set the table number. But I agree,
>it
>would be nice to be able to use these tables. It doesn't work with
>Cabbage
>either. It can be done via the API, but it's a hack. You can parse the
>Csd
>for the global table variables. When you have their name you can run
>Csound
>in debug mode for a single cycle and grab the value of the global
>variables. Their order of appearance in the header section plus 100
>will
>give you the table number. I always thought it would be nice to have an
>API
>function to query the value of any variable at any given time, but I
>don't
>think it's possible without serious restructuring. Perhaps this is why
>use
>channels instead!
>
>On 11 September 2017 at 19:58, jpff  wrote:
>
>> As far as I can tell you could search in a loop as GetTable returns
>-1 for
>> a nonexistent table, or you could use a channel to transmit gisine. 
>It
>> might be nice to know maxfnum (largest table number) but I think it
>is not
>> available
>>
>> On Mon, 11 Sep 2017, Francesco Porta wrote:
>>
>> Thanks Rory,
>>> but i do not understand (as usual :)).
>>> I am doing this:
>>> 1 retrieve the fgen number reading a csd as text
>>> 2 retrieve length and values using
>>>
>>>    cs:TableLength(numeroTavola)
>>>    for i=1, length do
>>>         value = cs:TableGet(numeroTavola, i)
>>>    end
>>>
>>> this is working ok. But what if i have an orchestra ftgen with
>automatic
>>> number assigned,
>>> i.e. something like gisine ftgen 0, 0, 1024, 10, 1?
>>> How can i retreive the assigned number?
>>>
>>>
>> 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-09-12 10:02
FromVictor Lazzarini
SubjectRe: [Csnd] getting fgens via API
We should have this discussion in the developers’ list, but anyway, here’s the situation regarding access to “any variable”,
as I see it.

1. Steven’s type system would allow us to expose access to variables, that is not the main issue.
2. Local variables are allocated in an instrument variable pool, and they exist per-instance
3. Globals are in a global pool.
4. To access a variable in an instrument we need to have an instance handle of some kind. So a mechanism to
manipulate instance handles needs to be added to the API.
5. Accessing the global pool should be easier since it does not depend on any given instance.

So we need to design an API to access the type system, and we should do this in a way that is complete
and without hacks. If it is agreed that we should do this, we can put that on the 7.00 list.
========================
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 11 Sep 2017, at 23:57, Rory Walsh  wrote:
> 
> To get around this issue I've simply set the table number. But I agree, it would be nice to be able to use these tables. It doesn't work with Cabbage either. It can be done via the API, but it's a hack. You can parse the Csd for the global table variables. When you have their name you can run Csound in debug mode for a single cycle and grab the value of the global variables. Their order of appearance in the header section plus 100 will give you the table number. I always thought it would be nice to have an API function to query the value of any variable at any given time, but I don't think it's possible without serious restructuring. Perhaps this is why use channels instead!   
> 
> On 11 September 2017 at 19:58, jpff  wrote:
> As far as I can tell you could search in a loop as GetTable returns -1 for a nonexistent table, or you could use a channel to transmit gisine.  It might be nice to know maxfnum (largest table number) but I think it is not available
> 
> On Mon, 11 Sep 2017, Francesco Porta wrote:
> 
> Thanks Rory,
> but i do not understand (as usual :)).
> I am doing this:
> 1 retrieve the fgen number reading a csd as text
> 2 retrieve length and values using
> 
>    cs:TableLength(numeroTavola)
>    for i=1, length do
>         value = cs:TableGet(numeroTavola, i)
>    end
> 
> this is working ok. But what if i have an orchestra ftgen with automatic number assigned,
> i.e. something like gisine ftgen 0, 0, 1024, 10, 1?
> How can i retreive the assigned number?
> 
> 
> 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-09-12 10:53
FromRory Walsh
SubjectRe: [Csnd] getting fgens via API
I think it would be very useful. Definitely worth further discussion. But I don't think we should to be able to directly modify variables from the API. I think that might just lead to abuse. 

On 12 September 2017 at 10:02, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
We should have this discussion in the developers’ list, but anyway, here’s the situation regarding access to “any variable”,
as I see it.

1. Steven’s type system would allow us to expose access to variables, that is not the main issue.
2. Local variables are allocated in an instrument variable pool, and they exist per-instance
3. Globals are in a global pool.
4. To access a variable in an instrument we need to have an instance handle of some kind. So a mechanism to
manipulate instance handles needs to be added to the API.
5. Accessing the global pool should be easier since it does not depend on any given instance.

So we need to design an API to access the type system, and we should do this in a way that is complete
and without hacks. If it is agreed that we should do this, we can put that on the 7.00 list.
========================
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 11 Sep 2017, at 23:57, Rory Walsh <rorywalsh@ear.ie> wrote:
>
> To get around this issue I've simply set the table number. But I agree, it would be nice to be able to use these tables. It doesn't work with Cabbage either. It can be done via the API, but it's a hack. You can parse the Csd for the global table variables. When you have their name you can run Csound in debug mode for a single cycle and grab the value of the global variables. Their order of appearance in the header section plus 100 will give you the table number. I always thought it would be nice to have an API function to query the value of any variable at any given time, but I don't think it's possible without serious restructuring. Perhaps this is why use channels instead!
>
> On 11 September 2017 at 19:58, jpff <jpff@codemist.co.uk> wrote:
> As far as I can tell you could search in a loop as GetTable returns -1 for a nonexistent table, or you could use a channel to transmit gisine.  It might be nice to know maxfnum (largest table number) but I think it is not available
>
> On Mon, 11 Sep 2017, Francesco Porta wrote:
>
> Thanks Rory,
> but i do not understand (as usual :)).
> I am doing this:
> 1 retrieve the fgen number reading a csd as text
> 2 retrieve length and values using
>
>    cs:TableLength(numeroTavola)
>    for i=1, length do
>         value = cs:TableGet(numeroTavola, i)
>    end
>
> this is working ok. But what if i have an orchestra ftgen with automatic number assigned,
> i.e. something like gisine ftgen 0, 0, 1024, 10, 1?
> How can i retreive the assigned number?
>
>
> 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