Csound Csound-dev Csound-tekno Search About

[Cs-dev] Nested If's in UDO

Date2005-05-23 08:32
FromSteven Yi
Subject[Cs-dev] Nested If's in UDO
AttachmentsNone  test.csd  

Date2005-05-23 12:28
FromIstvan Varga
SubjectRe: [Cs-dev] Nested If's in UDO
Steven Yi wrote:

> In the example CSD file I have enabled three places where there are
> printk statements, one within the UDO just before the xout output, one
> after the release envelope section of the UDO, and one within the
> calling instrument.  When the last note of a set of tied notes is
> reached, the value within the release envelope section of the UDO is
> generating correctly, but the calling instrument does not receive the 
> value generated by the UDO, instead receiving 0 value.

I have been able to fix the error by commenting out the (apparently
redundant) last elseif case; I also added a newline to printks to make
the output more readable:

     elseif (p3 > 0 && itie == 1) then
         ; this is an end note out of a group of tied notes
         kenv linseg     1, p3 - 1, 1, 1, 0

         printk .1, kenv

/*  elseif (p3 > 0 && itie == 1) then
         ; this is a single note

         ; TODO - Should Remove, use articulation from other places
         ;kenv adsr      .2, 0, 1, 1
         kenv adsr iattack, idecay, isus, irel
*/

     endif

endif

       printks "Value before leaving UDO: %f\n", .1, kenv

I do not know why the last elseif corrupts kenv; it is probably best to
stick with old (and reliable) if...goto style conditionals, as if...endif
seems to have many obscure bugs and Matt Ingalls (author of if/then/else)
does not seem to be interested in Csound5 development.

 > I'm not sure what to make of this.  It's strange to me that the printk
 > statement within the UDO gives an instrument 203 for it's statement (I
 > haven't checked how UDO's are implemented underneath the hood).

UDO's are really instruments with instrument numbers that cannot be used
directly from the score. I will fix printk to print the real instrument
number (in this case, instr 3) instead of the instrument number of the UDO.

 > It makes me think that's there some kind of strange issue with instrument
 > number and processing order.  Could it be possible that the UDO is
 > processed after the instrument,

No, UDO's are performed from within the calling instrument, and not independently
from kperf().

 > print statments seem out of order some how too when in the release
 > stage.

Perhaps printk and printks round time values slightly differently and the
printing from the two different opcodes does not occur in exactly the same
k-period.


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-05-23 13:05
FromIstvan Varga
SubjectRe: [Cs-dev] Nested If's in UDO
Now committed, printk prints the correct instrument number:

  i   3 time    15.35604:     1.00000
Value before leaving UDO: 1.000000
  i   3 time    15.35604:     1.00000
  i   3 time    15.45604:     0.90355
Value before leaving UDO: 0.903549
  i   3 time    15.45604:     0.90355
  i   3 time    15.55604:     0.80356
Value before leaving UDO: 0.803556
  i   3 time    15.55604:     0.80356
etc.


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-05-23 15:45
FromSteven Yi
SubjectRe: [Cs-dev] Nested If's in UDO
AttachmentsNone  

Date2005-05-28 03:45
From"Richard Boulanger"
SubjectRe: [Cs-dev] Nested If's in UDO
Steven,

I haven't had anything to offer as far as a solution goes, but I do hope you
will share the finished/corrected version with me/us.

Dr. B.

on 5/23/05 3:32 AM, Steven Yi at stevenyi@gmail.com wrote:

> Hi All,
> 
> This is a bit of a strange error I'm having.  In the attached CSD
> file, there is a UDO entitled yiEnvelope which I've been trying to
> convert to using if/then type statements.  So far it almost works,
> except on the release note of set of tied notes.
> 
> In the example CSD file I have enabled three places where there are
> printk statements, one within the UDO just before the xout output, one
> after the release envelope section of the UDO, and one within the
> calling instrument.  When the last note of a set of tied notes is
> reached, the value within the release envelope section of the UDO is
> generating correctly, but the calling instrument does not receive the
> value generated by the UDO, instead receiving 0 value.
> 
> I'm not sure what to make of this.  It's strange to me that the printk
> statement within the UDO gives an instrument 203 for it's statement (I
> haven't checked how UDO's are implemented underneath the hood).  It
> makes me think that's there some kind of strange issue with instrument
> number and processing order.  Could it be possible that the UDO is
> processed after the instrument, but somehow on each kpass the value is
> initialized to 0, the instrument runs, then the UDO is computed?  The
> print statments seem out of order some how too when in the release
> stage.
> 
> Anyways, it's late; I hope it's a user-error and I'm simply missing
> something at this hour, but if not, any suggestions?
> 
> Thanks,
> steven
> 

_______________________________________________________________________
 +  Dr. Richard Boulanger, Professor
 +  Music Synthesis Department, Berklee College of Music
 +  1140 Boylston Street  - Boston, MA  02215-3693
 +  Office Phone: (617) 747-2485   Office Fax: (617) 747-2564
 +  eMail: rboulanger@berklee.edu or rboulanger@csounds.com
 +  WebPage: http://csounds.com/boulanger/
