Csound Csound-dev Csound-tekno Search About

[Cs-dev] csound5 and skip initialization

Date2005-03-26 21:22
FromIain Duncan
Subject[Cs-dev] csound5 and skip initialization
One area where csound could really still catch up things like PD is in 
controlling singleton instruments, though this has improved considerably 
in the last while. John mentioned a while back that really, ALL opcodes 
should have the option of *skip initialization* so that if you used 
negative and fractional p1s, you could force only one instance of an 
instrument to be allowed, and any subsequent calls could inherit the 
previous state of opcodes. This would make a lot of ugly hackery I've 
done for my monosynths and live mixer unnecessary.

Are we aiming to make that the case? I think it would be very good. 
What's the story with UDO's? Is it easy to make them skip initialization?

Secondly, is there some way we could allow something similar for simple 
variables without resorting to globals and thus namespace confusion? Ie 
would it be possible to have something like:

k_my_counter	init	1.000	
k_my_counter	=	k_my_counter + 0.001

where on an inherited pass, k_my_counter did NOT get reinited. I guess 
maybe what I mean is, could the init stage just be totally skipped? I 
can think of hackish ways to force this, but I mean elegantly? Something 
like:

if ( itie ) igoto NoInitPass
	k_my_counter init 1.00
	... < all other init stuff here > ...
NoInitPass:

k_my_counter = k_my_counter + 0.001


Would this work or can it be made to do so? I think this would be 
extremely useful in many instances of live sensing and control. Also, is 
there any way we can make an opcode that turns off *other* instruments? 
It could simply turn off either the most recent or oldest instance of 
the given instrument number. So far I have again resorted to global 
flags to accomplish that, but if we had both of the above features, a 
lot of possibilities in real time control would open up.

Thanks for listening
Iain




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-26 22:04
FromIstvan Varga
SubjectRe: [Cs-dev] csound5 and skip initialization
Iain Duncan wrote:

> where on an inherited pass, k_my_counter did NOT get reinited. I guess 
> maybe what I mean is, could the init stage just be totally skipped? I 
> can think of hackish ways to force this, but I mean elegantly? Something 
> like:
> 
> if ( itie ) igoto NoInitPass
>     k_my_counter init 1.00
>     ... < all other init stuff here > ...
> NoInitPass:
> 
> k_my_counter = k_my_counter + 0.001

For tied notes, you can use the tigoto opcode.

> Would this work or can it be made to do so? I think this would be 
> extremely useful in many instances of live sensing and control. Also, is 
> there any way we can make an opcode that turns off *other* instruments? 

Yes, although it may not always be obvious which instance is to be
turned off.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-26 22:17
FromIain Duncan
SubjectRe: [Cs-dev] csound5 and skip initialization
>> where on an inherited pass, k_my_counter did NOT get reinited. I guess 
>> maybe what I mean is, could the init stage just be totally skipped? I 
>> can think of hackish ways to force this, but I mean elegantly? 
>> Something like:
>>
>> if ( itie ) igoto NoInitPass
>>     k_my_counter init 1.00
>>     ... < all other init stuff here > ...
>> NoInitPass:
>>
>> k_my_counter = k_my_counter + 0.001
> 
> 
> For tied notes, you can use the tigoto opcode.

Ok, I will experiment with this and report on how it goes.

>> Would this work or can it be made to do so? I think this would be 
>> extremely useful in many instances of live sensing and control. Also, 
>> is there any way we can make an opcode that turns off *other* 
>> instruments? 
> 
> Yes, although it may not always be obvious which instance is to be
> turned off.

What if the way to do so was to use event with duration 0? Because then 
one could use the fractional p1 system to specify instance. What effect 
does a duration 0 currently have? Or could there be a new event type for 
killing instances that also used the fractional p1 system? I suppose 
this would be greatly improved by having some opcode that allows one to 
interogate csound for how many instances of a given instrument are 
currently active ...

Thanks
Iain


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-26 23:22
Frommatt
SubjectRe: [Cs-dev] csound5 and skip initialization
> considerably in the last while. John mentioned a while back that 
> really, ALL opcodes should have the option of *skip initialization* so 
> that if you used negative and fractional p1s, you could force only one 
> instance of an instrument to be allowed, and any subsequent calls 
> could

