Csound Csound-dev Csound-tekno Search About

Reading a MIDI (AKA Driving me bonkers)

Date1999-04-20 15:31
FromRobert Junior Mcnulty
SubjectReading a MIDI (AKA Driving me bonkers)
This is crazy. I'm using MIDI2CS to make a file.
First, the problem
I cannnot get ampmidi and cpsmidib to work.
I think I have it all set up. It won't compile.
The basic orc is from Pinkston's examples on how to make a violin.
Here is what i made. notice the ampmidi and cpsmidib.








;ORC
strings.orc==========================================================================;
;                Schottstaedt FM String Instrument from Dodge              ;
;                                                                          ;
;p4 = pch p5 = amp p6 = rise p7 = dec p8 = vibdel p9 = vibwth p10 = vibrte ;
;==========================================================================;
        sr      =       22000
        kr      =       1100
        ksmps   =       20
        nchnls  =       1

             ;   instr   1
        iamp    =       ampmidi 10000
        icps    =       cpsmidib p5    ;S = fc +- ifm1 +- kfm2 +- lfm3
        ifm1    =       icps
        ifm2    =       icps*3
        ifm3    =       icps*4
        indx1   =       7.5/log(icps)    ;range from ca 2 to 1
        indx2   =       15/sqrt(icps)    ;range from ca 2.6 to .5
        indx3   =       1.25/sqrt(icps)  ;range from ca .2 to .038
        kvib    init    0                

                timout  0,.75,transient  ;delays vibrato for p8 seconds
        kvbctl  linen   1,.5,p3-.75,.1   ;vibrato control envelope
        krnd    randi   .0075,15        ;random deviation in vib width        
        kvib    oscili  kvbctl*.03+krnd,5.5*kvbctl,1 ;vibrato generator
        
transient:
        timout  .2,p3,continue          ;execute for .2 secs only
        ktrans  linseg  1,.2,0,1,0      ;transient envelope 
        anoise  randi   ktrans,.2*icps   ;noise... 
        attack  oscil   anoise,2000,1   ;...centered around 2kHz

continue:      
        amod1   oscili  ifm1*(indx1+ktrans),ifm1,1
        amod2   oscili  ifm2*(indx2+ktrans),ifm2,1
        amod3   oscili  ifm3*(indx3+ktrans),ifm3,1
        asig    oscili  iamp,(icps+amod1+amod2+amod3)*(1+kvib),1
        asig    linen   asig+attack,.2,p3,.2
               aright = asig
               
               ; out     asig
        
              ;  endin

MIDI2CS manual said to get rid of INSTR, OUT, and ENDIN in the file.
Below is the error.


orch compiler:
260 lines read
	instr	1	
error:  input arg 'ampmidi10000' used before defined, line 27:
        iamp    =       ampmidi 10000
error:  input arg 'ampmidi10000' of type a not allowed, line 27:
        iamp    =       ampmidi 10000
error:  input arg 'cpsmidibp5' used before defined, line 28:
        icps    =       cpsmidib p5    ;S = fc +- ifm1 +- kfm2 +- lfm3
error:  input arg 'cpsmidibp5' of type ? not allowed, line 28:
        icps    =       cpsmidib p5    ;S = fc +- ifm1 +- kfm2 +- lfm3
	instr	2	
	instr	3	
	instr	4	
	instr	5	
	instr	6	
	instr	7	
	instr	8	
4 syntax errors in orchestra.  compilation invalid

MIDI2cs creates a file, but it uses comments.


____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=