Csound Csound-dev Csound-tekno Search About

[Csnd] user input from command line, sensekey

Date2008-01-25 13:13
FromRory Walsh
Subject[Csnd] user input from command line, sensekey
Is there a way to retrieve a character that's pressed on the keyboard 
and print it to screen? I can do something like this for example:

instr 1
prints "Please type something"
knum, kdown sensekey

if(kdown==1) then
printks "\nThe something you pressed was:%d", 0, knum
endif

endin

What about asking someone to enter a number? 1 on a standard keyboard is 
ascii 49. One could compare each ascii value and print out the 
corresponding number/character but that seems like a lot of work. Is 
there another way around this, I didn't see any itoa type function 
although there are conversion opcodes to go the other way around.

Rory.

Date2008-01-28 18:35
FromAndres Cabrera
Subject[Csnd] Re: user input from command line, sensekey
Hi,

I think not directly in csound, but maybe you can do it using python.

Cheers,
Andrés

El vie, 25-01-2008 a las 13:13 +0000, Rory Walsh escribió:
> Is there a way to retrieve a character that's pressed on the keyboard 
> and print it to screen? I can do something like this for example:
> 
> instr 1
> prints "Please type something"
> knum, kdown sensekey
> 
> if(kdown==1) then
> printks "\nThe something you pressed was:%d", 0, knum
> endif
> 
> endin
> 
> What about asking someone to enter a number? 1 on a standard keyboard is 
> ascii 49. One could compare each ascii value and print out the 
> corresponding number/character but that seems like a lot of work. Is 
> there another way around this, I didn't see any itoa type function 
> although there are conversion opcodes to go the other way around.
> 
> Rory.
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2008-01-28 18:50
FromRory Walsh
Subject[Csnd] Re: Re: user input from command line, sensekey
Cheers, it was just something I was preparing for a class but it's ok now.

Rory.


Andres Cabrera wrote:
> Hi,
> 
> I think not directly in csound, but maybe you can do it using python.
> 
> Cheers,
> Andrés
> 
> El vie, 25-01-2008 a las 13:13 +0000, Rory Walsh escribió:
>> Is there a way to retrieve a character that's pressed on the keyboard 
>> and print it to screen? I can do something like this for example:
>>
>> instr 1
>> prints "Please type something"
>> knum, kdown sensekey
>>
>> if(kdown==1) then
>> printks "\nThe something you pressed was:%d", 0, knum
>> endif
>>
>> endin
>>
>> What about asking someone to enter a number? 1 on a standard keyboard is 
>> ascii 49. One could compare each ascii value and print out the 
>> corresponding number/character but that seems like a lot of work. Is 
>> there another way around this, I didn't see any itoa type function 
>> although there are conversion opcodes to go the other way around.
>>
>> Rory.
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>