Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] sensekey opcode modification request

Date2006-06-08 18:18
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  

Date2006-06-08 18:21
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  

Date2006-06-08 18:52
From"Dr. Richard Boulanger"
Subject[Cs-dev] sensekey opcode modification request
Dear Developers,

I am trying to make a simple ascii keyboard controller using sensekey.

The manual states:

Description

Returns the ASCII code of a key that has been pressed, or -1 if no  
key has been pressed.

Syntax

kres sensekey


I think that Matt Ingalls had posted the example orchestra below with  
his MacCsound distrobution.
It works quite well, and is quite brilliant, and teaches some great  
lessons about tablew, but, to the novice, it seems quite involved.

What I was wondering was if you could possibly modify the sensekey  
opcode (or make a new one) so that it returns the ascii key value and  
a 1 when the key
is depressed and the ascii key value and a 0 when the key is released.

NEW SYNTAX

kkey_number, kdown_or_up  sensekey

Thanks for your consideration and possible modification

Dr. B.



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








_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 19:15
Frommatt
SubjectRe: [Cs-dev] sensekey opcode modification request
i have brought this up before on this list.

this would require a change in the API to get it to work with
GUI-hosts [ like MacCsound ]

i could see making values < -1 be an "offkey",
returning the negative value of the ascii key released.

Or,
if you just want to leave it to front-ends, i could reserve
a control channel in MacCsound to broadcast keydown and
keyup messages:

	kdown invalue "_Keydown"
	kup	invalue "_Keyup"

which would have the added benefit of being able to control
other GUI objects even when not running a csound process.


-m

On Jun 8, 2006, at 10:52 AM, Dr. Richard Boulanger wrote:

> Dear Developers,
>
> I am trying to make a simple ascii keyboard controller using sensekey.
>
> The manual states:
>
> Description
>
> Returns the ASCII code of a key that has been pressed, or -1 if no
> key has been pressed.
>
> Syntax
>
> kres sensekey
>
>
> I think that Matt Ingalls had posted the example orchestra below with
> his MacCsound distrobution.
> It works quite well, and is quite brilliant, and teaches some great
> lessons about tablew, but, to the novice, it seems quite involved.
>
> What I was wondering was if you could possibly modify the sensekey
> opcode (or make a new one) so that it returns the ascii key value and
> a 1 when the key
> is depressed and the ascii key value and a 0 when the key is released.
>
> NEW SYNTAX
>
> kkey_number, kdown_or_up  sensekey
>
> Thanks for your consideration and possible modification
>
> Dr. B.
>
> 
> 
> 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
> 
>
> 
>
>
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

-m@
________________________
           matt  ingalls
http://sfsound.org/matt.html



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 20:14
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
The reason for my request is to use the ASCII keyboard as a  
substitute for a MIDI keyboard
and the Mouse or Trackpad as a substitute for a MIDI continuous  
controller(s)

So...

I like both of these options...

In MacCsound, it would be great to have a GUI object for this  
purpose, but... it would also be very helpful
to keep the GUI (FLTK or otherwise) out of it and just get the data  
we need from the sensekey opcode.

Istvan has suggested MIDI and that works (of course) but... as I  
stated above, I am trying to turn the ASCII keyboard into
a substitute for a MIDI keyboard.

Maybe the negative ascii values for key up would be good and the  
positive ascii values for key down

I wonder what you get back from the ascii keyboard?

Dr. B.


On Jun 8, 2006, at 2:15 PM, matt wrote:

> i have brought this up before on this list.
>
> this would require a change in the API to get it to work with
> GUI-hosts [ like MacCsound ]
>
> i could see making values < -1 be an "offkey",
> returning the negative value of the ascii key released.
>
> Or,
> if you just want to leave it to front-ends, i could reserve
> a control channel in MacCsound to broadcast keydown and
> keyup messages:
>
> 	kdown invalue "_Keydown"
> 	kup	invalue "_Keyup"
>
> which would have the added benefit of being able to control
> other GUI objects even when not running a csound process.
>
>
> -m
>
> On Jun 8, 2006, at 10:52 AM, Dr. Richard Boulanger wrote:
>
>> Dear Developers,
>>
>> I am trying to make a simple ascii keyboard controller using  
>> sensekey.
>>
>> The manual states:
>>
>> Description
>>
>> Returns the ASCII code of a key that has been pressed, or -1 if no
>> key has been pressed.
>>
>> Syntax
>>
>> kres sensekey
>>
>>
>> I think that Matt Ingalls had posted the example orchestra below with
>> his MacCsound distrobution.
>> It works quite well, and is quite brilliant, and teaches some great
>> lessons about tablew, but, to the novice, it seems quite involved.
>>
>> What I was wondering was if you could possibly modify the sensekey
>> opcode (or make a new one) so that it returns the ascii key value and
>> a 1 when the key
>> is depressed and the ascii key value and a 0 when the key is  
>> released.
>>
>> NEW SYNTAX
>>
>> kkey_number, kdown_or_up  sensekey
>>
>> Thanks for your consideration and possible modification
>>
>> Dr. B.
>>
>> 
>> 
>> 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
>> 
>>
>> 
>>
>>
>>
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
> -m@
> ________________________
>            matt  ingalls
> http://sfsound.org/matt.html
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 20:14
Frommatt ingalls
SubjectRe: [Cs-dev] sensekey opcode modification request
that's a good idea too.  or i can just implement Rick's new opcode
with the same approach.

if this is in conflict with other platforms and/or something that would
never possibly be incorporated into the canonical sources, i would
just assume use a reserved control channel name rather than
create a new platform-specific ocpode.  -- what do you want Rick?

-m

On Jun 8, 2006, at 10:21 AM, Istvan Varga wrote:

