Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Re: k-rate to i-rate conversion and vice versa

Date2011-03-21 14:15
From"Art Hunkins"
SubjectRe: [Csnd] Re: k-rate to i-rate conversion and vice versa
This suggestion should work with schedkwhen as well.

Art Hunkins

----- Original Message ----- 
From: "Louis Cohen" 
To: 
Sent: Monday, March 21, 2011 10:06 AM
Subject: Re: [Csnd] Re: k-rate to i-rate conversion and vice versa


> Jan Jacob,
>
> I don't know if this will help, but one method I use for computing a 
> krate variable and then using at irate is first calculate the krate 
> variable, then use it in an "event" opcode to pass as a parameter to 
> another instrument, which will see it as irate.
>
> best,
> Lou Cohen
>
> On Mar 21, 2011, at 8:35 AM, Jan Jacob Hofmann wrote:
>
>> Dear List,
>>
>> both of the answers I got so far did not really solve the problem. 
>> Setting ktest by using init does not work in practice, as actually I 
>> would like to use a k-rate variable to convert to a i-rate variable  by 
>> using the i(x) opcode. The point here is, that the actual k-rate  value 
>> is not yet "ready" at init time. For me this looks like a  general 
>> problem: *Every* k-rate variable is not yet calculated at  the time, the 
>> i(x) opcode works, as this one works before, at the i- time-pass. So for 
>> me it looks like I could not get any k-rate- variable to be converted to 
>> i-time.
>>
>> The other opportunity to send the k-rate variable to another  instrument 
>> by shedkwhen does not work either for me as I would need  the result of 
>> the i-rate conversion back in the instrument of the  origin. My task is 
>> to modify the duration of a reverb instrument  according to the kdecay of 
>> the reverb tail. So the i-rate variable  would have to be accessible in 
>> that same instrument to modify its  duration. It looks like there is no 
>> way to bring back the i-rate- variable calculated in another triggered 
>> instrument back.
>>
>> But somehow there must be a general way to use i(x) for such things,  as 
>> far as I can see, this is just the main purpose of that opcode.  Any 
>> ideas are appreciated.
>>
>> Best regards,
>>
>> Jan Jacob
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> Date: Fri, 18 Mar 2011 13:19:24 -0400
>>> From: "Art Hunkins" 
>>> Subject: Re: [Csnd] k-rate to i-rate conversion and vice versa
>>>
>>> Changing ktest = 1 to ktest init 1
>>> should work for you.
>>>
>>> The former statement isn't run at init time.
>>>
>>> Art Hunkins
>>>
>>> ----- Original Message -----
>>> From: "Jan Jacob Hofmann" 
>>> To: "Csound List" 
>>> Sent: Friday, March 18, 2011 12:54 PM
>>> Subject: [Csnd] k-rate to i-rate conversion and vice versa
>>>
>>>
>>>> Dear List,
>>>>
>>>> I would like to convert a k-rate signal at instrument start to an  i- 
>>>> rate
>>>> signal. I thought using the opcode i(k-rate) would be a good idea,
>>>> however I do get unexpected results: The output of that opcode  is 
>>>> always
>>>> "0", regardless of the value of the k-rate input. Am I  getting 
>>>> something
>>>> wrong?
>>>>
>>>> Here is an example:
>>>>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> sr = 44100
>>>> ksmps = 128
>>>> nchnls = 1
>>>>
>>>>
>>>> instr 1
>>>> ktest = 1 ; set k-rate signal to 1
>>>> itest = i(ktest) ; convert k-rate signal to i-rate
>>>> print itest ; print i-rate signal. I would expect to see  itest=1,  but
>>>> itest= 0 is printed
>>>> endin
>>>>
>>>>
>>>> 
>>>> 
>>>>
>>>> i1 0 1
>>>> e
>>>>
>>>> 
>>>> 
>>>>
>>>>
>>>> Cheers,
>>>>
>>>> Jan Jacob
>>>>
>>>>
>>>>
>>>>
>>>> sound |   movement     |        object        |
>>>> space
>>>> sonic architecture    |     site: http://www.sonicarchitecture.de
>>>> spatial electronic composition     |   2nd order ambisonic music
>>>>
>>>>
>>>>
>>>> Send bugs reports to the Sourceforge bug tracker
>>>>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>>> Discussions of bugs and features can be posted here
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body 
>>>> "unsubscribe
>>>> csound"
>>>>
>>>
>>>
>>> ------------------------------
>>>
>>> Date: Fri, 18 Mar 2011 10:31:50 -0700
>>> From: Justin Glenn Smith 
>>> Subject: Re: [Csnd] k-rate to i-rate conversion and vice versa
>>>
>>> If I am not mistaken, all of the i rate operations in an instrument  are
>>> finalized before any k rate operations are started. This includes 
>>> assignment
>>> via =. So ktest simply doesn't have a value at i time. If what you  want 
>>> is to
>>> do i-time operations on a k-rate signal, I would suggest a second 
>>> instrument
>>> launched with schedkwhen, with the k rate parameters plugged into the
>>> schedkwhen.
>>
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> 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 the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> 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 the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-03-21 14:34
FromJustin Glenn Smith
SubjectRe: [Csnd] Re: k-rate to i-rate conversion and vice versa
See below for my suggestion of getting the data back from the spawned instrument.

