<CsoundSynthesizer>
<CsOptions>
</CsOptions>

<CsInstruments>
sr = 44100
ksmps = 200
nchnls = 2

#ifndef VOLUME
#define VOLUME #70000#
#end

#ifndef BANK
#define BANK #0#
#end

;|menu SoundFont
;|MaestroVelocity
; #define SOUNDFONT #Maestro_Velocity.sf2# 
; #define PRESET #0#
;|NylonGuitar
#define SOUNDFONT #NylonGuitar1.SF2#
#define PRESET #0#
;|Cister
; #define SOUNDFONT #cister.sf2# 
; #define PRESET #127#
;|Psaltry
; #define SOUNDFONT #Psaltry.sf2# 
; #define PRESET #0#
;|ProTrax
; #define SOUNDFONT #ProTrax_Classical_Guitar.sf2# 
; #define PRESET #0#
;|endmenu

giengine  fluidEngine
isfnum    fluidLoad "$SOUNDFONT", giengine
          fluidProgramSelect giengine, 1, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 2, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 3, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 4, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 5, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 6, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 7, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 8, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 9, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 11, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 12, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 13, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 14, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 15, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 16, isfnum, $BANK, $PRESET

instr 1,2,3,4,5,6,7,8,9,11,12,13,14,15,16
/*| 
((pitchField: 4)
 (pitchFormat: cps)
 (pitchInflexionField: 6)
 (ampField: 5)
 (ampMin:max: (0 127))
 (iTemplate: "i 1 0 0.5 440 80 0"))
|*/
            ;; p4   base pitch (cps)
            ;; p5   velocity
            ;; p6   pitch bend envelope over p3 (in cents)

  imfloat   =  (17.31234049066757 * log(p4)) - 36.376316562296
  ikey      =  round(imfloat)
  ipbend    =  (imfloat - ikey) * 100

  ivel      init      p5

  kpbend    =  0
if p6=0 goto noEnvelope
  kndx      line      0, p3, 1
  kpbend    table     kndx, p6, 1 
noEnvelope:

  kfullbend =  round(8192 * (1 + 0.005 * (ipbend + kpbend)))
  kdata1    =  kfullbend & 127
  kdata2    =  kfullbend >> 7
	    fluidControl  giengine, 224, p1, kdata1, kdata2  
            fluidNote   giengine, p1, ikey, ivel
endin

instr 99
/*|effect i 99 0 1|*/
  imvol	    init      $VOLUME
  asigl, asigr fluidOut	  giengine
	    outs      asigl * imvol, asigr * imvol
endin
</CsInstruments>
<CsScore>

</CsScore>
</CsoundSynthesizer>

<WIDGET>Indian mode purvi (illustration)
Phrase Editor
'[encoded data, 23568 characters]'</WIDGET>