> And, of course, the host can also just replace the sensekey
> opcode (with csoundAppendOpcode()) and implement the slightly
> modified behavior described below.
>
> On Thursday 08 June 2006 20:15, matt wrote:
>
>> i could see making values < -1 be an "offkey",
>> returning the negative value of the ascii key released.
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 20:48
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
I would not want a platform-specific opcode.  In fact, I am using  
MacCsound to prototype
orchestras and demos for a Linux system - (Thanks so much for  
MacCsound5!!! Just the very very
minute I needed it.  You are amazing.)

I will be happy to tell you more about this little linux Csound  
system I am working on (with Barry Vercoe)
once I make sure with him that I can tell you about it.

Needless to say....  sensekey, and xyin would be nice to have working  
in a full-featured and straightforward way
(as they do in Max/MSP and PD for example)

Wishing you and all the developers all the best.

Rick

On Jun 8, 2006, at 3:14 PM, matt ingalls wrote:

> that's a good idea too.  or i can just implement Rick's new opcode
> with the same approach.
>
> if this is in conflict with other platforms and/or something that  
> would
> never possibly be incorporated into the canonical sources, i would
> just assume use a reserved control channel name rather than
> create a new platform-specific ocpode.  -- what do you want Rick?
>
> -m
>
> On Jun 8, 2006, at 10:21 AM, Istvan Varga wrote:
>
>> And, of course, the host can also just replace the sensekey
>> opcode (with csoundAppendOpcode()) and implement the slightly
>> modified behavior described below.
>>
>> On Thursday 08 June 2006 20:15, matt wrote:
>>
>>> i could see making values < -1 be an "offkey",
>>> returning the negative value of the ascii key released.
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 20:51
Frommatt ingalls
SubjectRe: [Cs-dev] sensekey opcode modification request
i am not suggesting a GUI object, just a reserved control channel name.
the keyboard would still be used the same is it currently is.
so the options are:

	+ implement your opcode suggestion as a plug-in,
		overriding the current 'sensekey' opcode
	+ implement your opcode as a plug-in, but with a new name.
	+ change/override the 'sensekey' opcode to output a negative
		ascii value on keyup
	+ use 'invalue' opcode to receive keydown/keyup values
		instead of 'sensekey'

-m

On Jun 8, 2006, at 12:14 PM, Dr. Richard Boulanger wrote:

> The reason for my request is to use the ASCII keyboard as a
> substitute for a MIDI keyboard
> and the Mouse or Trackpad as a substitute for a MIDI continuous
> controller(s)
>
> So...
>
> I like both of these options...
>
> In MacCsound, it would be great to have a GUI object for this
> purpose, but... it would also be very helpful
> to keep the GUI (FLTK or otherwise) out of it and just get the data
> we need from the sensekey opcode.
>
> Istvan has suggested MIDI and that works (of course) but... as I
> stated above, I am trying to turn the ASCII keyboard into
> a substitute for a MIDI keyboard.
>
> Maybe the negative ascii values for key up would be good and the
> positive ascii values for key down
>
> I wonder what you get back from the ascii keyboard?
>
> Dr. B.
>
>
> On Jun 8, 2006, at 2:15 PM, matt wrote:
>
>> i have brought this up before on this list.
>>
>> this would require a change in the API to get it to work with
>> GUI-hosts [ like MacCsound ]
>>
>> i could see making values < -1 be an "offkey",
>> returning the negative value of the ascii key released.
>>
>> Or,
>> if you just want to leave it to front-ends, i could reserve
>> a control channel in MacCsound to broadcast keydown and
>> keyup messages:
>>
>> 	kdown invalue "_Keydown"
>> 	kup	invalue "_Keyup"
>>
>> which would have the added benefit of being able to control
>> other GUI objects even when not running a csound process.
>>
>>
>> -m
>>
>> On Jun 8, 2006, at 10:52 AM, Dr. Richard Boulanger wrote:
>>
>>> Dear Developers,
>>>
>>> I am trying to make a simple ascii keyboard controller using
>>> sensekey.
>>>
>>> The manual states:
>>>
>>> Description
>>>
>>> Returns the ASCII code of a key that has been pressed, or -1 if no
>>> key has been pressed.
>>>
>>> Syntax
>>>
>>> kres sensekey
>>>
>>>
>>> I think that Matt Ingalls had posted the example orchestra below  
>>> with
>>> his MacCsound distrobution.
>>> It works quite well, and is quite brilliant, and teaches some great
>>> lessons about tablew, but, to the novice, it seems quite involved.
>>>
>>> What I was wondering was if you could possibly modify the sensekey
>>> opcode (or make a new one) so that it returns the ascii key value  
>>> and
>>> a 1 when the key
>>> is depressed and the ascii key value and a 0 when the key is
>>> released.
>>>
>>> NEW SYNTAX
>>>
>>> kkey_number, kdown_or_up  sensekey
>>>
>>> Thanks for your consideration and possible modification
>>>
>>> Dr. B.
>>>
>>> 
>>> 
>>> 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
>>> 
>>>
>>> 
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>> -m@
>> ________________________
>>            matt  ingalls
>> http://sfsound.org/matt.html
>>
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 20:56
Frommatt ingalls
SubjectRe: [Cs-dev] sensekey opcode modification request
i think you are SOL.

the way i understand it, the platform-independent
getchar() or whatever it is called, just returns the last ascii value  
that
was pressed.

to get keyup values and to directly respond to key presses you have
to do platform specific stuff, which makes sense to keep out of csound
and put in host code.  for instance, in MacCsound
my window object receives a keydown or keyup message from the OS,
but only if the window is in the foreground and user isn't editing text
somewhere, or doing a shortkey command, etc..

do you mean the max/msp/pd csound~ object or what?

-m

