Csound Csound-dev Csound-tekno Search About

Opcode to init once at beginning of performace

Date2016-01-04 12:04
FromPeter Burgess
SubjectOpcode to init once at beginning of performace
Hi again. Is there an opcode similar to init that initialised a value
only at the very start of the performance, ie, not every time the
instrument is called. I know this can be done with global variables
outside of the instrument definitions, but in some situations it would
be much neater
to just include certain global variable definitions within an
instrument definition.

Pete

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

Date2016-01-04 12:22
FromRory Walsh
SubjectRe: Opcode to init once at beginning of performace
No. Afaik using globals init-ed in instr0 is the only way to achieve this. 

On 4 January 2016 at 12:04, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hi again. Is there an opcode similar to init that initialised a value
only at the very start of the performance, ie, not every time the
instrument is called. I know this can be done with global variables
outside of the instrument definitions, but in some situations it would
be much neater
to just include certain global variable definitions within an
instrument definition.

Pete

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

Date2016-01-04 12:33
FromPeter Burgess
SubjectRe: Opcode to init once at beginning of performace
Fair play, I'll stick with that then, cheers man!

On Mon, Jan 4, 2016 at 12:22 PM, Rory Walsh  wrote:
> No. Afaik using globals init-ed in instr0 is the only way to achieve this.
>
> On 4 January 2016 at 12:04, Peter Burgess 
> wrote:
>>
>> Hi again. Is there an opcode similar to init that initialised a value
>> only at the very start of the performance, ie, not every time the
>> instrument is called. I know this can be done with global variables
>> outside of the instrument definitions, but in some situations it would
>> be much neater
>> to just include certain global variable definitions within an
>> instrument definition.
>>
>> Pete
>>
>> 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

Date2016-01-04 13:13
FromMichael Gogins
SubjectRe: Opcode to init once at beginning of performace
You can, at least, put your global variable initializations directly
above the instrument definition that will use them. What I do is
preface each variable with the name of the instrument, this creates a
kind of namespace and prevents clashes of variables. This includes
ftables and variables used as control channels as well. For example:

gk_Harpsichord_level init 0
gk_HarpsichordPan init .5
gi_Harptable ftgen 0, 0, 65536, 7, -1, 1024, 1, 1024, -1
instr Harpsichord
//////////////////////////////////////////////
// Original by James Kelley.
// Adapted by Michael Gogins.
//////////////////////////////////////////////
insno = p1
itime = p2
iduration = p3
ikey = p4
ivelocity = p5
iphase = p7
ipan = p6
idepth = p8
iheight = p9
ipcs = p10
ihomogeneity = p11
iattack = .005
isustain = p3
irelease = .3
p3 = iattack + isustain + irelease
iHz = cpsmidinn(ikey)
kHz = k(iHz)
iamplitude = ampdb(ivelocity)
aenvelope transeg 1.0, 20.0, -10.0, 0.05
apluck pluck 1, kHz, iHz, 0, 1
aharp poscil 1, kHz, gi_Harptable
aharp2 balance apluck, aharp
asignal = (apluck + aharp2) * iamplitude * aenvelope * 10
adeclick linsegr 0, iattack, 1, isustain, 1, irelease, 0
kgain = ampdb(gk_Harpsichord_level)
asignal = asignal * adeclick * kgain
aoutleft, aoutright pan2 asignal, ipan
chnmix aoutleft, "out_left"
chnmix aoutright, "out_right"
prints "instr %4d t %9.4f d %9.4f k %9.4f v %9.4f p %9.4f\n", p1, p2,
p3, p4, p5, p7
endin




-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Mon, Jan 4, 2016 at 7:33 AM, Peter Burgess
 wrote:
> Fair play, I'll stick with that then, cheers man!
>
> On Mon, Jan 4, 2016 at 12:22 PM, Rory Walsh  wrote:
>> No. Afaik using globals init-ed in instr0 is the only way to achieve this.
>>
>> On 4 January 2016 at 12:04, Peter Burgess 
>> wrote:
>>>
>>> Hi again. Is there an opcode similar to init that initialised a value
>>> only at the very start of the performance, ie, not every time the
>>> instrument is called. I know this can be done with global variables
>>> outside of the instrument definitions, but in some situations it would
>>> be much neater
>>> to just include certain global variable definitions within an
>>> instrument definition.
>>>
>>> Pete
>>>
>>> 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

