;; -*- cscsd-current-processing : "csound to wav, then edit" -*-
<About> ===================================================================


 [[elisp:(surmulot-widget-restore "Indian mode purvi")]]
 [[elisp:(surmulot-widget-restore "Indian mode purvi with meends")]]


================================================================== </About>

<CsoundSynthesizer>
<CsOptions>
</CsOptions>

<CsInstruments>
;|menu SampleRate
;|44100
sr = 44100
;|22050
; sr = 22050
;|11025
; sr = 11025
;|endmenu
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#
;|jAzZgUiTaR
; #define SOUNDFONT #jAzZgUiTaR.sf2# 
; #define PRESET #26#
;|Zheng
; #define SOUNDFONT #Zheng.sf2# 
; #define PRESET #0#
;|BHAcousticGuitarSteel
; #define SOUNDFONT #BHAcousticGuitarSteel.sf2# 
; #define PRESET #72#
;|BassGuitar
; #define SOUNDFONT #acUprBass.sf2# 
; #define PRESET #0#
;|Flute
; #define SOUNDFONT #Flutep.sf2# 
; #define PRESET #0#
;|endmenu


;|menu SoundFont2
;|MaestroVelocity
; #define SOUNDFONT2 #Maestro_Velocity.sf2# 
; #define PRESET2 #0#
;|NylonGuitar
; #define SOUNDFONT2 #NylonGuitar1.SF2#
; #define PRESET2 #0#
;|Cister
; #define SOUNDFONT2 #cister.sf2# 
; #define PRESET2 #127#
;|Psaltry
; #define SOUNDFONT2 #Psaltry.sf2# 
; #define PRESET2 #0#
;|ProTrax
; #define SOUNDFONT2 #ProTrax_Classical_Guitar.sf2# 
; #define PRESET2 #0#
;|jAzZgUiTaR
#define SOUNDFONT2 #jAzZgUiTaR.sf2# 
#define PRESET2 #26#
;|Zheng
; #define SOUNDFONT2 #Zheng.sf2# 
; #define PRESET2 #0#
;|BHAcousticGuitarSteel
; #define SOUNDFONT2 #BHAcousticGuitarSteel.sf2# 
; #define PRESET2 #72#
;|BassGuitar
; #define SOUNDFONT2 #acUprBass.sf2# 
; #define PRESET2 #0#
;|Flute
; #define SOUNDFONT2 #Flutep.sf2# 
; #define PRESET2 #0#
;|endmenu

giengine  fluidEngine
isfnum    fluidLoad "$SOUNDFONT", giengine
isfnum2    fluidLoad "$SOUNDFONT2", giengine
          fluidProgramSelect giengine, 1, isfnum, $BANK, $PRESET
          fluidProgramSelect giengine, 2, isfnum2, $BANK, $PRESET2
          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

  gipbrange init      24


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)

	    fluidControl  giengine, 176, p1, 100, 0
	    fluidControl  giengine, 176, p1, 101, 0
	    fluidControl  giengine, 176, p1, 6, gipbrange  

	    fluidControl  giengine, 176, p2, 100, 0
	    fluidControl  giengine, 176, p2, 101, 0
	    fluidControl  giengine, 176, p2, 6, gipbrange  

  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.01 * (ipbend + kpbend) / gipbrange))
  kdata1    =  kfullbend & 127
  kdata2    =  kfullbend >> 7
	    fluidControl  giengine, 224, p1, kdata1, kdata2  
            fluidNote   giengine, p1, ikey, ivel
	    fluidControl  giengine, 224, 2, kdata1, kdata2  
            fluidNote   giengine, 2, 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 with meends
Phrase Editor
'[encoded data, 29508 characters]'</WIDGET>

<WIDGET>Indian mode purvi
Phrase Editor
'[encoded data, 22924 characters]'</WIDGET>