On Jun 8, 2006, at 12:48 PM, Dr. Richard Boulanger wrote:

> I would not want a platform-specific opcode.  In fact, I am using
> MacCsound to prototype
> orchestras and demos for a Linux system - (Thanks so much for
> MacCsound5!!! Just the very very
> minute I needed it.  You are amazing.)
>
> I will be happy to tell you more about this little linux Csound
> system I am working on (with Barry Vercoe)
> once I make sure with him that I can tell you about it.
>
> Needless to say....  sensekey, and xyin would be nice to have working
> in a full-featured and straightforward way
> (as they do in Max/MSP and PD for example)
>
> Wishing you and all the developers all the best.
>
> Rick
>
> On Jun 8, 2006, at 3:14 PM, matt ingalls wrote:
>
>> that's a good idea too.  or i can just implement Rick's new opcode
>> with the same approach.
>>
>> if this is in conflict with other platforms and/or something that
>> would
>> never possibly be incorporated into the canonical sources, i would
>> just assume use a reserved control channel name rather than
>> create a new platform-specific ocpode.  -- what do you want Rick?
>>
>> -m
>>
>> On Jun 8, 2006, at 10:21 AM, Istvan Varga wrote:
>>
>>> And, of course, the host can also just replace the sensekey
>>> opcode (with csoundAppendOpcode()) and implement the slightly
>>> modified behavior described below.
>>>
>>> On Thursday 08 June 2006 20:15, matt wrote:
>>>
>>>> i could see making values < -1 be an "offkey",
>>>> returning the negative value of the ascii key released.
>>>
>>>
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 21:05
FromRory Walsh
SubjectRe: [Cs-dev] sensekey opcode modification request
> do you mean the max/msp/pd csound~ object or what?

I think Richard is talking about those actual systems, Pd and Max that 
is. They allow this, they must have some #ifdef's for different OS stuff 
that helps to build across platforms, couldn't it be done like that?


Rory.

> -m
> 
> On Jun 8, 2006, at 12:48 PM, Dr. Richard Boulanger wrote:
> 
>> I would not want a platform-specific opcode.  In fact, I am using
>> MacCsound to prototype
>> orchestras and demos for a Linux system - (Thanks so much for
>> MacCsound5!!! Just the very very
>> minute I needed it.  You are amazing.)
>>
>> I will be happy to tell you more about this little linux Csound
>> system I am working on (with Barry Vercoe)
>> once I make sure with him that I can tell you about it.
>>
>> Needless to say....  sensekey, and xyin would be nice to have working
>> in a full-featured and straightforward way
>> (as they do in Max/MSP and PD for example)
>>
>> Wishing you and all the developers all the best.
>>
>> Rick
>>
>> On Jun 8, 2006, at 3:14 PM, matt ingalls wrote:
>>
>>> that's a good idea too.  or i can just implement Rick's new opcode
>>> with the same approach.
>>>
>>> if this is in conflict with other platforms and/or something that
>>> would
>>> never possibly be incorporated into the canonical sources, i would
>>> just assume use a reserved control channel name rather than
>>> create a new platform-specific ocpode.  -- what do you want Rick?
>>>
>>> -m
>>>
>>> On Jun 8, 2006, at 10:21 AM, Istvan Varga wrote:
>>>
>>>> And, of course, the host can also just replace the sensekey
>>>> opcode (with csoundAppendOpcode()) and implement the slightly
>>>> modified behavior described below.
>>>>
>>>> On Thursday 08 June 2006 20:15, matt wrote:
>>>>
>>>>> i could see making values < -1 be an "offkey",
>>>>> returning the negative value of the ascii key released.
>>>>
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
> 
> 
> 
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 


_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 21:56
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  

Date2006-06-08 22:18
Frommatt ingalls
SubjectRe: [Cs-dev] sensekey opcode modification request
internally in the csound sources?

-- you might be able to call system-specific low-level routines to poll
the state of the keyboard, but i don't think it is ideal, especially  
with
a host application.
what happens if the user is entering text in an edit box or something
on the host app?  you then are going to have to define a way for hosts
to turn this on or off and if you are going to do that, you might as
well just have them send the keyboard info themselves through
the API.

without changing any csound code or breaking any existing orcs
we could just define "keyoff" messages to be asciiDownVal+128,
assuming you are not using extended ascii.
This is probably better than -asciiVal - as it looks like the inChar  
is cast
to unsigned, so a negative input would be converted to
  256-asciiDownVal or something like that...

-m

On Jun 8, 2006, at 1:05 PM, Rory Walsh wrote:

>> do you mean the max/msp/pd csound~ object or what?
>
> I think Richard is talking about those actual systems, Pd and Max that
> is. They allow this, they must have some #ifdef's for different OS  
> stuff
> that helps to build across platforms, couldn't it be done like that?
>
>
> Rory.
>
>> -m
>>
>> On Jun 8, 2006, at 12:48 PM, Dr. Richard Boulanger wrote:
>>
>>> I would not want a platform-specific opcode.  In fact, I am using
>>> MacCsound to prototype
>>> orchestras and demos for a Linux system - (Thanks so much for
>>> MacCsound5!!! Just the very very
>>> minute I needed it.  You are amazing.)
>>>
>>> I will be happy to tell you more about this little linux Csound
>>> system I am working on (with Barry Vercoe)
>>> once I make sure with him that I can tell you about it.
>>>
>>> Needless to say....  sensekey, and xyin would be nice to have  
>>> working
>>> in a full-featured and straightforward way
>>> (as they do in Max/MSP and PD for example)
>>>
>>> Wishing you and all the developers all the best.
>>>
>>> Rick
>>>
>>> On Jun 8, 2006, at 3:14 PM, matt ingalls wrote:
>>>
>>>> that's a good idea too.  or i can just implement Rick's new opcode
>>>> with the same approach.
>>>>
>>>> if this is in conflict with other platforms and/or something that
>>>> would
>>>> never possibly be incorporated into the canonical sources, i would
>>>> just assume use a reserved control channel name rather than
>>>> create a new platform-specific ocpode.  -- what do you want Rick?
>>>>
>>>> -m
>>>>
>>>> On Jun 8, 2006, at 10:21 AM, Istvan Varga wrote:
>>>>
>>>>> And, of course, the host can also just replace the sensekey
>>>>> opcode (with csoundAppendOpcode()) and implement the slightly
>>>>> modified behavior described below.
>>>>>
>>>>> On Thursday 08 June 2006 20:15, matt wrote:
>>>>>
>>>>>> i could see making values < -1 be an "offkey",
>>>>>> returning the negative value of the ascii key released.
>>>>>
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>>
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 22:34
FromRory Walsh
SubjectRe: [Cs-dev] sensekey opcode modification request
Your right, that's a good point. That could have led to some very 
interesting and unexpected results!