________________________________________________________________________
 +  Almost Everything Csound @ http://csounds.com/
 +  The Csound Instrument Catalog @ http://csounds.com/catalog/
 +  The Csound Book @ http://csounds.com/book/
 +  The Csound Magazine @ http://csounds.com/ezine/
 +  The MacCsound, CsoundAV & CsoundVST Forums @ http://csounds.com/phpBB2/
________________________________________________________________________



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-05-28 04:39
FromSteven Yi
SubjectRe: [Cs-dev] Nested If's in UDO
AttachmentsNone  

Date2005-05-28 04:44
From"Richard Boulanger"
SubjectRe: [Cs-dev] Nested If's in UDO
Please share the new working instrument with us!

Dr. B.

on 5/27/05 11:39 PM, Steven Yi at stevenyi@gmail.com wrote:

> Hi Dr. B,
> 
> The conclusion to this was resolved a couple of days ago (I think it
> was on a different email thread). We found where the problem was and
> Istvan put in a fix, so nested if/then's are working out just fine now
> in CS5.
> 
> steven
> 
> 
> On 5/27/05, Richard Boulanger  wrote:
>> Steven,
>> 
>> I haven't had anything to offer as far as a solution goes, but I do hope you
>> will share the finished/corrected version with me/us.
>> 
>> Dr. B.
>> 
>> on 5/23/05 3:32 AM, Steven Yi at stevenyi@gmail.com wrote:
>> 
>>> Hi All,
>>> 
>>> This is a bit of a strange error I'm having.  In the attached CSD
>>> file, there is a UDO entitled yiEnvelope which I've been trying to
>>> convert to using if/then type statements.  So far it almost works,
>>> except on the release note of set of tied notes.
>>> 
>>> In the example CSD file I have enabled three places where there are
>>> printk statements, one within the UDO just before the xout output, one
>>> after the release envelope section of the UDO, and one within the
>>> calling instrument.  When the last note of a set of tied notes is
>>> reached, the value within the release envelope section of the UDO is
>>> generating correctly, but the calling instrument does not receive the
>>> value generated by the UDO, instead receiving 0 value.
>>> 
>>> I'm not sure what to make of this.  It's strange to me that the printk
>>> statement within the UDO gives an instrument 203 for it's statement (I
>>> haven't checked how UDO's are implemented underneath the hood).  It
>>> makes me think that's there some kind of strange issue with instrument
>>> number and processing order.  Could it be possible that the UDO is
>>> processed after the instrument, but somehow on each kpass the value is
>>> initialized to 0, the instrument runs, then the UDO is computed?  The
>>> print statments seem out of order some how too when in the release
>>> stage.
>>> 
>>> Anyways, it's late; I hope it's a user-error and I'm simply missing
>>> something at this hour, but if not, any suggestions?
>>> 
>>> Thanks,
>>> steven
>>> 
>> 
>> _______________________________________________________________________
>>  +  Dr. Richard Boulanger, Professor
>>  +  Music Synthesis Department, Berklee College of Music
>>  +  1140 Boylston Street  - Boston, MA  02215-3693
>>  +  Office Phone: (617) 747-2485   Office Fax: (617) 747-2564
>>  +  eMail: rboulanger@berklee.edu or rboulanger@csounds.com
>>  +  WebPage: http://csounds.com/boulanger/
>> ________________________________________________________________________
>>  +  Almost Everything Csound @ http://csounds.com/
>>  +  The Csound Instrument Catalog @ http://csounds.com/catalog/
>>  +  The Csound Book @ http://csounds.com/book/
>>  +  The Csound Magazine @ http://csounds.com/ezine/
>>  +  The MacCsound, CsoundAV & CsoundVST Forums @ http://csounds.com/phpBB2/
>> ________________________________________________________________________
>> 
>> 
>> 
>> -------------------------------------------------------
>> This SF.Net email is sponsored by Yahoo.
>> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
>> Search APIs Find out how you can build Yahoo! directly into your own
>> Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

_______________________________________________________________________
 +  Dr. Richard Boulanger, Professor
 +  Music Synthesis Department, Berklee College of Music
 +  1140 Boylston Street  - Boston, MA  02215-3693
 +  Office Phone: (617) 747-2485   Office Fax: (617) 747-2564
 +  eMail: rboulanger@berklee.edu or rboulanger@csounds.com
 +  WebPage: http://csounds.com/boulanger/
________________________________________________________________________
 +  Almost Everything Csound @ http://csounds.com/
 +  The Csound Instrument Catalog @ http://csounds.com/catalog/
 +  The Csound Book @ http://csounds.com/book/
 +  The Csound Magazine @ http://csounds.com/ezine/
 +  The MacCsound, CsoundAV & CsoundVST Forums @ http://csounds.com/phpBB2/
________________________________________________________________________



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net