Csound Csound-dev Csound-tekno Search About

[Csnd] sensekey

Date2011-12-09 16:50
Fromk_o_m_p
Subject[Csnd] sensekey
Hello,
when using senseky there is a difference between the ASCII numbers sensekey sends using qutecsound or using the terminal. qutecsound recognizes arrow up/down keys as ASCII numbers 30 and 31 while the terminal sends two numbers 27 and 91 for arrow up and the same 27 and 91 for arrow down. Does anyone knows an explanation for this? Is this a shell configuration issue?

I am using Csound version 5.14 (float samples) Nov  7 2011 and qutecsound 0.6.1 on OS 10.6 running csound on a tcsh shell.

Here's the csound code I used to test it.

Best,

Luis
 

<CsoundSynthesizer>

<CsOptions>

-odac -d -m0

</CsOptions>

<CsInstruments>

instr 1

kres, kkeydown sensekey

ktrig trigger kkeydown, .5, 0

printf "\n\n\t key number: %d", ktrig, kres

endin

</CsInstruments>

<CsScore>

i1 0 36000

</CsScore>

</CsoundSynthesizer>



-- 
--
http://luisantunespena.eu

Date2011-12-09 17:43
FromTito Latini
SubjectRe: [Csnd] sensekey
AttachmentsNone  

Date2011-12-09 17:47
FromAndres Cabrera
SubjectRe: [Csnd] sensekey
Hi,

And CsoundQt does its own handling of keyboard events, not through the
shell, so it can interpret the keys correctly (and you can configure
whether you want automatic repetitions or not).

Cheers,
Andres

On Fri, Dec 9, 2011 at 5:43 PM, Tito Latini  wrote:
> sensekey works only with ASCII characters (1 byte). The arrow keys
> are 2 bytes characters, so sensekey interprets (erroneously) this
> event as a sequence of two ascii-chars. Idem for the F-keys (F1, F2, ...).
> The command
>
>  man ascii
>
> shows the list of the ascii-chars and their codes.
>
> tito
>
> On Fri, Dec 09, 2011 at 05:50:41PM +0100, k_o_m_p wrote:
>> Hello,
>> when using senseky there is a difference between
>> the ASCII numbers sensekey sends using qutecsound
>> or using the terminal. qutecsound recognizes arrow
>> up/down keys as ASCII numbers 30 and 31 while the
>> terminal sends two numbers 27 and 91 for arrow up
>> and the same 27 and 91 for arrow down. Does anyone
>> knows an explanation for this? Is this a shell
>> configuration issue?
>>
>> I am using Csound version 5.14 (float samples)
>> Nov  7 2011 and qutecsound 0.6.1 on OS 10.6
>> running csound on a tcsh shell.
>>
>> Here's the csound code I used to test it.
>>
>> Best,
>>
>> Luis
>>
>>
>> 
>>
>> 
>>
>> -odac -d -m0
>>
>> 
>>
>> 
>>
>> instr 1
>>
>> kres, kkeydown sensekey
>>
>> ktrig trigger kkeydown, .5, 0
>>
>> printf "\n\n\t key number: %d", ktrig, kres
>>
>> endin
>>
>> 
>>
>> 
>>
>> i1 0 36000
>>
>> 
>>
>> 
>>
>>
>>
>> --
>> --
>> http://luisantunespena.eu
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>
>
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-12-09 17:48
FromTito Latini
SubjectRe: [Csnd] sensekey
AttachmentsNone  

Date2011-12-09 22:15
Fromk_o_m_p
SubjectRe: [Csnd] sensekey
Thanks Tito and Andreas for the explanation. Now 
all is clear.
Best,
Luís

Am 09.12.11 18:47, schrieb Andres Cabrera:
> Hi,
>
> And CsoundQt does its own handling of keyboard events, not through the
> shell, so it can interpret the keys correctly (and you can configure
> whether you want automatic repetitions or not).
>
> Cheers,
> Andres
>
> On Fri, Dec 9, 2011 at 5:43 PM, Tito Latini  wrote:
>> sensekey works only with ASCII characters (1 byte). The arrow keys
>> are 2 bytes characters, so sensekey interprets (erroneously) this
>> event as a sequence of two ascii-chars. Idem for the F-keys (F1, F2, ...).
>> The command
>>
>> Â man ascii
>>
>> shows the list of the ascii-chars and their codes.
>>
>> tito
>>
>> On Fri, Dec 09, 2011 at 05:50:41PM +0100, k_o_m_p wrote:
>>> Hello,
>>> when using senseky there is a difference between
>>> the ASCII numbers sensekey sends using qutecsound
>>> or using the terminal. qutecsound recognizes arrow
>>> up/down keys as ASCII numbers 30 and 31 while the
>>> terminal sends two numbers 27 and 91 for arrow up
>>> and the same 27 and 91 for arrow down. Does anyone
>>> knows an explanation for this? Is this a shell
>>> configuration issue?
>>>
>>> I am using Csound version 5.14 (float samples)
>>> Nov  7 2011 and qutecsound 0.6.1 on OS 10.6
>>> running csound on a tcsh shell.
>>>
>>> Here's the csound code I used to test it.
>>>
>>> Best,
>>>
>>> Luis
>>>
>>>
>>> 
>>>
>>> 
>>>
>>> -odac -d -m0
>>>
>>> 
>>>
>>> 
>>>
>>> instr 1
>>>
>>> kres, kkeydown sensekey
>>>
>>> ktrig trigger kkeydown, .5, 0
>>>
>>> printf "\n\n\t key number: %d", ktrig, kres
>>>
>>> endin
>>>
>>> 
>>>
>>> 
>>>
>>> i1 0 36000
>>>
>>> 
>>>
>>> 
>>>
>>>
>>>
>>> --
>>> --
>>> http://luisantunespena.eu
>>>
>>>
>>> Send bugs reports to the Sourceforge bug tracker
>>> Â  Â  Â  Â  Â  Â https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>> Discussions of bugs and features can be posted here
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>> Â  Â  Â  Â  Â  Â https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>
> Send bugs reports to the Sourceforge bug tracker
>              https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>

Date2011-12-09 23:16
FromTito Latini
SubjectRe: [Csnd] sensekey
AttachmentsNone  

Date2011-12-10 11:26
Fromk_o_m_p
SubjectRe: [Csnd] sensekey
Thank you Tito! Very usefull information! I was 
not aware of all these possibilities!
Luís

Am 10.12.11 00:16, schrieb Tito Latini:
> We can use `sensekey' with all the keys that we want, also from the
> console. For example, under X, we can use the `xmodmap' utility for
> modifying keymaps. First we save the default
>
>    xmodmap -pke>  default.map
>
> Now we modify the map for the arrow up/down keys:
>
>    xmodmap -e 'keysym Up = cent' -e 'keysym Down = sterling'
>
> We control the autorepeat with
>
>    xset r on    # autorepeat on
>
> or
>
>    xset r off   # autorepeat off
>
> and finally start csound with an instr that uses the sensekey opcode.
> Now the printed codes are 162 and 163. Good.
> Let's remember us to restore the default:
>
>    xmodmap default.map
>
> The file /usr/include/X11/keysymdef.h contains the names of all the
> keysyms (with a XK_ prefix). The keysyms of the codes from 128 to 255 are
>
>    sed -n '/U+00A0/,/U+00FF/s/XK_//p' /usr/include/X11/keysymdef.h|awk '{print $2}'
>
> tito
>
>
> Send bugs reports to the Sourceforge bug tracker
>              https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>