Rory.


matt ingalls wrote:
> internally in the csound sources?
> 
> -- you might be able to call system-specific low-level routines to poll
> the state of the keyboard, but i don't think it is ideal, especially  
> with
> a host application.
> what happens if the user is entering text in an edit box or something
> on the host app?  you then are going to have to define a way for hosts
> to turn this on or off and if you are going to do that, you might as
> well just have them send the keyboard info themselves through
> the API.
> 
> without changing any csound code or breaking any existing orcs
> we could just define "keyoff" messages to be asciiDownVal+128,
> assuming you are not using extended ascii.
> This is probably better than -asciiVal - as it looks like the inChar  
> is cast
> to unsigned, so a negative input would be converted to
>   256-asciiDownVal or something like that...
> 
> -m
> 
> On Jun 8, 2006, at 1:05 PM, Rory Walsh wrote:
> 
>>> do you mean the max/msp/pd csound~ object or what?
>> I think Richard is talking about those actual systems, Pd and Max that
>> is. They allow this, they must have some #ifdef's for different OS  
>> stuff
>> that helps to build across platforms, couldn't it be done like that?
>>
>>
>> Rory.
>>
>>> -m
>>>
>>> On Jun 8, 2006, at 12:48 PM, Dr. Richard Boulanger wrote:
>>>
>>>> I would not want a platform-specific opcode.  In fact, I am using
>>>> MacCsound to prototype
>>>> orchestras and demos for a Linux system - (Thanks so much for
>>>> MacCsound5!!! Just the very very
>>>> minute I needed it.  You are amazing.)
>>>>
>>>> I will be happy to tell you more about this little linux Csound
>>>> system I am working on (with Barry Vercoe)
>>>> once I make sure with him that I can tell you about it.
>>>>
>>>> Needless to say....  sensekey, and xyin would be nice to have  
>>>> working
>>>> in a full-featured and straightforward way
>>>> (as they do in Max/MSP and PD for example)
>>>>
>>>> Wishing you and all the developers all the best.
>>>>
>>>> Rick
>>>>
>>>> On Jun 8, 2006, at 3:14 PM, matt ingalls wrote:
>>>>
>>>>> that's a good idea too.  or i can just implement Rick's new opcode
>>>>> with the same approach.
>>>>>
>>>>> if this is in conflict with other platforms and/or something that
>>>>> would
>>>>> never possibly be incorporated into the canonical sources, i would
>>>>> just assume use a reserved control channel name rather than
>>>>> create a new platform-specific ocpode.  -- what do you want Rick?
>>>>>
>>>>> -m
>>>>>
>>>>> On Jun 8, 2006, at 10:21 AM, Istvan Varga wrote:
>>>>>
>>>>>> And, of course, the host can also just replace the sensekey
>>>>>> opcode (with csoundAppendOpcode()) and implement the slightly
>>>>>> modified behavior described below.
>>>>>>
>>>>>> On Thursday 08 June 2006 20:15, matt wrote:
>>>>>>
>>>>>>> i could see making values < -1 be an "offkey",
>>>>>>> returning the negative value of the ascii key released.
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
> 
> 
> 
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 


_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-08 22:41
Frommatt ingalls
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  None  
well on 2nd thought, it could break existing orcs if they are just using sensekey as a trigger
and not looking at the actual char returned...

On Jun 8, 2006, at 2:18 PM, matt ingalls wrote:

without changing any csound code or breaking any existing orcs

we could just define "keyoff" messages to be asciiDownVal+128,



Date2006-06-09 12:47
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  

Date2006-06-09 13:25
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  

Date2006-06-09 13:38
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  

Date2006-06-09 13:42
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  None  
I don't want to break existing orcs... but an enhanced opcode would be much more useful.


On Jun 8, 2006, at 5:41 PM, matt ingalls wrote:

well on 2nd thought, it could break existing orcs if they are just using sensekey as a trigger
and not looking at the actual char returned...

On Jun 8, 2006, at 2:18 PM, matt ingalls wrote:

without changing any csound code or breaking any existing orcs
we could just define "keyoff" messages to be asciiDownVal+128,

_______________________________________________
Csound-devel mailing list


Date2006-06-09 13:44
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  

Date2006-06-09 13:56
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
The objects that I and my students use all the time in max/msp are

key, numkey, keyup, modifiers, mousestate, and mousefilter, speedlim,  
itoa, and atoi

they allow us to do all sorts of triggering, playing, controlling,  
filtering, and the building of some great little performance systems.

for the purposes of using just the laptop itself as a virtual  
controller, these are very important tools

Rick


On Jun 8, 2006, at 3:56 PM, matt ingalls wrote:

