| KH wrote:
> I would like to ask if it is possible to "patch" a midi keyboard and
> have Csound playing in realtime. Can somebody please send an example of
> orc&score which is able to do that.
Very simple orc/sco for MIDI control:
;;; midi-in.orc
instr 1
;;; get a MIDI note-number
inum notnum
;;; derive amp value from velocity (?), then scale it
iamp ampmidi 100*inum
;;; convert MIDI note number to cps
icps cpsmidi
ifn = 1
aosc oscil iamp,icps*.5,ifn
;;; linenr is often used in MIDI-controlled instruments
;;; since duration is arbitrary at p-time
iris = .07
idec = .11
iatdec = .01
kenv linenr 1,iris,idec,iatdec
out aosc*kenv
endin
;;; midin000.sco
f1 0 1024 10 1
;;; keep Csound active for 95000 seconds
;;; should be long enough to find whether it works...
f0 95000
e
Under Linux you would use a command-line looking something like this:
csound -o devaudio -M/dev/midi midi-in.*
assuming you have an already working MIDI and audio system. jpff or
another of the gurus can tell you how to do it on other platforms (SGI,
Windows, Mac, ?).
Btw, you could also drive the instrument with a MIDI file like so:
csound -o devaudio -F my_foo.mid midi-in.*
Tons of fun await you...
== Dave Phillips
http://www.bright.net/~dlphilp/index.html |