but isnt that how it is supposed to work anyway? what really happens?
>

> there any way we can make an opcode that turns off *other* 
> instruments? It could simply turn off either the most recent or oldest 
> instance of the given instrument number.

i thought there was one, but couldnt recently find it.  although 
sending an
  event "i" with a 0 duration works for turning off an instrument with 
-p3/ ihold

here is some code i use to assign a note to a key on the keyboard, i use
fractional instrument numbers and store the key state in a function.  so
each keypress turns on or off the note -- i would think you could use 
the same technique
to send -p1 or change global params or something?  maybe im not 
following why
skip initialization is so important... -m


   instr 1
asig oscili .1*0dbfs, p4, 1
out asig
         endin



; this instrument triggers a new note for every keyboard keystroke
instr 3

   key sensekey ; returns -1 if no key was pressed

   if key != -1 then
         printks "%c%n", 0, key ;display key pressed

         kndx    = key - 32 ; subtract our lowest possible ascii key

         konoff table kndx, 10 ; lookup in table if currently playing 
note
         konoff = (konoff == 0 ? -1 : 0) ; toggle on/off

         ; spawn the event - making the pitch (p4) directly related to 
the
         ; inkey. would be better to have a table lookup for pitch so you
         ; could map ascii keys to ascend L->R like to a piano 
keyboard...

         event   "i", 1 + .001*kndx, 0, konoff, key*20

         tablew konoff, kndx, 10 ; write current on/off to the table
   endif

endin


; sco
f1 0 512 10 1
f10 0 256 7 0 256 0 ; initialize to all-off
i3 0 1000

Date2005-03-27 00:28
FromIain Duncan
SubjectRe: [Cs-dev] csound5 and skip initialization
> i thought there was one, but couldnt recently find it.  although sending an
>  event "i" with a 0 duration works for turning off an instrument with 
> -p3/ ihold

Turnoff only turns itself off. Skip initialization is supposed to be 
available for all opocdes, but isn't, we have many opcodes right now 
without that option. So a legato note or ongoing process that needs to 
inherit any ongoing vectors needs to be able to skip the initialization 
of any opcode and successfully inherit the previous state.

> here is some code i use to assign a note to a key on the keyboard, i use
> fractional instrument numbers and store the key state in a function.  so
> each keypress turns on or off the note -- i would think you could use 
> the same technique
> to send -p1 or change global params or something?  maybe im not 
> following why
> skip initialization is so important... -m

Yes you can certainly do it with globals, but that's what I'm hoping we 
can avoid. Ideally we could use subsequent calls with -p1 as a way to 
send new messages to a singelton instance without changing anything we 
don't want changed. This is already possible, but the price is some 
pretty unreadable instrument coding if you are using any opcodes that 
currently don't support skip initialization. This is important because 
both orc and score can easily send messages with pfields in much cleaner 
ways than with global flags and triggers. If orchestra control of the 
score placement is also fixed ( ie being able to rewind, advance, etc ) 
we will have a fantastic combination.

Iain


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-27 10:17
Fromjpff@codemist.co.uk
SubjectRe: [Cs-dev] csound5 and skip initialization
re skipping initialisation, I had a trawl through some months ago and
included a lot of initialisation skipping, but as always one misses
things -- the skip in soundin/diskin was one which we need for a
project here -- so if anyone identifies any more cases then lets have
them listed, and they can be fixed in an idle moment like over
breakfast

==John ffitch


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-27 10:42
FromIain Duncan
SubjectRe: [Cs-dev] csound5 and skip initialization
Great, thanks John. I didn't know you had got most of them. I will try 
recoding some of my ugly code over the next few months to take advantage 
of csound5 and report anything that looks like it has been missed.

Iain

jpff@codemist.co.uk wrote:
> re skipping initialisation, I had a trawl through some months ago and
> included a lot of initialisation skipping, but as always one misses
> things -- the skip in soundin/diskin was one which we need for a
> project here -- so if anyone identifies any more cases then lets have
> them listed, and they can be fixed in an idle moment like over
> breakfast
> 
> ==John ffitch
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-27 12:45
FromIstvan Varga
SubjectRe: [Cs-dev] csound5 and skip initialization
Iain Duncan wrote:

> Turnoff only turns itself off.

I think I can add a new opcode, something like this (suggestions
on a better name are welcome):

     turnoff2 kinsno, kinstance, krelease

kinsno: instrument number, can be fractional. If zero or negative,
   no instrument is turned off, allowing kinsno to be used as a trigger.

kinstance: instance of instrument to be turned off. 0: all, 1: oldest,
   2: newest, 3: all indefinitely playing, 4: oldest indef, 5: newest indef
   (1, 2, 4, and 5 may not always work correctly).

krelease: 0: turn off immediately without release, 1: allow release.

 > Skip initialization is supposed to be available for all opocdes,
 > but isn't, we have many opcodes right now without that option.
 > So a legato note or ongoing process that needs to inherit any
 > ongoing vectors needs to be able to skip the initialization
 > of any opcode and successfully inherit the previous state.

But you can just skip a block of opcodes with tigoto.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-27 15:05
From"Richard Boulanger"
SubjectRe: [Cs-dev] csound5 and skip initialization
Istvan,

This would be a very useful opcode.  Please add it.

Dr. B.

on 3/27/05 6:45 AM, Istvan Varga at istvan_v@fibermail.hu wrote:

> Iain Duncan wrote:
> 
>> Turnoff only turns itself off.
> 
> I think I can add a new opcode, something like this (suggestions
> on a better name are welcome):
> 
>    turnoff2 kinsno, kinstance, krelease
> 
> kinsno: instrument number, can be fractional. If zero or negative,
>  no instrument is turned off, allowing kinsno to be used as a trigger.
> 
> kinstance: instance of instrument to be turned off. 0: all, 1: oldest,
>  2: newest, 3: all indefinitely playing, 4: oldest indef, 5: newest indef
>  (1, 2, 4, and 5 may not always work correctly).
> 
> krelease: 0: turn off immediately without release, 1: allow release.
> 
>> Skip initialization is supposed to be available for all opocdes,
>> but isn't, we have many opcodes right now without that option.
>> So a legato note or ongoing process that needs to inherit any
>> ongoing vectors needs to be able to skip the initialization
>> of any opcode and successfully inherit the previous state.
> 
> But you can just skip a block of opcodes with tigoto.
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> 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@csounds.com  or  rboulanger@berklee.edu
 +  WebPage: http://csounds.com/boulanger/
________________________________________________________________________
 +  Almost Everything Csound @ http://csounds.com/
 +  The Csound Catalog with Audio @ http://csounds.com/catalog/
 +  The Csound Book @ http://csounds.com/book/
 +  The Csound Magazine @ http://csounds.com/ezine/
 +  CsoundForums @ http://csounds.com/phpBB2/
________________________________________________________________________



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-27 18:30
FromIstvan Varga
SubjectRe: [Cs-dev] csound5 and skip initialization
Richard Boulanger wrote:

> This would be a very useful opcode.  Please add it.

Already added (not fully tested yet):

     turnoff2 kinsno, kmode, krelease

kinsno: instrument to be turned off (can be fractional)
     if zero or negative, no instrument is turned off

kmode: sum of the following values:
     0, 1, or 2: turn off all instances (0), oldest only (1),
                 or newest only (2)
     4:          only turn off notes with exactly matching (fractional)
                 instrument number, rather than ignoring fractional part
     8:          only turn off notes with indefinite duration (p3 < 0 or MIDI)

krelease: if non-zero, the turned off instances are allowed to release,
     otherwise are deactivated immediately (possibly resulting in clicks)


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-27 22:41
FromIain Duncan
SubjectRe: [Cs-dev] csound5 and skip initialization
> I think I can add a new opcode, something like this (suggestions
> on a better name are welcome):
> 
>     turnoff2 kinsno, kinstance, krelease
> 
> kinsno: instrument number, can be fractional. If zero or negative,
>   no instrument is turned off, allowing kinsno to be used as a trigger.

So that would allow one to correctly choose which instance in a 
fractional p1 scenario correct?

> kinstance: instance of instrument to be turned off. 0: all, 1: oldest,
>   2: newest, 3: all indefinitely playing, 4: oldest indef, 5: newest indef
>   (1, 2, 4, and 5 may not always work correctly).
> 
> krelease: 0: turn off immediately without release, 1: allow release.