> i think you are SOL.
>
> the way i understand it, the platform-independent
> getchar() or whatever it is called, just returns the last ascii value
> that
> was pressed.
>
> to get keyup values and to directly respond to key presses you have
> to do platform specific stuff, which makes sense to keep out of csound
> and put in host code.  for instance, in MacCsound
> my window object receives a keydown or keyup message from the OS,
> but only if the window is in the foreground and user isn't editing  
> text
> somewhere, or doing a shortkey command, etc..
>
> do you mean the max/msp/pd csound~ object or what?
>
> -m
>
> On Jun 8, 2006, at 12:48 PM, Dr. Richard Boulanger wrote:
>
>> I would not want a platform-specific opcode.  In fact, I am using
>> MacCsound to prototype
>> orchestras and demos for a Linux system - (Thanks so much for
>> MacCsound5!!! Just the very very
>> minute I needed it.  You are amazing.)
>>
>> I will be happy to tell you more about this little linux Csound
>> system I am working on (with Barry Vercoe)
>> once I make sure with him that I can tell you about it.
>>
>> Needless to say....  sensekey, and xyin would be nice to have working
>> in a full-featured and straightforward way
>> (as they do in Max/MSP and PD for example)
>>
>> Wishing you and all the developers all the best.
>>
>> Rick
>>
>> On Jun 8, 2006, at 3:14 PM, matt ingalls wrote:
>>
>>> that's a good idea too.  or i can just implement Rick's new opcode
>>> with the same approach.
>>>
>>> if this is in conflict with other platforms and/or something that
>>> would
>>> never possibly be incorporated into the canonical sources, i would
>>> just assume use a reserved control channel name rather than
>>> create a new platform-specific ocpode.  -- what do you want Rick?
>>>
>>> -m
>>>
>>> On Jun 8, 2006, at 10:21 AM, Istvan Varga wrote:
>>>
>>>> And, of course, the host can also just replace the sensekey
>>>> opcode (with csoundAppendOpcode()) and implement the slightly
>>>> modified behavior described below.
>>>>
>>>> On Thursday 08 June 2006 20:15, matt wrote:
>>>>
>>>>> i could see making values < -1 be an "offkey",
>>>>> returning the negative value of the ascii key released.
>>>>
>>>>
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-09 13:58
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
When I am building systems using csound~, then I have all this  
functionality, but I would like
to see more of it in Csound itself - so that I could build the  
systems with Csound5 alone.

(on a linux box actually)

On Jun 8, 2006, at 3:56 PM, matt ingalls wrote:

> i think you are SOL.
>
> the way i understand it, the platform-independent
> getchar() or whatever it is called, just returns the last ascii value
> that
> was pressed.
>
> to get keyup values and to directly respond to key presses you have
> to do platform specific stuff, which makes sense to keep out of csound
> and put in host code.  for instance, in MacCsound
> my window object receives a keydown or keyup message from the OS,
> but only if the window is in the foreground and user isn't editing  
> text
> somewhere, or doing a shortkey command, etc..
>
> do you mean the max/msp/pd csound~ object or what?
>
> -m
>
> On Jun 8, 2006, at 12:48 PM, Dr. Richard Boulanger wrote:
>
>> I would not want a platform-specific opcode.  In fact, I am using
>> MacCsound to prototype
>> orchestras and demos for a Linux system - (Thanks so much for
>> MacCsound5!!! Just the very very
>> minute I needed it.  You are amazing.)
>>
>> I will be happy to tell you more about this little linux Csound
>> system I am working on (with Barry Vercoe)
>> once I make sure with him that I can tell you about it.
>>
>> Needless to say....  sensekey, and xyin would be nice to have working
>> in a full-featured and straightforward way
>> (as they do in Max/MSP and PD for example)
>>
>> Wishing you and all the developers all the best.
>>
>> Rick
>>
>> On Jun 8, 2006, at 3:14 PM, matt ingalls wrote:
>>
>>> that's a good idea too.  or i can just implement Rick's new opcode
>>> with the same approach.
>>>
>>> if this is in conflict with other platforms and/or something that
>>> would
>>> never possibly be incorporated into the canonical sources, i would
>>> just assume use a reserved control channel name rather than
>>> create a new platform-specific ocpode.  -- what do you want Rick?
>>>
>>> -m
>>>
>>> On Jun 8, 2006, at 10:21 AM, Istvan Varga wrote:
>>>
>>>> And, of course, the host can also just replace the sensekey
>>>> opcode (with csoundAppendOpcode()) and implement the slightly
>>>> modified behavior described below.
>>>>
>>>> On Thursday 08 June 2006 20:15, matt wrote:
>>>>
>>>>> i could see making values < -1 be an "offkey",
>>>>> returning the negative value of the ascii key released.
>>>>
>>>>
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-09 14:04
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
Matt,

For MacCsound, I think that and extension of invalue would be a nice  
way to go.
I love in and out value.   Such a simple connection to your GUI and  
such a simple
extension of the language to get the GUI to happen.  ALL my students  
just fly
with this possibility especially because the connection and extension  
to their
existing designs are so clear.

Rick

On Jun 8, 2006, at 3:51 PM, matt ingalls wrote:

> i am not suggesting a GUI object, just a reserved control channel  
> name.
> the keyboard would still be used the same is it currently is.
> so the options are:
>
> 	+ implement your opcode suggestion as a plug-in,
> 		overriding the current 'sensekey' opcode
> 	+ implement your opcode as a plug-in, but with a new name.
> 	+ change/override the 'sensekey' opcode to output a negative
> 		ascii value on keyup
> 	+ use 'invalue' opcode to receive keydown/keyup values
> 		instead of 'sensekey'
>
> -m
>
> On Jun 8, 2006, at 12:14 PM, Dr. Richard Boulanger wrote:
>
>> The reason for my request is to use the ASCII keyboard as a
>> substitute for a MIDI keyboard
>> and the Mouse or Trackpad as a substitute for a MIDI continuous
>> controller(s)
>>
>> So...
>>
>> I like both of these options...
>>
>> In MacCsound, it would be great to have a GUI object for this
>> purpose, but... it would also be very helpful
>> to keep the GUI (FLTK or otherwise) out of it and just get the data
>> we need from the sensekey opcode.
>>
>> Istvan has suggested MIDI and that works (of course) but... as I
>> stated above, I am trying to turn the ASCII keyboard into
>> a substitute for a MIDI keyboard.
>>
>> Maybe the negative ascii values for key up would be good and the
>> positive ascii values for key down
>>
>> I wonder what you get back from the ascii keyboard?
>>
>> Dr. B.
>>
>>
>> On Jun 8, 2006, at 2:15 PM, matt wrote:
>>
>>> i have brought this up before on this list.
>>>
>>> this would require a change in the API to get it to work with
>>> GUI-hosts [ like MacCsound ]
>>>
>>> i could see making values < -1 be an "offkey",
>>> returning the negative value of the ascii key released.
>>>
>>> Or,
>>> if you just want to leave it to front-ends, i could reserve
>>> a control channel in MacCsound to broadcast keydown and
>>> keyup messages:
>>>
>>> 	kdown invalue "_Keydown"
>>> 	kup	invalue "_Keyup"
>>>
>>> which would have the added benefit of being able to control
>>> other GUI objects even when not running a csound process.
>>>
>>>
>>> -m
>>>
>>> On Jun 8, 2006, at 10:52 AM, Dr. Richard Boulanger wrote:
>>>
>>>> Dear Developers,
>>>>
>>>> I am trying to make a simple ascii keyboard controller using
>>>> sensekey.
>>>>
>>>> The manual states:
>>>>
>>>> Description
>>>>
>>>> Returns the ASCII code of a key that has been pressed, or -1 if no
>>>> key has been pressed.
>>>>
>>>> Syntax
>>>>
>>>> kres sensekey
>>>>
>>>>
>>>> I think that Matt Ingalls had posted the example orchestra below
>>>> with
>>>> his MacCsound distrobution.
>>>> It works quite well, and is quite brilliant, and teaches some great
>>>> lessons about tablew, but, to the novice, it seems quite involved.
>>>>
>>>> What I was wondering was if you could possibly modify the sensekey
>>>> opcode (or make a new one) so that it returns the ascii key value
>>>> and
>>>> a 1 when the key
>>>> is depressed and the ascii key value and a 0 when the key is
>>>> released.
>>>>
>>>> NEW SYNTAX
>>>>
>>>> kkey_number, kdown_or_up  sensekey
>>>>
>>>> Thanks for your consideration and possible modification
>>>>
>>>> Dr. B.
>>>>
>>>> 
>>>> 
>>>> 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
>>>> 
>>>>
>>>> 
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>> -m@
>>> ________________________
>>>            matt  ingalls
>>> http://sfsound.org/matt.html
>>>
>>>
>>>
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-09 14:07
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
What is SOL?

screaming out loud?

suddenly off line?

I am both!  Of course...

Any way that we can add more features to capture, filter, modify,  
extend, ascii events, and mouse events
in Csound5 would be really great.

Thanks so much to all the developers for your work and thought on  
this subject.
It will end up being used by many many many many children all over  
the world.

-dB

On Jun 8, 2006, at 3:56 PM, matt ingalls wrote:

> i think you are SOL.
>
> the way i understand it, the platform-independent
> getchar() or whatever it is called, just returns the last ascii value
> that
> was pressed.
>
> to get keyup values and to directly respond to key presses you have
> to do platform specific stuff, which makes sense to keep out of csound
> and put in host code.  for instance, in MacCsound
> my window object receives a keydown or keyup message from the OS,
> but only if the window is in the foreground and user isn't editing  
> text
> somewhere, or doing a shortkey command, etc..
>
> do you mean the max/msp/pd csound~ object or what?
>
> -m
>
> On Jun 8, 2006, at 12:48 PM, Dr. Richard Boulanger wrote:
>
>> I would not want a platform-specific opcode.  In fact, I am using
>> MacCsound to prototype
>> orchestras and demos for a Linux system - (Thanks so much for
>> MacCsound5!!! Just the very very
>> minute I needed it.  You are amazing.)
>>
>> I will be happy to tell you more about this little linux Csound
>> system I am working on (with Barry Vercoe)
>> once I make sure with him that I can tell you about it.
>>
>> Needless to say....  sensekey, and xyin would be nice to have working
>> in a full-featured and straightforward way
>> (as they do in Max/MSP and PD for example)
>>
>> Wishing you and all the developers all the best.
>>
>> Rick
>>
>> On Jun 8, 2006, at 3:14 PM, matt ingalls wrote:
>>
>>> that's a good idea too.  or i can just implement Rick's new opcode
>>> with the same approach.
>>>
>>> if this is in conflict with other platforms and/or something that
>>> would
>>> never possibly be incorporated into the canonical sources, i would
>>> just assume use a reserved control channel name rather than
>>> create a new platform-specific ocpode.  -- what do you want Rick?
>>>
>>> -m
>>>
>>> On Jun 8, 2006, at 10:21 AM, Istvan Varga wrote:
>>>
>>>> And, of course, the host can also just replace the sensekey
>>>> opcode (with csoundAppendOpcode()) and implement the slightly
>>>> modified behavior described below.
>>>>
>>>> On Thursday 08 June 2006 20:15, matt wrote:
>>>>
>>>>> i could see making values < -1 be an "offkey",
>>>>> returning the negative value of the ascii key released.
>>>>
>>>>
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-09 14:07
Frommatt ingalls
SubjectRe: [Cs-dev] sensekey opcode modification request
what is the old way and what is the new way?