Date2016-01-04 13:25
FromPeter Burgess
SubjectRe: Opcode to init once at beginning of performace
that's a good point, that will definitely help tidy it up

On Mon, Jan 4, 2016 at 1:13 PM, Michael Gogins  wrote:
> You can, at least, put your global variable initializations directly
> above the instrument definition that will use them. What I do is
> preface each variable with the name of the instrument, this creates a
> kind of namespace and prevents clashes of variables. This includes
> ftables and variables used as control channels as well. For example:
>
> gk_Harpsichord_level init 0
> gk_HarpsichordPan init .5
> gi_Harptable ftgen 0, 0, 65536, 7, -1, 1024, 1, 1024, -1
> instr Harpsichord
> //////////////////////////////////////////////
> // Original by James Kelley.
> // Adapted by Michael Gogins.
> //////////////////////////////////////////////
> insno = p1
> itime = p2
> iduration = p3
> ikey = p4
> ivelocity = p5
> iphase = p7
> ipan = p6
> idepth = p8
> iheight = p9
> ipcs = p10
> ihomogeneity = p11
> iattack = .005
> isustain = p3
> irelease = .3
> p3 = iattack + isustain + irelease
> iHz = cpsmidinn(ikey)
> kHz = k(iHz)
> iamplitude = ampdb(ivelocity)
> aenvelope transeg 1.0, 20.0, -10.0, 0.05
> apluck pluck 1, kHz, iHz, 0, 1
> aharp poscil 1, kHz, gi_Harptable
> aharp2 balance apluck, aharp
> asignal = (apluck + aharp2) * iamplitude * aenvelope * 10
> adeclick linsegr 0, iattack, 1, isustain, 1, irelease, 0
> kgain = ampdb(gk_Harpsichord_level)
> asignal = asignal * adeclick * kgain
> aoutleft, aoutright pan2 asignal, ipan
> chnmix aoutleft, "out_left"
> chnmix aoutright, "out_right"
> prints "instr %4d t %9.4f d %9.4f k %9.4f v %9.4f p %9.4f\n", p1, p2,
> p3, p4, p5, p7
> endin
>
>
>
>
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
>
>
> On Mon, Jan 4, 2016 at 7:33 AM, Peter Burgess
>  wrote:
>> Fair play, I'll stick with that then, cheers man!
>>
>> On Mon, Jan 4, 2016 at 12:22 PM, Rory Walsh  wrote:
>>> No. Afaik using globals init-ed in instr0 is the only way to achieve this.
>>>
>>> On 4 January 2016 at 12:04, Peter Burgess 
>>> wrote:
>>>>
>>>> Hi again. Is there an opcode similar to init that initialised a value
>>>> only at the very start of the performance, ie, not every time the
>>>> instrument is called. I know this can be done with global variables
>>>> outside of the instrument definitions, but in some situations it would
>>>> be much neater
>>>> to just include certain global variable definitions within an
>>>> instrument definition.
>>>>
>>>> Pete
>>>>
>>>> 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

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

Date2016-01-04 21:58
FromSteven Yi
SubjectRe: Opcode to init once at beginning of performace

I use chnset and chnget to do once per performance initialization in my instruments. It looks something like:

If chnget:i(someval) == 0 then
  Do something
  chnset:i(1, "someval")
endif

I have an article about writing encapsulated instruments that has some example code in the Csound journal. (Sorry, typing on a cellphone and hard to lookup)

Hope that helps!

Steven


On Mon, Jan 4, 2016, 5:25 AM Peter Burgess <pete.soundtechnician@gmail.com> wrote:
that's a good point, that will definitely help tidy it up