That sounds like it would be very useful then.

>  > Skip initialization is supposed to be available for all opocdes,
>  > but isn't, we have many opcodes right now without that option.
>  > So a legato note or ongoing process that needs to inherit any
>  > ongoing vectors needs to be able to skip the initialization
>  > of any opcode and successfully inherit the previous state.
> 
> But you can just skip a block of opcodes with tigoto.

Will that work, just skipping past the initialization of anything? 
Doesn't matter if the opcode has been designed to allow it? I'll have to 
try it out. = )


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-27 22:42
FromIain Duncan
SubjectRe: [Cs-dev] csound5 and skip initialization
Very nice! Thanks again Istvan.

Iain

Istvan Varga wrote:
> Richard Boulanger wrote:
> 
>> This would be a very useful opcode.  Please add it.
> 
> 
> Already added (not fully tested yet):
> 
>     turnoff2 kinsno, kmode, krelease
> 
> kinsno: instrument to be turned off (can be fractional)
>     if zero or negative, no instrument is turned off
> 
> kmode: sum of the following values:
>     0, 1, or 2: turn off all instances (0), oldest only (1),
>                 or newest only (2)
>     4:          only turn off notes with exactly matching (fractional)
>                 instrument number, rather than ignoring fractional part
>     8:          only turn off notes with indefinite duration (p3 < 0 or 
> MIDI)
> 
> krelease: if non-zero, the turned off instances are allowed to release,
>     otherwise are deactivated immediately (possibly resulting in clicks)
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-27 22:49
FromIstvan Varga
SubjectRe: [Cs-dev] csound5 and skip initialization
Iain Duncan wrote:

> That sounds like it would be very useful then.

turnoff2 is already in the CVS, you can test if the opcode
works correctly and does what you want. Here is the updated
usage information (not really a manual yet):

     turnoff2 kinsno, kmode, krelease

kinsno: instrument to be turned off (can be fractional)
     if zero or negative, no instrument is turned off

kmode: sum of the following values:
     0, 1, or 2: turn off all instances (0), oldest only (1),
                 or newest only (2)
     4:          only turn off notes with exactly matching (fractional)
                 instrument number, rather than ignoring fractional part
     8:          only turn off notes with indefinite duration (p3 < 0 or MIDI)

krelease: if non-zero, the turned off instances are allowed to release,
     otherwise are deactivated immediately (possibly resulting in clicks)

> Will that work, just skipping past the initialization of anything? 
> Doesn't matter if the opcode has been designed to allow it? I'll have to 
> try it out. = )

In the case of tied notes (where the new note just continues the old
one without turning that off first), yes. That's why I only recommended
tigoto, and not igoto (which would also jump in non-tied notes).


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-29 03:12
FromMatt Ingalls
SubjectRe: [Cs-dev] csound5 and skip initialization
could you name it something else?

turnoffinst

or something?

On Mar 27, 2005, at 1:49 PM, Istvan Varga wrote:

> Iain Duncan wrote:
>
>> That sounds like it would be very useful then.
>
> turnoff2 is already in the CVS, you can test if the opcode
> works correctly and does what you want. Here is the updated
> usage information (not really a manual yet):
>
>     turnoff2 kinsno, kmode, krelease
>
> kinsno: instrument to be turned off (can be fractional)
>     if zero or negative, no instrument is turned off
>
> kmode: sum of the following values:
>     0, 1, or 2: turn off all instances (0), oldest only (1),
>                 or newest only (2)
>     4:          only turn off notes with exactly matching (fractional)
>                 instrument number, rather than ignoring fractional part
>     8:          only turn off notes with indefinite duration (p3 < 0 
> or MIDI)
>
> krelease: if non-zero, the turned off instances are allowed to release,
>     otherwise are deactivated immediately (possibly resulting in 
> clicks)
>
>> Will that work, just skipping past the initialization of anything? 
>> Doesn't matter if the opcode has been designed to allow it? I'll have 
>> to try it out. = )
>
> In the case of tied notes (where the new note just continues the old
> one without turning that off first), yes. That's why I only recommended
> tigoto, and not igoto (which would also jump in non-tied notes).
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real 
> users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net