On Jun 9, 2006, at 4:47 AM, Istvan Varga wrote:

> On Friday 09 June 2006 14:42, Dr. Richard Boulanger wrote:
>
>> I don't want to break existing orcs... but an enhanced opcode would
>> be much more useful.
>
> Actually, I already have a modified sensekey opcode with the syntax
> you have suggested. The second output argument is optional, and if
> not present, the opcode will behave in the old way. Note however that
> the built-in sensekey opcode in the canonical sources does not  
> actually
> implement the more advanced mode: it is only a stub for compatibility
> (all "key down" events are immediately followed by a "key up" event
> as if the key was only pressed for a very short time), and it is
> expected that host applications like MacCsound will replace it with
> their own platform specific implementation.
>
> I cannot commit this yet, though, since the SourceForge CVS seems to
> be down again.
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-09 14:08
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
a little manpage would help and an example orchestra would be cool too.

-dB

On Jun 9, 2006, at 9:07 AM, matt ingalls wrote:

> what is the old way and what is the new way?
>
>
> On Jun 9, 2006, at 4:47 AM, Istvan Varga wrote:
>
>> On Friday 09 June 2006 14:42, Dr. Richard Boulanger wrote:
>>
>>> I don't want to break existing orcs... but an enhanced opcode would
>>> be much more useful.
>>
>> Actually, I already have a modified sensekey opcode with the syntax
>> you have suggested. The second output argument is optional, and if
>> not present, the opcode will behave in the old way. Note however that
>> the built-in sensekey opcode in the canonical sources does not
>> actually
>> implement the more advanced mode: it is only a stub for compatibility
>> (all "key down" events are immediately followed by a "key up" event
>> as if the key was only pressed for a very short time), and it is
>> expected that host applications like MacCsound will replace it with
>> their own platform specific implementation.
>>
>> I cannot commit this yet, though, since the SourceForge CVS seems to
>> be down again.
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-09 14:13
Frommatt ingalls
SubjectRe: [Cs-dev] sensekey opcode modification request
On Jun 9, 2006, at 6:07 AM, Dr. Richard Boulanger wrote:

> What is SOL?
>
> screaming out loud?
>
> suddenly off line?

shit out of luck



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-09 14:35
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
Thanks istvan...

do you want to just email me the code so I can add it locally while  
waiting for the CVS to come up?

-dB

On Jun 9, 2006, at 8:25 AM, Istvan Varga wrote:

> On Friday 09 June 2006 15:07, matt ingalls wrote:
>
>> what is the old way and what is the new way?
>
> kkeycode[, kkeydown] sensekey
>
> If 'kkeydown' is not present, the opcode behaves in the original way,
> that is, if the state of a key just changes from released to pressed,
> it returns the ASCII code, otherwise it returns -1.
> If the optional output argument is present, the ASCII code is returned
> on both key press and key release events, and 'kkeydown' is 1 in the
> first case, and 0 otherwise. When nothing happens, -1, 0 is returned.
>
> Optionally, to make the opcode really useful, a set of codes >= 128
> could be defined for function, control, and modifier keys. Also, in
> the "advanced" mode, the key code should ideally not be altered by
> any modifiers, e.g. shift+1 may be better returned as separate "shift"
> and "1" events, rather than "!".
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-09 14:35
Frommatt ingalls
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  None  

On Jun 9, 2006, at 4:47 AM, Istvan Varga wrote:

as if the key was only pressed for a very short time), and it is

expected that host applications like MacCsound will replace it with

their own platform specific implementation.


i don't think there is anything platform-specific to do inside the opcode,
i would probably just make key numbers > 127 be "off" keys, which then
doesn't seem like a strong case to even change the opcode at all.

unless you are thinking the opcode and host would be talking to eachother
directly, not through the API?   even so, that might not be possible in my
case because i cannot #include csdl.h because it #includes sndfile.h which
causes compile errors in codewarrior.

-m



Date2006-06-09 16:27
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  

Date2006-06-09 22:50
FromDavid Akbari
SubjectRe: [Cs-dev] sensekey opcode modification request
Hi Dr. B,

   Perhaps this is something like you were thinking of ? What I gathered 
from your original email was that the intended behavior was similar to 
that of a "bang" object as found in many popular dataflow languages 
such as Pure Data, jMax, CPS, ect. I tried to model the UDO after that.

   The raw output of the UDO (to printk2) seems to resemble closely the 
format of a program change message, since it all happens so quickly 
with the press and release; handled by the OS. It also holds the value 
of the last key pressed.

   It's also feasible to make switches - so that while not overtly 
possible in holding down keys (because of the OS), it should be 
possible to set up a global variable space with which to use an 
addition and a modulus to create checkbox like behavior with the ASCII 
keys.



-David




sr		=	44100
kr		=	441
ksmps	=	100
nchnls	=	2

;//
	opcode	sanskey, kk, 0

keyin	sensekey

if	(keyin == -1) then
;kkey_num	=	0
else
kkey_num	= keyin
	endif

ktrig	=	(keyin >= 0 ? 1 : 0)

	xout	kkey_num, ktrig

		endop
;//
/*--- original audio oscillator ---*/

		instr 1		

asig oscili .1*0dbfs, p4, 1

	outs asig, asig

		endin

/*--- original control logic---*/

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

    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

/*--- ---*/

		instr	4

key, kbang	sanskey