On Mon, Jan 4, 2016 at 1:13 PM, Michael Gogins <michael.gogins@gmail.com> wrote:
> You can, at least, put your global variable initializations directly
> above the instrument definition that will use them. What I do is
> preface each variable with the name of the instrument, this creates a
> kind of namespace and prevents clashes of variables. This includes
> ftables and variables used as control channels as well. For example:
>
> gk_Harpsichord_level init 0
> gk_HarpsichordPan init .5
> gi_Harptable ftgen 0, 0, 65536, 7, -1, 1024, 1, 1024, -1
> instr Harpsichord
> //////////////////////////////////////////////
> // Original by James Kelley.
> // Adapted by Michael Gogins.
> //////////////////////////////////////////////
> insno = p1
> itime = p2
> iduration = p3
> ikey = p4
> ivelocity = p5
> iphase = p7
> ipan = p6
> idepth = p8
> iheight = p9
> ipcs = p10
> ihomogeneity = p11
> iattack = .005
> isustain = p3
> irelease = .3
> p3 = iattack + isustain + irelease
> iHz = cpsmidinn(ikey)
> kHz = k(iHz)
> iamplitude = ampdb(ivelocity)
> aenvelope transeg 1.0, 20.0, -10.0, 0.05
> apluck pluck 1, kHz, iHz, 0, 1
> aharp poscil 1, kHz, gi_Harptable
> aharp2 balance apluck, aharp
> asignal = (apluck + aharp2) * iamplitude * aenvelope * 10
> adeclick linsegr 0, iattack, 1, isustain, 1, irelease, 0
> kgain = ampdb(gk_Harpsichord_level)
> asignal = asignal * adeclick * kgain
> aoutleft, aoutright pan2 asignal, ipan
> chnmix aoutleft, "out_left"
> chnmix aoutright, "out_right"
> prints "instr %4d t %9.4f d %9.4f k %9.4f v %9.4f p %9.4f\n", p1, p2,
> p3, p4, p5, p7
> endin
>
>
>
>
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
>
>
> On Mon, Jan 4, 2016 at 7:33 AM, Peter Burgess
> <pete.soundtechnician@gmail.com> wrote:
>> Fair play, I'll stick with that then, cheers man!
>>
>> On Mon, Jan 4, 2016 at 12:22 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
>>> No. Afaik using globals init-ed in instr0 is the only way to achieve this.
>>>
>>> On 4 January 2016 at 12:04, Peter Burgess <pete.soundtechnician@gmail.com>
>>> wrote:
>>>>
>>>> Hi again. Is there an opcode similar to init that initialised a value
>>>> only at the very start of the performance, ie, not every time the
>>>> instrument is called. I know this can be done with global variables
>>>> outside of the instrument definitions, but in some situations it would
>>>> be much neater
>>>> to just include certain global variable definitions within an
>>>> instrument definition.
>>>>
>>>> Pete
>>>>
>>>> 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

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

Date2016-01-05 18:07
FromPeter Burgess
SubjectRe: Opcode to init once at beginning of performace
Ah, that is another good idea. Is there much of a difference in
performance between using chnget/chnset as opposed to init? Would it
be noticeable, say, if it had to be done 20,000 times?

