Csound Csound-dev Csound-tekno Search About

[Cs-dev] sensekey

Date2006-03-25 01:28
Frommatt ingalls
Subject[Cs-dev] sensekey
finally trying out csound5 with MacCsound...


first problem:

error:  no legal opcode, line 23:
k1 sensekey


i use sensekey (with csoundKeyPress() in API ) all the time..
what's going on?


thanks,
matt

Date2006-03-25 02:14
From"Steven Yi"
SubjectRe: [Cs-dev] sensekey
AttachmentsNone  

Date2006-03-25 04:53
FromDavid Akbari
SubjectRe: [Cs-dev] sensekey
I still see it in the -z list as well but for some reason, the Mac 
Terminal.app doesn't redirect the stdin to Csound as it should...

Usually I just use MacCsound for sensekey related things, lol

Here's the example I was trying with Csound5, and although it compiles 
and initiates performance correctly, I can't seem to get it to respond 
to ASCII input on Mac OS X.

sensekey DOES show up in the -z list

Csound version 5.01.0 beta (float samples) Mar 11 2006
[...]
sensekey    k           (null)





sr		=	44100
kr		=	4410
ksmps	=	10
nchnls	=	2

gifn1	ftgen	1,0,16384,10,1
gifn5	ftgen	5,0,16384,21,6,1

/**********************************/

		instr	1	;snare drum

;	init

idur		=	p3
iamp		=	ampdb(p4)
ifrq		=	p5
iatk		=	p6

;	synth

kampenv	expseg	iatk,	.5,	.001
;asnare	oscil		kampenv,	ifrq,	5
asnare	foscil	kampenv,	ifrq,	1,	1,	100,	5
klfo		oscil		.5,	.25,	1
klfo		=	klfo + .5

	outs		asnare*klfo, asnare*(1-klfo)	

		endin

/**********************************/

		instr	2	;kick drum

;	init

idur		=	p3
indx		=	p4
ivel		=	p5

;	synth

kpenv	expon		60, 1, 40
kampenv	expseg	.001, .01, ivel, 1, .001
akick	foscil	kampenv, kpenv, 1, 4, indx, 1
alpf		butterlp	akick, 80

	outs		alpf, alpf

		endin

/**********************************/

		instr	3	;hi hat

;	init

idur		=	p3
iamp		=	p4
ifrq		=	p5
idrum	=	p6
ilforate	=	p7
iseed	=	p8

ipan		=	.5

if	(idrum	==	1)	kgoto closed
if	(idrum	==	2)	kgoto open
	kgoto end

;	synth

closed:
kampenv	expseg	p4+5000, .2, .01
	kgoto contin

open:
kampenv	linseg	p4+5000, .2, .01
	kgoto contin

contin:
kamplfo	oscil		.5,	ilforate,	1
kpan		oscil		.5,	idur/4,	1
kamplfo	=	kamplfo + .5
;ahhat	oscil		((kampenv + ampdb(kamplfo))/2), ifrq, 5
ahhat	foscil	((kampenv + ampdb(kamplfo))/2), ifrq, 1, 1, 100, 5
afilt2	atone		ahhat, 8000
afilt1	atone		afilt2, 8000
kpan		=	kpan + .5

	outs		afilt1 * (1 - kpan), afilt1 * (kpan)
end:
		endin

/**********************************/

		instr	4	;meta keys

k1	sensekey

	if	(k1 == 97) then
	event	"i",1,0,1,78,1289,15000
elseif	(k1 == 115) then
	event "i",2,0,0.75,1,15000
elseif	(k1 == 100) then
	event "i",3,0,0.5,20000,1289,1,0.25,0
elseif	(k1 == 102) then
	event "i",3,0,0.5,20000,1289,2,0.25,0
else
		endif

		endin


i4	0	300

e





-David

On Mar 24, 2006, at 8:28 PM, matt ingalls wrote:

> finally trying out csound5 with MacCsound...
>
>
> first problem:
>
> error:  no legal opcode, line 23:
>      k1 sensekey
>
>
> i use sensekey (with csoundKeyPress() in API ) all the time..
> what's going on?
>
>
> thanks,
> matt


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-03-25 06:09
Frommatt ingalls
SubjectRe: [Cs-dev] sensekey
On Mar 24, 2006, at 6:14 PM, Steven Yi wrote:

> I have sensekey listed with csound -z here on my computer, compiling
> from CVS.  I imagine it must be there.  Do you have OPCODEDIR or
> OPCODEDIR64 set, or if using from the API have you added those
> directories from the host?

ok thanks steven - i was setting OPCODEDIR wrong!

so now it compiles, but it STILL doesn't work!!!

i don't see anywhere in pitch.c where it uses  csound->inChar_
which is what csoundKeyPress assigns the value to..

could you please add something like this in pitch.c

int ksense(CSOUND *csound, KSENSE *p)
{
	if (csound-> inChar_ > 0) {
    		*p->ans = csound->inChar_;
		csound->inChar_ = 0
    	}
	else
	        *p->ans = getchar();

         return OK;
}

that way sensekey would support a keystroke sent via the API and
stdin keys.



and while we are at it, i have always wanted to either add a "keyup"
opcode/API function.  that way i can write an instrument that
uses the keyboard keys like a piano keyboard...


THANKS!
-matt




>
> steven
>
> On 3/24/06, matt ingalls  wrote:
>> finally trying out csound5 with MacCsound...
>>
>>
>> first problem:
>>
>> error:  no legal opcode, line 23:
>>  k1 sensekey
>>
>>
>> i use sensekey (with csoundKeyPress() in API ) all the time..
>> what's going on?
>>
>>
>> thanks,
>> matt
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting  
> language
> that extends applications into web and mobile media. Attend the  
> live webcast
> and join the prime developer group breaking into this new coding  
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-03-25 12:01
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey
AttachmentsNone  

Date2006-03-25 18:00
Frommatt ingalls
SubjectRe: [Cs-dev] sensekey

There are now changes to make csoundKeyPress() work, and also for stdin

great, thanks.  [ hopefully there will be an update released soon :) ]

and while we are at it, i have always wanted to either add a "keyup"
opcode/API function.  that way i can write an instrument that
uses the keyboard keys like a piano keyboard...

I do not really know why the API needs to be changed for that. It should
be easy to write a simple utility that uses FLTK and PortMidi to display
a piano keyboard, sense keyboard, and send MIDI events. In fact, I already

well for one, FLTK does not work with the API on mac -- it hangs if you call
csoundLib from a separate thread (which both of my host apps do) and
even from the application thread, it takes over the host application's menus,
which is not very nice..

if you are suggesting a separate application, i already often use a nice software 
MIDI keyboard [ "MidiKeys"http://www.manyetas.com/] i can send to csound fine, but
i like using the computer keyboard directly with sensekey - the computer keyboard
is pretty great - you can have around 100 commands, easily accessible.
Mapping those to some kind of piano keyboard layout is NOT what i meant
when i said "like a piano keyboard" -- i didn't mean pitch-wise --
just the ability to watch for key-release so you can "sustain" an action..

anyway, i can try to write my own opcode for this....

speaking of which, is there a OPCODEPLUGINDIR directory or something?  or do you
need to put 3rd party opcode plugins in OPCODEDIR?  -- which means you need
admin access on the mac.  and when i update will the installer be smart enough to 
leave my 3rd party opcodes there?

thanks,
matt


Date2006-03-25 19:50
FromIstvan Varga
SubjectRe: [Cs-dev] sensekey
AttachmentsNone