;	printk2	key
;	printk2	kbang

   if (kbang == 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
else
	endif

		endin

/*--- ---*/


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




On Jun 8, 2006, at 12:52 PM, Dr. Richard Boulanger wrote:

> I am trying to make a simple ascii keyboard controller using sensekey.

> What I was wondering was if you could possibly modify the sensekey
> opcode (or make a new one) so that it returns the ascii key value and
> a 1 when the key
> is depressed and the ascii key value and a 0 when the key is released.
>
> NEW SYNTAX
>
> kkey_number, kdown_or_up  sensekey



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-10 15:32
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
David,

Thanks again for looking into this.  I will get back to you later and  
also I have a little project that
you might be interested in contributing some music too.  More tonight.

-dB

On Jun 9, 2006, at 5:50 PM, David Akbari wrote:

>
> Hi Dr. B,
>
>    Perhaps this is something like you were thinking of ? What I  
> gathered
> from your original email was that the intended behavior was similar to
> that of a "bang" object as found in many popular dataflow languages
> such as Pure Data, jMax, CPS, ect. I tried to model the UDO after  
> that.
>
>    The raw output of the UDO (to printk2) seems to resemble closely  
> the
> format of a program change message, since it all happens so quickly
> with the press and release; handled by the OS. It also holds the value
> of the last key pressed.
>
>    It's also feasible to make switches - so that while not overtly
> possible in holding down keys (because of the OS), it should be
> possible to set up a global variable space with which to use an
> addition and a modulus to create checkbox like behavior with the ASCII
> keys.
>
>
>
> -David
>
> 
> 
>
> sr		=	44100
> kr		=	441
> ksmps	=	100
> nchnls	=	2
>
> ;//
> 	opcode	sanskey, kk, 0
>
> keyin	sensekey
>
> if	(keyin == -1) then
> ;kkey_num	=	0
> else
> kkey_num	= keyin
> 	endif
>
> ktrig	=	(keyin >= 0 ? 1 : 0)
>
> 	xout	kkey_num, ktrig
>
> 		endop
> ;//
> /*--- original audio oscillator ---*/
>
> 		instr 1		
>
> asig oscili .1*0dbfs, p4, 1
>
> 	outs asig, asig
>
> 		endin
>
> /*--- original control logic---*/
>
> 		instr 3	; this instrument triggers a new note for every keyboard
> keystroke
>
>     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
>
> /*--- ---*/
>
> 		instr	4
>
> key, kbang	sanskey
>
> ;	printk2	key
> ;	printk2	kbang
>
>    if (kbang == 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
> else
> 	endif
>
> 		endin
>
> /*--- ---*/
> 
> 
> ; sco
> f1 0 512 10 1
> f10 0 256 7 0 256 0 ; initialize to all-off
> ;i3 0 1000
> i4 0 1000
> 
>
> 
>
> On Jun 8, 2006, at 12:52 PM, Dr. Richard Boulanger wrote:
>
>> I am trying to make a simple ascii keyboard controller using  
>> sensekey.
>
>> What I was wondering was if you could possibly modify the sensekey
>> opcode (or make a new one) so that it returns the ascii key value and
>> a 1 when the key
>> is depressed and the ascii key value and a 0 when the key is  
>> released.
>>
>> NEW SYNTAX
>>
>> kkey_number, kdown_or_up  sensekey
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-11 03:16
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone  None  
David,

This is almost what I am needing....

What I need are two things:

1.  something more like a makenote in max/msp - so that I play a key and it makes a note event of a certain duration
and then that note terminates.  

2. a sensekey that knows when a key is depressed and when a key is released - so. when it gets a -1, it would tell me which
key sent the -1 and thus I could use this as a key up message and turn the corresponding note off.

This version you did for me still requires me to remember what keys I have pressed in order to turn that key off.

Also your idea of a table that maps the ascii stuff to make them work like a keyboard would be a huge help too.

-dB

On Jun 9, 2006, at 5:50 PM, David Akbari wrote:

<CsoundSynthesizer>

<CsInstruments>


sr = 44100

kr = 441

ksmps = 100

nchnls = 2


;//

opcode sanskey, kk, 0


keyin sensekey


if (keyin == -1) then

;kkey_num = 0

else

kkey_num = keyin

endif


ktrig = (keyin >= 0 ? 1 : 0)


xout kkey_num, ktrig


endop

;//

/*--- original audio oscillator ---*/


instr 1


asig oscili .1*0dbfs, p4, 1


outs asig, asig


endin


/*--- original control logic---*/


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

keystroke


    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


/*--- ---*/


instr 4


key, kbang sanskey


; printk2 key

; printk2 kbang


   if (kbang == 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

else

endif


endin


/*--- ---*/

</CsInstruments>

<CsScore>

; sco

f1 0 512 10 1

f10 0 256 7 0 256 0 ; initialize to all-off

;i3 0 1000

i4 0 1000

</CsScore>


</CsoundSynthesizer>



Date2006-06-11 03:19
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] sensekey opcode modification request
please let me know when you commit these changes.  I could use them  
by Tuesday.

-dB

On Jun 9, 2006, at 7:47 AM, Istvan Varga wrote:

> On Friday 09 June 2006 14:42, Dr. Richard Boulanger wrote:
>
>> I don't want to break existing orcs... but an enhanced opcode would
>> be much more useful.
>
> Actually, I already have a modified sensekey opcode with the syntax
> you have suggested. The second output argument is optional, and if
> not present, the opcode will behave in the old way. Note however that
> the built-in sensekey opcode in the canonical sources does not  
> actually
> implement the more advanced mode: it is only a stub for compatibility
> (all "key down" events are immediately followed by a "key up" event
> as if the key was only pressed for a very short time), and it is
> expected that host applications like MacCsound will replace it with
> their own platform specific implementation.
>
> I cannot commit this yet, though, since the SourceForge CVS seems to
> be down again.
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-14 22:51
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey opcode modification request
AttachmentsNone