On Mon, Jan 4, 2016 at 9:58 PM, Steven Yi  wrote:
> I use chnset and chnget to do once per performance initialization in my
> instruments. It looks something like:
>
> If chnget:i(someval) == 0 then
>   Do something
>   chnset:i(1, "someval")
> endif
>
> I have an article about writing encapsulated instruments that has some
> example code in the Csound journal. (Sorry, typing on a cellphone and hard
> to lookup)
>
> Hope that helps!
>
> Steven
>
>
> On Mon, Jan 4, 2016, 5:25 AM Peter Burgess 
> wrote:
>>
>> that's a good point, that will definitely help tidy it up
>>
>> On Mon, Jan 4, 2016 at 1:13 PM, Michael Gogins 
>> wrote:
>> > You can, at least, put your global variable initializations directly
>> > above the instrument definition that will use them. What I do is
>> > preface each variable with the name of the instrument, this creates a
>> > kind of namespace and prevents clashes of variables. This includes
>> > ftables and variables used as control channels as well. For example:
>> >
>> > gk_Harpsichord_level init 0
>> > gk_HarpsichordPan init .5
>> > gi_Harptable ftgen 0, 0, 65536, 7, -1, 1024, 1, 1024, -1
>> > instr Harpsichord
>> > //////////////////////////////////////////////
>> > // Original by James Kelley.
>> > // Adapted by Michael Gogins.
>> > //////////////////////////////////////////////
>> > insno = p1
>> > itime = p2
>> > iduration = p3
>> > ikey = p4
>> > ivelocity = p5
>> > iphase = p7
>> > ipan = p6
>> > idepth = p8
>> > iheight = p9
>> > ipcs = p10
>> > ihomogeneity = p11
>> > iattack = .005
>> > isustain = p3
>> > irelease = .3
>> > p3 = iattack + isustain + irelease
>> > iHz = cpsmidinn(ikey)
>> > kHz = k(iHz)
>> > iamplitude = ampdb(ivelocity)
>> > aenvelope transeg 1.0, 20.0, -10.0, 0.05
>> > apluck pluck 1, kHz, iHz, 0, 1
>> > aharp poscil 1, kHz, gi_Harptable
>> > aharp2 balance apluck, aharp
>> > asignal = (apluck + aharp2) * iamplitude * aenvelope * 10
>> > adeclick linsegr 0, iattack, 1, isustain, 1, irelease, 0
>> > kgain = ampdb(gk_Harpsichord_level)
>> > asignal = asignal * adeclick * kgain
>> > aoutleft, aoutright pan2 asignal, ipan
>> > chnmix aoutleft, "out_left"
>> > chnmix aoutright, "out_right"
>> > prints "instr %4d t %9.4f d %9.4f k %9.4f v %9.4f p %9.4f\n", p1, p2,
>> > p3, p4, p5, p7
>> > endin
>> >
>> >
>> >
>> >
>> > -----------------------------------------------------
>> > Michael Gogins
>> > Irreducible Productions
>> > http://michaelgogins.tumblr.com
>> > Michael dot Gogins at gmail dot com
>> >
>> >
>> > On Mon, Jan 4, 2016 at 7:33 AM, Peter Burgess
>> >  wrote:
>> >> Fair play, I'll stick with that then, cheers man!
>> >>
>> >> On Mon, Jan 4, 2016 at 12:22 PM, Rory Walsh  wrote:
>> >>> No. Afaik using globals init-ed in instr0 is the only way to achieve
>> >>> this.
>> >>>
>> >>> On 4 January 2016 at 12:04, Peter Burgess
>> >>> 
>> >>> wrote:
>> >>>>
>> >>>> Hi again. Is there an opcode similar to init that initialised a value
>> >>>> only at the very start of the performance, ie, not every time the
>> >>>> instrument is called. I know this can be done with global variables
>> >>>> outside of the instrument definitions, but in some situations it
>> >>>> would
>> >>>> be much neater
>> >>>> to just include certain global variable definitions within an
>> >>>> instrument definition.
>> >>>>
>> >>>> Pete
>> >>>>
>> >>>> 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
>>
>> 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

Date2016-01-08 16:04
FromPeter Burgess
SubjectRe: Opcode to init once at beginning of performace
I thought I'd found a new solution to this. I was hoping that a UDO
would allow me to init a global variable once at the beginning of a
performance within it's definition, but it seems not, lol. I take it
that means that a UDO is only active when called, rather than being
active throughout the performance?

On Tue, Jan 5, 2016 at 6:07 PM, Peter Burgess
 wrote:
> Ah, that is another good idea. Is there much of a difference in
> performance between using chnget/chnset as opposed to init? Would it
> be noticeable, say, if it had to be done 20,000 times?
>
> On Mon, Jan 4, 2016 at 9:58 PM, Steven Yi  wrote:
>> I use chnset and chnget to do once per performance initialization in my
>> instruments. It looks something like:
>>
>> If chnget:i(someval) == 0 then
>>   Do something
>>   chnset:i(1, "someval")
>> endif
>>
>> I have an article about writing encapsulated instruments that has some
>> example code in the Csound journal. (Sorry, typing on a cellphone and hard
>> to lookup)
>>
>> Hope that helps!
>>
>> Steven
>>
>>
>> On Mon, Jan 4, 2016, 5:25 AM Peter Burgess 
>> wrote:
>>>
>>> that's a good point, that will definitely help tidy it up
>>>
>>> On Mon, Jan 4, 2016 at 1:13 PM, Michael Gogins 
>>> wrote:
>>> > You can, at least, put your global variable initializations directly
>>> > above the instrument definition that will use them. What I do is
>>> > preface each variable with the name of the instrument, this creates a
>>> > kind of namespace and prevents clashes of variables. This includes
>>> > ftables and variables used as control channels as well. For example:
>>> >
>>> > gk_Harpsichord_level init 0
>>> > gk_HarpsichordPan init .5
>>> > gi_Harptable ftgen 0, 0, 65536, 7, -1, 1024, 1, 1024, -1
>>> > instr Harpsichord
>>> > //////////////////////////////////////////////
>>> > // Original by James Kelley.
>>> > // Adapted by Michael Gogins.
>>> > //////////////////////////////////////////////
>>> > insno = p1
>>> > itime = p2
>>> > iduration = p3
>>> > ikey = p4
>>> > ivelocity = p5
>>> > iphase = p7
>>> > ipan = p6
>>> > idepth = p8
>>> > iheight = p9
>>> > ipcs = p10
>>> > ihomogeneity = p11
>>> > iattack = .005
>>> > isustain = p3
>>> > irelease = .3
>>> > p3 = iattack + isustain + irelease
>>> > iHz = cpsmidinn(ikey)
>>> > kHz = k(iHz)
>>> > iamplitude = ampdb(ivelocity)
>>> > aenvelope transeg 1.0, 20.0, -10.0, 0.05
>>> > apluck pluck 1, kHz, iHz, 0, 1
>>> > aharp poscil 1, kHz, gi_Harptable
>>> > aharp2 balance apluck, aharp
>>> > asignal = (apluck + aharp2) * iamplitude * aenvelope * 10
>>> > adeclick linsegr 0, iattack, 1, isustain, 1, irelease, 0
>>> > kgain = ampdb(gk_Harpsichord_level)
>>> > asignal = asignal * adeclick * kgain
>>> > aoutleft, aoutright pan2 asignal, ipan
>>> > chnmix aoutleft, "out_left"
>>> > chnmix aoutright, "out_right"
>>> > prints "instr %4d t %9.4f d %9.4f k %9.4f v %9.4f p %9.4f\n", p1, p2,
>>> > p3, p4, p5, p7
>>> > endin
>>> >
>>> >
>>> >
>>> >
>>> > -----------------------------------------------------
>>> > Michael Gogins
>>> > Irreducible Productions
>>> > http://michaelgogins.tumblr.com
>>> > Michael dot Gogins at gmail dot com
>>> >
>>> >
>>> > On Mon, Jan 4, 2016 at 7:33 AM, Peter Burgess
>>> >  wrote:
>>> >> Fair play, I'll stick with that then, cheers man!
>>> >>
>>> >> On Mon, Jan 4, 2016 at 12:22 PM, Rory Walsh  wrote:
>>> >>> No. Afaik using globals init-ed in instr0 is the only way to achieve
>>> >>> this.
>>> >>>
>>> >>> On 4 January 2016 at 12:04, Peter Burgess
>>> >>> 
>>> >>> wrote:
>>> >>>>
>>> >>>> Hi again. Is there an opcode similar to init that initialised a value
>>> >>>> only at the very start of the performance, ie, not every time the
>>> >>>> instrument is called. I know this can be done with global variables
>>> >>>> outside of the instrument definitions, but in some situations it
>>> >>>> would
>>> >>>> be much neater
>>> >>>> to just include certain global variable definitions within an
>>> >>>> instrument definition.
>>> >>>>
>>> >>>> Pete
>>> >>>>
>>> >>>> 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
>>>
>>> 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