| Dear Csounders,
I had a question concerning using Csound instruments with
Midi2Cs 0.95's GM feature and decided not only to tell it the
person who asked. It might be of general interest if I did
leave something out that wasn't obvious in the manual ...
Enjoy!
Ruediger Borrmann
http://www.snafu.de/~rubo/songlab/midi2cs
GM supported - 'midi2cs.gmi' (General Midi Instrument) config file
A new file 'midi2cs.gmi' will be created in the config files's
directory the first time you start Midi2Cs 0.95. This file is the
new General Midi Instrument's configuration file. It looks like
this:
; MIDI2CS - General Midi instrument table
; Program Number - Instrument (WAV, AIFF or ORC file)
000 "" ;Acoustic Grand
001 "" ;Bright Acoustic
002 "d:\studio\samples\gm\acpiac3.aif" ;Electric Grand
003 "" ;Honky-Tonk
004 "" ;Electric Piano 1
005 "" ;Electric Piano 2
006 "" ;Harpichord
007 "" ;Clav
008 "" ;Celesta 009
...
048 "d:\studio\csounds\strings\strings.orc" ;String
Ensemble 1
...
Just add your own *.aif, *.wav, *.orc (see Midi2Cs's manual)
files to design your own individual General Midi Instrument set.
Next time you run a conversion of a MIDIfile the instruments of
this table will be used as presets for all tracks in your
MIDIfile that contain GM program changes (the first change will
be taken).
To use *.orc files (I better should have named them *.iif -
instrument include files) as instrument input is a little tricky.
Csound expects functions for lots of instruments to be included
in the header section of your resulting score file. That means
that all functions used by your *.orc instruments should be
defined in a 'midi2cs.hdr' file in Midi2Cs's home directory. Do
not forget to enable 'scoreheader'-reading of the *.hdr file by
editing the global 'midi2cs.pro'-file. e.g.:
scoreheader c:\csound\midi2cs.hdr ; file to be included into
scorefile (readonly)
My current midi2cs.hdr looks like Russel Pinkston's (I think he
was it but I won't swear) header section defined for lots of
instruments in his tutorials:
; Simple Sine Function
f01 0 512 10 1
; Ramp
f02 0 513 7 0 512 1
; Exponential rise
f03 0 513 5 .001 512 1
; Quarter Sine Wave in 128 locs + extended guard point
f04 0 129 9 .25 1 0
; Quarter Cosine
f05 0 129 9 .25 1 90
; Triangular Wave
f06 0 512 10 1 0 .111 0 .04 0 .02
0 .012
; Sawtooth Wave
f07 0 512 10 1 .5 .3 .25 .2 .167 .14
.125 .111
; Square Wave
f08 0 512 10 1 0 .3 0 .2 0 .14
0 .111
; Narrow Pulse
f09 0 512 10 1 1 1 1 .7 .5 .3 .1
; Exponential rise and decay
f10 0 513 5 .1 32 1 480 .01
The string instrument I used for testing looks like the
following. Please do not add instr or out/outs lines. 'instr' and
'out/outs' lines are added automatically by Midi2Cs as needed
depending on mono/stereo settings in the 'midi2cs.pro' file and
automatic instrument numbering.
;ORC
; edited by R. Pinkston, modified for use with MIDI2CS by R.
Borrmann
;
;==========================================================================;
; Schottstaedt FM String Instrument from Dodge
;
;
;
;p4 = amp p5 = pch p6 = rise p7 = dec p8 = vibdel p9 = vibwth p10
= vibrte ;
;==========================================================================;
; sr = 44100
; kr = 4410
; ksmps = 10
; nchnls = 1
;
; instr 1
par
p_maxamplitude 32000
p_cps
endpar
iamp = p4
irise = .2 ;p6
idec = .2 ;p7
ivibdel = .75 ;p8
ivibwth = .03 ;p9
ivibrte = 5.5 ;p10
ifc = p5
ifm1 = ifc
ifm2 = ifc*3
ifm3 = ifc*4
indx1 = 7.5/log(ifc) ;range from ca 2 to 1
indx2 = 15/sqrt(ifc) ;range from ca 2.6 to .5
indx3 = 1.25/sqrt(ifc) ;range from ca .2 to .038
kvib init 0
timout 0,ivibdel,transient ;delays vibrato for
p8 seconds
kvbctl linen 1,.5,p3-ivibdel,.1 ;vibrato control
envelope
krnd randi .0075,15 ;random deviation in vib
width
kvib oscili kvbctl*ivibwth+krnd,ivibrte*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*ifc ;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,(ifc+amod1+amod2+amod3)*(1+kvib),1
asig linen asig+attack,irise,p3,idec
; out asig
;
; endin
aright = asig
aleft = asig
You might have noticed that there's a par/endpar section in the
instrument to specify parameters for automatic use with Midi2Cs.
Parameters should be exactly as to be set in 'midi2cs.pro' and
described in the manual. These settings have a higher priority
than any midi2cs.pro file. It's not tested to death, so if there
are any errors, please tell me, so that I am able to correct
them. I am also interested in receiving intruments edited for the
use with Midi2Cs. I'd like to publish Csound instruments working
with the new GM features of Midi2Cs 0.95 them on a new web page. |