Csound Csound-dev Csound-tekno Search About

[Csnd] Named instr as opcode not working?

Date2009-09-28 17:03
FromJacob Joaquin
Subject[Csnd] Named instr as opcode not working?
The Csound manual says in instr.html that, "You can call an instrument
within an instrument as if it were an opcode either with the subinstr
opcode or by specifying an instrument with a text name" and gives this
example:

    asig MyOscil iamp, ipitch, iftable

I get this error when trying to use a named instr as an opcode:

    15 lines read
	instr	MyOscil	
	instr	Bar	
    error:  illegal character (, line 15:
            a1 MyOscil p4, cpspch(p5)
                                 ^
    error:  illegal character ), line 15:
            a1 MyOscil p4, cpspch(p5)
                                    ^
    error:  no legal opcode, line 15:
            a1 MyOscil p4, cpspch(p5)
    error:  input arg 'a1' used before defined, line 16:
            out a1
    instr MyOscil uses instrument number 1
    instr Bar uses instrument number 2
    4 syntax errors in orchestra.  compilation invalid


Here is the csd I'm using:

    
    
    sr     = 44100
    kr     = 4410
    ksmps  = 10
    nchnls = 1
    0dbfs = 1.0

    instr MyOscil
        asig oscils p4, p5, 1
        outc asig
    endin

    instr Bar
        a1 MyOscil p4, cpspch(p5)
        out a1
    endin
    
    
    i "Bar" 0 1 0.5 8.00
    
    


I tested subinstr as well, and that seems to be working just fine.
I'm running 5.11 for OS X.

Best,
Jake

Date2009-09-28 17:09
FromSteven Yi
Subject[Csnd] Re: Named instr as opcode not working?
I think this may be broken and has been for a while.  I'd recommend we
drop this feature and just use UDO's or subinstr and revise the docs.

On Mon, Sep 28, 2009 at 12:03 PM, Jacob Joaquin  wrote:
> The Csound manual says in instr.html that, "You can call an instrument
> within an instrument as if it were an opcode either with the subinstr
> opcode or by specifying an instrument with a text name" and gives this
> example:
>
>    asig MyOscil iamp, ipitch, iftable
>
> I get this error when trying to use a named instr as an opcode:
>
>    15 lines read
>        instr   MyOscil
>        instr   Bar
>    error:  illegal character (, line 15:
>            a1 MyOscil p4, cpspch(p5)
>                                 ^
>    error:  illegal character ), line 15:
>            a1 MyOscil p4, cpspch(p5)
>                                    ^
>    error:  no legal opcode, line 15:
>            a1 MyOscil p4, cpspch(p5)
>    error:  input arg 'a1' used before defined, line 16:
>            out a1
>    instr MyOscil uses instrument number 1
>    instr Bar uses instrument number 2
>    4 syntax errors in orchestra.  compilation invalid
>
>
> Here is the csd I'm using:
>
>    
>    
>    sr     = 44100
>    kr     = 4410
>    ksmps  = 10
>    nchnls = 1
>    0dbfs = 1.0
>
>    instr MyOscil
>        asig oscils p4, p5, 1
>        outc asig
>    endin
>
>    instr Bar
>        a1 MyOscil p4, cpspch(p5)
>        out a1
>    endin
>    
>    
>    i "Bar" 0 1 0.5 8.00
>    
>    
>
>
> I tested subinstr as well, and that seems to be working just fine.
> I'm running 5.11 for OS X.
>
> Best,
> Jake
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Date2009-09-28 17:50
FromVictor Lazzarini
Subject[Csnd] Re: Named instr as opcode not working?
I don't think this was ever possible in Csound5. I think it is a  
deprecated
feature of 4.*, and should not be in the manual.

Victor
On 28 Sep 2009, at 17:03, Jacob Joaquin wrote:

> The Csound manual says in instr.html that, "You can call an instrument
> within an instrument as if it were an opcode either with the subinstr
> opcode or by specifying an instrument with a text name" and gives this
> example:
>
>    asig MyOscil iamp, ipitch, iftable
>
> I get this error when trying to use a named instr as an opcode:
>
>    15 lines read
> 	instr	MyOscil	
> 	instr	Bar	
>    error:  illegal character (, line 15:
>            a1 MyOscil p4, cpspch(p5)
>                                 ^
>    error:  illegal character ), line 15:
>            a1 MyOscil p4, cpspch(p5)
>                                    ^
>    error:  no legal opcode, line 15:
>            a1 MyOscil p4, cpspch(p5)
>    error:  input arg 'a1' used before defined, line 16:
>            out a1
>    instr MyOscil uses instrument number 1
>    instr Bar uses instrument number 2
>    4 syntax errors in orchestra.  compilation invalid
>
>
> Here is the csd I'm using:
>
>    
>    
>    sr     = 44100
>    kr     = 4410
>    ksmps  = 10
>    nchnls = 1
>    0dbfs = 1.0
>
>    instr MyOscil
>        asig oscils p4, p5, 1
>        outc asig
>    endin
>
>    instr Bar
>        a1 MyOscil p4, cpspch(p5)
>        out a1
>    endin
>    
>    
>    i "Bar" 0 1 0.5 8.00
>    
>    
>
>
> I tested subinstr as well, and that seems to be working just fine.
> I'm running 5.11 for OS X.
>
> Best,
> Jake
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"


Date2009-09-28 18:18
FromJacob Joaquin
Subject[Csnd] Re: Re: Named instr as opcode not working?
I second your recommendation.

While we're on the subject of UDOs.  I just ran a test to see if an
UDO name will override the name of existing opcode, and it came back
positive.   My spidey sense is sensing some potential problems with
this down the road.