Art Hunkins wrote:
> This suggestion should work with schedkwhen as well.
> 
> Art Hunkins
> 
> ----- Original Message ----- From: "Louis Cohen" 
> To: 
> Sent: Monday, March 21, 2011 10:06 AM
> Subject: Re: [Csnd] Re: k-rate to i-rate conversion and vice versa
> 
> 
>> Jan Jacob,
>>
>> I don't know if this will help, but one method I use for computing a
>> krate variable and then using at irate is first calculate the krate
>> variable, then use it in an "event" opcode to pass as a parameter to
>> another instrument, which will see it as irate.
>>
>> best,
>> Lou Cohen
>>
>> On Mar 21, 2011, at 8:35 AM, Jan Jacob Hofmann wrote:
>>
>>> Dear List,
>>>
>>> both of the answers I got so far did not really solve the problem.
>>> Setting ktest by using init does not work in practice, as actually I
>>> would like to use a k-rate variable to convert to a i-rate variable 
>>> by using the i(x) opcode. The point here is, that the actual k-rate 
>>> value is not yet "ready" at init time. For me this looks like a 
>>> general problem: *Every* k-rate variable is not yet calculated at 
>>> the time, the i(x) opcode works, as this one works before, at the i-
>>> time-pass. So for me it looks like I could not get any k-rate-
>>> variable to be converted to i-time.
>>>
>>> The other opportunity to send the k-rate variable to another 
>>> instrument by shedkwhen does not work either for me as I would need 
>>> the result of the i-rate conversion back in the instrument of the 
>>> origin. My task is to modify the duration of a reverb instrument 
>>> according to the kdecay of the reverb tail. So the i-rate variable 
>>> would have to be accessible in that same instrument to modify its 
>>> duration. It looks like there is no way to bring back the i-rate-
>>> variable calculated in another triggered instrument back.

Look closer.

You could use a global k rate variable, or a k rate zak space variable,
or write and read a variable at k rate using a table. These are the
ways I would communicate between running instruments (the calling instrument
initializes the variable at i time, then continuously updates the variable
from the shared data, referencing gk, using zkr to set the variable,
or using tab to set the variable. When the other instrument is spawned, it
sets the variable by setting "gk init ...", using ziw, or using tabw_i
at init time.

>>>
>>> But somehow there must be a general way to use i(x) for such things, 
There isn't.

>>> as far as I can see, this is just the main purpose of that opcode. 
It isn't.

>>> Any ideas are appreciated.
>>>
>>> Best regards,
>>>
>>> Jan Jacob
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>> Date: Fri, 18 Mar 2011 13:19:24 -0400
>>>> From: "Art Hunkins" 
>>>> Subject: Re: [Csnd] k-rate to i-rate conversion and vice versa
>>>>
>>>> Changing ktest = 1 to ktest init 1
>>>> should work for you.
>>>>
>>>> The former statement isn't run at init time.
>>>>
>>>> Art Hunkins
>>>>
>>>> ----- Original Message -----
>>>> From: "Jan Jacob Hofmann" 
>>>> To: "Csound List" 
>>>> Sent: Friday, March 18, 2011 12:54 PM
>>>> Subject: [Csnd] k-rate to i-rate conversion and vice versa
>>>>
>>>>
>>>>> Dear List,
>>>>>
>>>>> I would like to convert a k-rate signal at instrument start to an 
>>>>> i- rate
>>>>> signal. I thought using the opcode i(k-rate) would be a good idea,
>>>>> however I do get unexpected results: The output of that opcode  is
>>>>> always
>>>>> "0", regardless of the value of the k-rate input. Am I  getting
>>>>> something
>>>>> wrong?
>>>>>
>>>>> Here is an example:
>>>>>
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> sr = 44100
>>>>> ksmps = 128
>>>>> nchnls = 1
>>>>>
>>>>>
>>>>> instr 1
>>>>> ktest = 1 ; set k-rate signal to 1
>>>>> itest = i(ktest) ; convert k-rate signal to i-rate
>>>>> print itest ; print i-rate signal. I would expect to see  itest=1, 
>>>>> but
>>>>> itest= 0 is printed
>>>>> endin
>>>>>
>>>>>
>>>>> 
>>>>> 
>>>>>
>>>>> i1 0 1
>>>>> e
>>>>>
>>>>> 
>>>>> 
>>>>>
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Jan Jacob
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> sound |   movement     |        object        |
>>>>> space
>>>>> sonic architecture    |     site: http://www.sonicarchitecture.de
>>>>> spatial electronic composition     |   2nd order ambisonic music
>>>>>
>>>>>
>>>>>
>>>>> Send bugs reports to the Sourceforge bug tracker
>>>>>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>>>> Discussions of bugs and features can be posted here
>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>>>> "unsubscribe
>>>>> csound"
>>>>>
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> Date: Fri, 18 Mar 2011 10:31:50 -0700
>>>> From: Justin Glenn Smith 
>>>> Subject: Re: [Csnd] k-rate to i-rate conversion and vice versa
>>>>
>>>> If I am not mistaken, all of the i rate operations in an instrument 
>>>> are
>>>> finalized before any k rate operations are started. This includes
>>>> assignment
>>>> via =. So ktest simply doesn't have a value at i time. If what you 
>>>> want is to
>>>> do i-time operations on a k-rate signal, I would suggest a second
>>>> instrument
>>>> launched with schedkwhen, with the k rate parameters plugged into the
>>>> schedkwhen.
>>>
>>>
>>>
>>> Send bugs reports to the Sourceforge bug tracker
>>>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>> 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 the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> 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 the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> 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 the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"