Perhaps the same treatment could be applied to UDOs and subinstr does, such as

    a1 udo "MyUdo", 1.0, 440

instead of

    a1 MyUdo 1.0, 440

What I'm not recommending is the invalidate the current UDO syntax in
an instrument, as we don't want to break backwards compatibility, but
deprecate it and encourage using the udo opcode instead.

Here is my test file:

    
    
    sr     = 44100
    kr     = 4410
    ksmps  = 10
    nchnls = 1
    0dbfs = 1.0

    opcode oscils, a, iii
        i1, i2, i3 xin
        a1 oscil i1, i2 * 2, 1, i3
        xout a1
    endop

    instr 1
        a1 oscils 1.0, 440, 0
        out a1
    endin

    
    
    f 1 0 8192 10 1
    i 1 0 1
    
    

Best,
Jake


On Mon, Sep 28, 2009 at 9:09 AM, Steven Yi  wrote:
> I think this may be broken and has been for a while.  I'd recommend we
> drop this feature and just use UDO's or subinstr and revise the docs.


Date2009-10-03 16:17
FromAndrés
Subject[Csnd] Re: Re: Re: Named instr as opcode not working?
Hi,

How about just a warning when the opcode already exists? I think it's
not bad to allow redefinition of existing opcodes.

Cheers,
Andrés

El lun, 28-09-2009 a las 10:18 -0700, Jacob Joaquin escribió:
> I second your recommendation.
> 
> While we're on the subject of UDOs.  I just ran a test to see if an
> UDO name will override the name of existing opcode, and it came back
> positive.   My spidey sense is sensing some potential problems with
> this down the road.
> 
> Perhaps the same treatment could be applied to UDOs and subinstr does, such as
> 
>     a1 udo "MyUdo", 1.0, 440
> 
> instead of
> 
>     a1 MyUdo 1.0, 440
> 
> What I'm not recommending is the invalidate the current UDO syntax in
> an instrument, as we don't want to break backwards compatibility, but
> deprecate it and encourage using the udo opcode instead.
> 
> Here is my test file:
> 
>     
>     
>     sr     = 44100
>     kr     = 4410
>     ksmps  = 10
>     nchnls = 1
>     0dbfs = 1.0
> 
>     opcode oscils, a, iii
>         i1, i2, i3 xin
>         a1 oscil i1, i2 * 2, 1, i3
>         xout a1
>     endop
> 
>     instr 1
>         a1 oscils 1.0, 440, 0
>         out a1
>     endin
> 
>     
>     
>     f 1 0 8192 10 1
>     i 1 0 1
>     
>     
> 
> Best,
> Jake
> 
> 
> On Mon, Sep 28, 2009 at 9:09 AM, Steven Yi  wrote:
> > I think this may be broken and has been for a while.  I'd recommend we
> > drop this feature and just use UDO's or subinstr and revise the docs.
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2009-10-03 16:44
FromJacob Joaquin
Subject[Csnd] Re: Re: Re: Re: Named instr as opcode not working?
I recognize that I might be splitting hairs here, though I do have my reasons.

My main concern is portability.  If someone copy/pastes an instrument
from another orchestra, and this instrument uses an UDO that overrides
an existing opcode, this may cause confusion.  I suspect that this
could cause someone, newbie or veteran, to pull out their hair trying
to figure out why the instrument does not work as expected when used
in their new orchestra.  If the original instrument called the UDO
with an udo opcode, at least a message error would pop up, and the
user would know immediately what the problem was.  Making Csound
slightly more user-friendly.

This wouldn't avoid all problems. For example, what if there was a
different UDO of the same name in the new orchestra.  Even in this
case, at least when a user is looking over their copied instrument,
they have a better chance to figure out the problem as the udo opcode
itself is a clear indicator that the instrument has an outside
dependency.

Best,
Jake



2009/10/3 Andrés Cabrera :
> Hi,
>
> How about just a warning when the opcode already exists? I think it's
> not bad to allow redefinition of existing opcodes.
>
> Cheers,
> Andrés
>
> El lun, 28-09-2009 a las 10:18 -0700, Jacob Joaquin escribió:
>> I second your recommendation.
>>
>> While we're on the subject of UDOs.  I just ran a test to see if an
>> UDO name will override the name of existing opcode, and it came back
>> positive.   My spidey sense is sensing some potential problems with
>> this down the road.
>>
>> Perhaps the same treatment could be applied to UDOs and subinstr does, such as
>>
>>     a1 udo "MyUdo", 1.0, 440
>>
>> instead of
>>
>>     a1 MyUdo 1.0, 440
>>
>> What I'm not recommending is the invalidate the current UDO syntax in
>> an instrument, as we don't want to break backwards compatibility, but
>> deprecate it and encourage using the udo opcode instead.
>>
>> Here is my test file:
>>
>>     
>>     
>>     sr     = 44100
>>     kr     = 4410
>>     ksmps  = 10
>>     nchnls = 1
>>     0dbfs = 1.0
>>
>>     opcode oscils, a, iii
>>         i1, i2, i3 xin
>>         a1 oscil i1, i2 * 2, 1, i3
>>         xout a1
>>     endop
>>
>>     instr 1
>>         a1 oscils 1.0, 440, 0
>>         out a1
>>     endin
>>
>>     
>>     
>>     f 1 0 8192 10 1
>>     i 1 0 1
>>     
>>     
>>
>> Best,
>> Jake
>>
>>
>> On Mon, Sep 28, 2009 at 9:09 AM, Steven Yi  wrote:
>> > I think this may be broken and has been for a while.  I'd recommend we
>> > drop this feature and just use UDO's or subinstr and revise the docs.
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"