adding csound PD class

adding csound PD class

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr=44100
kr=44.1
ksmps=1000
nchnls=2

        FLpanel "This Panel contains a Knob and shows its current value",400,300
ih1     FLvalue "This is current value of output of the Knob", 100,20,50,20
gk1,gih  FLknob  "Current value of this Knob is shown in a text field", 80,5000,-1,1, ih1, 90, 150,100
        FLpanelEnd
        FLrun

        instr 1
        FLsetVal_i 440, gih
a1      oscili  3000, gk1, 1
        outs     a1,a1
        endin
</CsInstruments>
<CsScore>
f1 0 1024 10 1
i1 0 2 440

</CsScore>
</CsoundSynthesizer>

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr=44100
kr=44.1
ksmps=1000
nchnls=2
/*
        FLpanel "This Panel contains a Knob and shows its current value",400,300
ih1     FLvalue "This is current value of output of the Knob", 100,20,50,20
gk1,gih  FLknob  "Current value of this Knob is shown in a text field", 80,5000,-1,1, ih1, 90, 150,100
        FLpanelEnd
        FLrun
*/
        instr 1
;        FLsetVal_i 440, gih
a1      oscili  3000, p4, 1
        outs     a1,a1
        endin
</CsInstruments>
<CsScore>
f1 0 1024 10 1
i1 0 2 440

</CsScore>
</CsoundSynthesizer>


Orchestra functional notation

Orchestra functional notation

<CsoundSynthesizer>
; adapted from Andre Bartetzki's original cmask example
; see http://www.bartetzki.de/en/index.html
<CsOptions>
  -d -o dac
</CsOptions>

<CsInstruments>
sr     = 44100
ksmps  = 10
nchnls = 2
0dbfs  = 1.0

  instr 1

ipanl = table(1-p5, 4, 1)
ipanr = table(p5, 4, 1)

andx = line:a(p4, p3, p4+p3*p6)
asig = tablei:a(andx*sr, 1)
kamp = oscil(0.25, 1/p3, 2)
     outs  asig*kamp*ipanl, asig*kamp*ipanr

  endin
</CsInstruments>

<CsScore bin="gmask">
{
f1 0 262144 1 "whisp.aif" 0 4 1
;= 5.94 sec
f2 0 8192 19 1 1 270 1
f4 0 8192 9 .25 1 0      ; pan function
}

f 0 60

p1 const 1

p2 rnd uni
mask (0 .0005 37 .007 60 .003) (0 .003 37 .15 60 .005)

p3 rnd uni
mask [.3 .02] [.7 .04]

p4
seg [0 5.9]

p5 range 0 1

p6 rnd uni
mask (0 .3 25 1 40 .7) (0 2 4 1 25 1.2)
quant .3 (0 0 25 .9 30 0 45 .9 55 0) (40 0 45 1.5 55 0)
</CsScore>
</CsoundSynthesizer>

<CsoundSynthesizer>
; adapted from Andre Bartetzki's original cmask example
; see http://www.bartetzki.de/en/index.html
<CsOptions>
  -d -o dac
</CsOptions>

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

instr 1

ipanl	table	1-p5 ,4,1
ipanr	table	p5 ,4,1

andx	line	p4,p3,p4+p3*p6
asig	tablei	andx*sr,1
kamp	oscil	8000,1/p3,2
		outs	asig*kamp*ipanl, asig*kamp*ipanr

endin
</CsInstruments>

<CsScore bin="gmask">
{
f1 0 262144 1 "whisp.aif" 0 4 1
;= 5.94 sec
f2 0 8192 19 1 1 270 1
f4 0 8192 9 .25 1 0			; pan function
}

f 0 60

p1 const 1

p2 rnd uni
mask (0 .0005 37 .007 60 .003) (0 .003 37 .15 60 .005)

p3 rnd uni
mask [.3 .02] [.7 .04]

p4
seg [0 5.9]

p5 range 0 1

p6 rnd uni
mask (0 .3 25 1 40 .7) (0 2 4 1 25 1.2)
quant .3 (0 0 25 .9 30 0 45 .9 55 0) (40 0 45 1.5 55 0)
</CsScore>
</CsoundSynthesizer>


Better orchestra for VST plugins, with mixer and reverb built in.


git is a mess

git is a mess

<CsoundSynthesizer>
<CsOptions>
-d
</CsOptions>
<CsInstruments>

opcode Test,k,[k]

kS[] xin
k1 = kS[0]
   xout k1

endop

instr 1

kS[] init 2
ks[0] = 1
k2 Test kS
   printk2 k2

endin

</CsInstruments>
<CsScore>

i1 0 1

</CsScore>
</CsoundSynthesizer>
<bsbPanel>
 Widgets
 <objectName/>
 <x>614</x>
 <y>61</y>
 <width>695</width>
 <height>747</height>
 <visible>true</visible>
 <uuid/>
 <bgcolor mode="nobackground">
  <r>231</r>
  <g>46</g>
  255
 </bgcolor>
 <bsbObject version="2" type="BSBVSlider">
  <objectName>slider1</objectName>
  <x>5</x>
  <y>5</y>
  <width>20</width>
  <height>100</height>
  <uuid>{fe924818-39b1-44b5-b240-331a49ca0049}</uuid>
  <visible>true</visible>
  <midichan>0</midichan>
  <midicc>-3</midicc>
  <minimum>0.00000000</minimum>
  <maximum>1.00000000</maximum>
  <value>0.00000000</value>
  <mode>lin</mode>
  <mouseControl act="jump">continuous</mouseControl>
  <resolution>-1.00000000</resolution>
  <randomizable group="0">false</randomizable>
 </bsbObject>
</bsbPanel>
<bsbPresets>
</bsbPresets>
<MacGUI>
ioView nobackground {59367, 11822, 65535}
ioSlider {5, 5} {20, 100} 0.000000 1.000000 0.000000 slider1
</MacGUI>

<CsoundSynthesizer>
<CsOptions>
-d
</CsOptions>
<CsInstruments>

opcode Test,k,[k]

kS[] xin
k1 = kS[0]
   xout ks1

endop

instr 1

;kS[] init 2
; ks[0] = 1
;k2 Test kS[]
   ;printk2 k2

endin

</CsInstruments>
<CsScore>

i1 0 1

</CsScore>
</CsoundSynthesizer>
<bsbPanel>
 Widgets
 <objectName/>
 <x>614</x>
 <y>61</y>
 <width>695</width>
 <height>747</height>
 <visible>true</visible>
 <uuid/>
 <bgcolor mode="nobackground">
  <r>231</r>
  <g>46</g>
  255
 </bgcolor>
 <bsbObject version="2" type="BSBVSlider">
  <objectName>slider1</objectName>
  <x>5</x>
  <y>5</y>
  <width>20</width>
  <height>100</height>
  <uuid>{fe924818-39b1-44b5-b240-331a49ca0049}</uuid>
  <visible>true</visible>
  <midichan>0</midichan>
  <midicc>-3</midicc>
  <minimum>0.00000000</minimum>
  <maximum>1.00000000</maximum>
  <value>0.00000000</value>
  <mode>lin</mode>
  <mouseControl act="jump">continuous</mouseControl>
  <resolution>-1.00000000</resolution>
  <randomizable group="0">false</randomizable>
 </bsbObject>
</bsbPanel>
<bsbPresets>
</bsbPresets>
<MacGUI>
ioView nobackground {59367, 11822, 65535}
ioSlider {5, 5} {20, 100} 0.000000 1.000000 0.000000 slider1
</MacGUI>


Updated for Istvan Varga MIDI module.

Updated for Istvan Varga MIDI module.


no message

no message

<CsoundSynthesizer>
<CsOptions>
csound -odac6 temp.orc temp.sco
</CsOptions>
<CsInstruments>
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

; gihandle1 vstinit "c:/projects/music/library/polyiblit.dll", 1
gihandle1 vstinit "c:/Program Files/Steinberg/Cubase SX/vstplugins/Synths/Cheeze Machine/Cheeze Machine.dll", 1
vstedit gihandle1

instr 1
iattack = 0.03
isustain = p3
irelease = 0.05
; To get the right envelope.
p3 = iattack + isustain + irelease
; To get the right cutoff time.
xtratim iattack + irelease
ichannel = p1 - 1
ikey = p4
ivelocity = p5
vstnote gihandle1, ichannel, ikey, ivelocity, p3
ain1 = 0
adamping linseg 0, iattack, 1.0, isustain, 1.0, irelease, 0.0
ab1, ab2 vstaudio gihandle1, ain1, ain1
outs ab1, ab2
endin
</CsInstruments>
<CsScore>
i 1 0 10 60 60
i 1 2 1 72 60
i 1 2.01 2 64 60
i 1 15 15 60.375 60
i 1 15 15 64 60
i 1 18 15 36 60
i 1 20.03 15 80 56
i 1 15 400 62 60

</CsScore>
</CsoundSynthesizer>


updated test according to issue

updated test according to issue

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>

instr 1

Seval = p4
icompiled compilestr Seval

if (icompiled == 0) then
   printf_i "Compiled: %s\n", 1, Seval
else
   printf_i "!!!Did not compile: %s\n", 1, Seval
endif

endin

schedule 1, 1, 1, {{
instr 10

aL chnget "outLeft"
aR chnget "outRight"

outs aL, aR

chnclear "outLeft"
chnclear "outRight"

endin
}}

schedule 1, 2, 1, {{
schedule 10, 0, -1
}}

schedule 1, 3, 1, {{
instr 20
ipan = p6
ares oscil p4, p5

aleft = ares * ipan
aright = ares * (1 - ipan)

chnmix  aleft, "outLeft"
chnmix  aright, "outRight"

endin
}}

schedule 1, 4, 1, {{
schedule 20, 0, 1, 0.8, 261, 1
}}

schedule 1, 5, 1, {{
schedule 20, 0, 1, 0.8, 330, 0
}}

schedule 1, 6, 1, {{
schedule 20, 0, 1, 0.8, 440, 1
}}

</CsInstruments>
<CsScore>
;i1 0 1

f0 8
e
</CsScore>
</CsoundSynthesizer>

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
instr 1
  S1 = {{this is a "string"
  }}
  schedule 2,0,1,S1
endin

instr 2
  prints p4
endin

schedule(2, 1, 1, {{ This is also a "string"
}})
schedule(2, 0.5, 1, "This is simple \"string\" with escaped string inside\n")

</CsInstruments>
<CsScore>
i1 0 1

f0 3
</CsScore>
</CsoundSynthesizer>


Code tidying and licence

Code tidying and licence

<CsoundSynthesizer>

<CsInstruments>
instr 1

isrc = 1

if isrc \
     == 1  \
     goto noise
print isrc
 goto \
     next
noise: asig rand 1
next:

endin

</CsInstruments>

<CsScore>
e
</CsScore>

</CsoundSynthesizer><bsbPanel>
 Widgets
 <objectName/>
 <x>72</x>
 <y>179</y>
 <width>400</width>
 <height>200</height>
 <visible>true</visible>
 <uuid/>
 <bgcolor mode="nobackground">
  <r>231</r>
  <g>46</g>
  255
 </bgcolor>
 <bsbObject version="2" type="BSBVSlider">
  <objectName>slider1</objectName>
  <x>5</x>
  <y>5</y>
  <width>20</width>
  <height>100</height>
  <uuid>{dc77e3c0-5395-4507-ba10-c7b84f8be663}</uuid>
  <visible>true</visible>
  <midichan>0</midichan>
  <midicc>-3</midicc>
  <minimum>0.00000000</minimum>
  <maximum>1.00000000</maximum>
  <value>0.00000000</value>
  <mode>lin</mode>
  <mouseControl act="jump">continuous</mouseControl>
  <resolution>-1.00000000</resolution>
  <randomizable group="0">false</randomizable>
 </bsbObject>
</bsbPanel>
<bsbPresets>
</bsbPresets>
<MacOptions>
Version: 3
Render: Real
Ask: Yes
Functions: ioObject
Listing: Window
WindowBounds: 72 179 400 200
CurrentView: io
IOViewEdit: On
Options:
</MacOptions>
<MacGUI>
ioView nobackground {59367, 11822, 65535}
ioSlider {5, 5} {20, 100} 0.000000 1.000000 0.000000 slider1
</MacGUI>


Fixed delay taps

Fixed delay taps

<CsoundSynthesizer>
<CsOptions>
csound -RWfo Xanadu.wav temp.orc temp.sco
</CsOptions>
<CsInstruments>
sr          =           48000
kr          =           48000
ksmps       =           1
nchnls      =           2
;--------------------------------------------------------
;Instrument 1 : plucked strings chorused left/right and
;       pitch-shifted and delayed taps thru exponential
;       functions, and delayed.
;--------------------------------------------------------

            instr       1
ishift      =           .00666667               ;shift it 8/1200.
ipch        =           cpspch(p5)              ;convert parameter 5 to cps.
ioct        =           octpch(p5)              ;convert parameter 5 to oct.
kvib        oscil       1/120, ipch/50, 1       ;vibrato
ag          pluck       2000, cpsoct(ioct+kvib), 1000, 1, 1
agleft      pluck       2000, cpsoct(ioct+ishift), 1000, 1, 1
agright     pluck       2000, cpsoct(ioct-ishift), 1000, 1, 1
kf1         expon       .1, p3, 1.0             ;exponential from 0.1 to 1.0
kf2         expon       1.0, p3, .1             ;exponential from 1.0 to 0.1
adump       delayr      2.0                     ;set delay line of 2.0 sec
atap1       deltapi     kf1                     ;tap delay line with kf1 func.
atap2       deltapi     kf2                     ;tap delay line with kf2 func.
ad1         deltap      2.0                     ;delay 2 sec.
ad2         deltap      1.1                     ;delay 1.1 sec.
            delayw      ag                      ;put ag signal into delay line.
            outs        agleft+atap1+ad1, agright+atap2+ad2
            endin
;-------------------------------------------------------------
;Instrument 2 : plucked strings chorused left/right and
;       pitch-shifted with fixed delayed taps.
;------------------------------------------------------------

            instr       2
ishift      =           .00666667               ;shift it 8/1200.
ipch        =           cpspch(p5)              ;convert parameter 5 to cps.
ioct        =           octpch(p5)              ;convert parameter 5 to oct.
kvib        oscil       1/120, ipch/50, 1       ;vibrato
ag          pluck       1000, cpsoct(ioct+kvib), 1000, 1, 1
agleft      pluck       1000, cpsoct(ioct+ishift), 1000, 1, 1
agright     pluck       1000, cpsoct(ioct-ishift), 1000, 1, 1
adump       delayr      0.3                     ;set delay line of 0.3 sec
ad1         deltap      0.1                     ;delay 100 msec.
ad2         deltap      0.2                     ;delay 200 msec.
            delayw      ag                      ;put ag sign into del line.
            outs        agleft+ad1, agright+ad2
            endin
;-----------------------------------------------------------
;Instrument 3 : New FM algorithm, modified to produce large timbre
;               shifts using modulation of I and r. Detuned chorusing employed.
;-----------------------------------------------------------
            instr       3
ishift      =           .00666667               ;shift it 8/1200.
ipch        =           cpspch(p5)              ;convert parameter 5 to cps.
ioct        =           octpch(p5)              ;convert parameter 5 to oct.
kadsr       linseg      0, p3/3, 1.0, p3/3, 1.0, p3/3, 0 ;ADSR envelope
kmodi       linseg      0, p3/3, 5, p3/3, 3, p3/3, 0 ;ADSR envelope for I
kmodr       linseg      p6, p3, p7              ;r moves from p6->p7 in p3 sec.
a1          =           kmodi*(kmodr-1/kmodr)/2
a1ndx       =           abs(a1*2/20)            ;a1*2 is normalized from 0-1.
a2          =           kmodi*(kmodr+1/kmodr)/2
a3          tablei      a1ndx, 3, 1             ;lookup tbl in f3, normal index
ao1         oscil       a1, ipch, 2             ;cosine
a4          =           exp(-0.5*a3+ao1)
ao2         oscil       a2*ipch, ipch, 2        ;cosine
aoutl       oscil       1000*kadsr*a4, ao2+cpsoct(ioct+ishift), 1 ;fnl outleft
aoutr       oscil       1000*kadsr*a4, ao2+cpsoct(ioct-ishift), 1 ;fnl outright
            outs        aoutl, aoutr
            endin

</CsInstruments>
<CsScore>
;       Score for final project in Digital Audio Processing
;       ---------------------------------------------------

;           Piece entitled :  X A N A D U (short version)
;                           Joseph T. Kung, 12/12/88

;           The first part of the score will specify all function
;       tables used in the piece. The second part specifies
;       the instruments and notes. The latter is divided into
;       7 sections, each playing a chord on a different
;                 instrument.
;       The chords are uncommon guitar chords that use the open
;       B and E strings often. These will be transposed by
;       octaves on some chords.

;       Each instrument will play a chord for 15 seconds. The
;                 timbre
;       of the instrument will change in that interval and join
;       with the next instrument/chord sequence. Instrument 3
;       uses a modified FM synthesis technique. This is joined
;       by an additional plucked-string instrument
;       (instruments 1 and 2).

;   The Function Tables
;   -------------------
;All functions are post-normalized (max value is 1) if p4 is
;POSITIVE.

f1 0 8192 10 1      ;sine wave
f2 0 8192 11 1      ;cosine wave
f3 0 8192 -12 20.0  ;unscaled ln(I(x)) from 0 to 20.0

;-----------------------------------------------------------

;----- This section comprises all the new FM sounds -----------

;F#7addB chord on a guitar
i3 0 15 0 7.06 2.0 0.2  ;F#
i3 . . . 8.01 . .   ;C# above
i3 . . . 8.06 . .   ;F# octave above 1st one
i3 . . . 8.10 . .   ;Bb next one up
i3 . . . 8.11 . .   ;B
i3 . . . 9.04 . .   ;E

;D6add9 chord on a guitar
i3 7.5 15 0 6.02 1.7 0.5    ;D
i3 . . . 6.09 . .   ;A above
i3 . . . 7.02 . .   ;D octave above 1st one
i3 . . . 7.06 . .   ;F# next one up
i3 . . . 6.11 . .   ;B
i3 . . . 7.04 . .   ;E

;Bmajadd11 chord on a guitar
i3 15 15 0 7.11 1.4 0.8 ;B
i3 . . . 8.06 . .   ;F# above
i3 . . . 8.11 . .   ;B octave above 1st one
i3 . . . 9.03 . .   ;D# next one up
i3 . . . 8.11 . .   ;B
i3 . . . 9.04 . .   ;E;

;Amajadd9 chord on a guitar
i3 22.5 15 0 6.09 1.1 1.1   ;A
i3 . . . 7.04 . .   ;E above
i3 . . . 8.09 . .   ;A octave above 1st one
i3 . . . 8.01 . .   ;C# next one up
i3 . . . 7.11 . .   ;B
i3 . . . 8.04 . .   ;E

;Bmajadd11 chord on a guitar
i3 30 15 0 6.11 0.8 1.4 ;B
i3 . . . 7.06 . .   ;F# above
i3 . . . 7.11 . .   ;B octave above 1st one
i3 . . . 8.03 . .   ;D# next one up
i3 . . . 7.11 . .   ;B
i3 . . . 8.04 . .   ;E;

;Gmaj6 chord on a guitar
i3 37.5 15 0 5.07 0.5 1.7   ;G
i3 . . . 6.02 . .   ;D above
i3 . . . 6.07 . .   ;G octave above 1st one
i3 . . . 6.11 . .   ;B on G string
i3 . . . 6.11 . .   ;B
i3 . . . 7.04 . .   ;E

;F#7addB chord on a guitar
i3 45 15 0 7.06 0.2 2.0 ;F#
i3 . . . 8.01 . .   ;C# above
i3 . . . 8.06 . .   ;F# octave above 1st one
i3 . . . 8.10 . .   ;Bb next one up
i3 . . . 8.11 . .   ;B
i3 . . . 9.04 . .   ;E

; This section adds the plucked chords to the beginning of each
; section.

;F#7addB chord on a guitar
i1 0 10 0 8.06  ;F#
i1 0.1 . . 9.01 ;C# above
i1 0.2 . . 9.06 ;F# octave above 1st one
i1 0.3 . . 9.10 ;Bb next one up
i1 0.4 . . 9.11 ;B
i1 0.5 . . 10.04    ;E

;D6add9 chord on a guitar
i2 7.5 10 0 8.02    ;D
i2 7.6 . . 8.09     ;A above
i2 7.7 . . 9.02     ;D octave above 1st one
i2 7.8 . . 9.06     ;F# next one up
i2 7.9 . . 9.11     ;B
i2 8.0 . . 10.04    ;E

;Bmajadd11 chord on a guitar
i2 15 10 0 8.11     ;B
i2 15.1 . . 9.06    ;F# above
i2 15.2 . . 9.11    ;B octave above 1st one
i2 15.3 . . 10.03   ;D# next one up
i2 15.4 . . 9.11    ;B
i2 15.5 . . 10.04   ;E;

;Amajadd9 chord on a guitar
i2 22.5 10 0 8.09   ;A
i2 22.6 . . 9.04    ;E above
i2 22.7 . . 10.09   ;A octave above 1st one
i2 22.8 . . 10.01   ;C# next one up
i2 22.9 . . 9.11    ;B
i2 23.0 . . 10.04   ;E

;Bmajadd11 chord on a guitar
i2 30 10 0 8.11     ;B
i2 30.1 . . 9.06    ;F# above
i2 30.2 . . 9.11    ;B octave above 1st one
i2 30.3 . . 10.03   ;D# next one up
i2 30.4 . . 9.11    ;B
i2 30.5 . . 10.04   ;E;

;Gmaj6 chord on a guitar
i2 37.5 10 0 8.07   ;G
i2 37.6 . . 9.02    ;D above
i2 37.7 . . 9.07    ;G octave above 1st one
i2 37.8 . . 9.11    ;B on G string
i2 37.9 . . 9.11    ;B
i2 38.0 . . 10.04   ;E

;F#7addB chord on a guitar
i1 45 10 0 9.06     ;F#
i1 45.1 . . 10.01   ;C# above
i1 45.2 . . 10.06   ;F# octave above 1st one
i1 45.3 . . 10.10   ;Bb next one up
i1 45.4 . . 10.11   ;B
i1 45.5 . . 11.04   ;E
e

</CsScore>
</CsoundSynthesizer>

<CsoundSynthesizer>
<CsOptions>
csound -RWfo Xanadu.wav temp.orc temp.sco
</CsOptions>
<CsInstruments>
sr          =           48000
kr          =           48000
ksmps       =           1
nchnls      =           2
;--------------------------------------------------------
;Instrument 1 : plucked strings chorused left/right and
;       pitch-shifted and delayed taps thru exponential
;       functions, and delayed.
;--------------------------------------------------------

            instr       1
ishift      =           .00666667               ;shift it 8/1200.
ipch        =           cpspch(p5)              ;convert parameter 5 to cps.
ioct        =           octpch(p5)              ;convert parameter 5 to oct.
kvib        oscil       1/120, ipch/50, 1       ;vibrato
ag          pluck       2000, cpsoct(ioct+kvib), 1000, 1, 1
agleft      pluck       2000, cpsoct(ioct+ishift), 1000, 1, 1
agright     pluck       2000, cpsoct(ioct-ishift), 1000, 1, 1
kf1         expon       .1, p3, 1.0             ;exponential from 0.1 to 1.0
kf2         expon       1.0, p3, .1             ;exponential from 1.0 to 0.1
adump       delayr      2.0                     ;set delay line of 2.0 sec
            delayw      ag                      ;put ag signal into delay line.
atap1       deltapi     kf1                     ;tap delay line with kf1 func.
atap2       deltapi     kf2                     ;tap delay line with kf2 func.
ad1         deltap      2.0                     ;delay 2 sec.
ad2         deltap      1.1                     ;delay 1.1 sec.
            outs        agleft+atap1+ad1, agright+atap2+ad2
            endin
;-------------------------------------------------------------
;Instrument 2 : plucked strings chorused left/right and
;       pitch-shifted with fixed delayed taps.
;------------------------------------------------------------

            instr       2
ishift      =           .00666667               ;shift it 8/1200.
ipch        =           cpspch(p5)              ;convert parameter 5 to cps.
ioct        =           octpch(p5)              ;convert parameter 5 to oct.
kvib        oscil       1/120, ipch/50, 1       ;vibrato
ag          pluck       1000, cpsoct(ioct+kvib), 1000, 1, 1
agleft      pluck       1000, cpsoct(ioct+ishift), 1000, 1, 1
agright     pluck       1000, cpsoct(ioct-ishift), 1000, 1, 1
adump       delayr      0.3                     ;set delay line of 0.3 sec
            delayw      ag                      ;put ag sign into del line.
ad1         deltap      0.1                     ;delay 100 msec.
ad2         deltap      0.2                     ;delay 200 msec.
            outs        agleft+ad1, agright+ad2
            endin
;-----------------------------------------------------------
;Instrument 3 : New FM algorithm, modified to produce large timbre
;               shifts using modulation of I and r. Detuned chorusing employed.
;-----------------------------------------------------------
            instr       3
ishift      =           .00666667               ;shift it 8/1200.
ipch        =           cpspch(p5)              ;convert parameter 5 to cps.
ioct        =           octpch(p5)              ;convert parameter 5 to oct.
kadsr       linseg      0, p3/3, 1.0, p3/3, 1.0, p3/3, 0 ;ADSR envelope
kmodi       linseg      0, p3/3, 5, p3/3, 3, p3/3, 0 ;ADSR envelope for I
kmodr       linseg      p6, p3, p7              ;r moves from p6->p7 in p3 sec.
a1          =           kmodi*(kmodr-1/kmodr)/2
a1ndx       =           abs(a1*2/20)            ;a1*2 is normalized from 0-1.
a2          =           kmodi*(kmodr+1/kmodr)/2
a3          tablei      a1ndx, 3, 1             ;lookup tbl in f3, normal index
ao1         oscil       a1, ipch, 2             ;cosine
a4          =           exp(-0.5*a3+ao1)
ao2         oscil       a2*ipch, ipch, 2        ;cosine
aoutl       oscil       1000*kadsr*a4, ao2+cpsoct(ioct+ishift), 1 ;fnl outleft
aoutr       oscil       1000*kadsr*a4, ao2+cpsoct(ioct-ishift), 1 ;fnl outright
            outs        aoutl, aoutr
            endin

</CsInstruments>
<CsScore>
;       Score for final project in Digital Audio Processing
;       ---------------------------------------------------

;           Piece entitled :  X A N A D U (short version)
;                           Joseph T. Kung, 12/12/88

;           The first part of the score will specify all function
;       tables used in the piece. The second part specifies
;       the instruments and notes. The latter is divided into
;       7 sections, each playing a chord on a different
;                 instrument.
;       The chords are uncommon guitar chords that use the open
;       B and E strings often. These will be transposed by
;       octaves on some chords.

;       Each instrument will play a chord for 15 seconds. The
;                 timbre
;       of the instrument will change in that interval and join
;       with the next instrument/chord sequence. Instrument 3
;       uses a modified FM synthesis technique. This is joined
;       by an additional plucked-string instrument
;       (instruments 1 and 2).

;   The Function Tables
;   -------------------
;All functions are post-normalized (max value is 1) if p4 is
;POSITIVE.

f1 0 8192 10 1      ;sine wave
f2 0 8192 11 1      ;cosine wave
f3 0 8192 -12 20.0  ;unscaled ln(I(x)) from 0 to 20.0

;-----------------------------------------------------------

;----- This section comprises all the new FM sounds -----------

;F#7addB chord on a guitar
i3 0 15 0 7.06 2.0 0.2  ;F#
i3 . . . 8.01 . .   ;C# above
i3 . . . 8.06 . .   ;F# octave above 1st one
i3 . . . 8.10 . .   ;Bb next one up
i3 . . . 8.11 . .   ;B
i3 . . . 9.04 . .   ;E

;D6add9 chord on a guitar
i3 7.5 15 0 6.02 1.7 0.5    ;D
i3 . . . 6.09 . .   ;A above
i3 . . . 7.02 . .   ;D octave above 1st one
i3 . . . 7.06 . .   ;F# next one up
i3 . . . 6.11 . .   ;B
i3 . . . 7.04 . .   ;E

;Bmajadd11 chord on a guitar
i3 15 15 0 7.11 1.4 0.8 ;B
i3 . . . 8.06 . .   ;F# above
i3 . . . 8.11 . .   ;B octave above 1st one
i3 . . . 9.03 . .   ;D# next one up
i3 . . . 8.11 . .   ;B
i3 . . . 9.04 . .   ;E;

;Amajadd9 chord on a guitar
i3 22.5 15 0 6.09 1.1 1.1   ;A
i3 . . . 7.04 . .   ;E above
i3 . . . 8.09 . .   ;A octave above 1st one
i3 . . . 8.01 . .   ;C# next one up
i3 . . . 7.11 . .   ;B
i3 . . . 8.04 . .   ;E

;Bmajadd11 chord on a guitar
i3 30 15 0 6.11 0.8 1.4 ;B
i3 . . . 7.06 . .   ;F# above
i3 . . . 7.11 . .   ;B octave above 1st one
i3 . . . 8.03 . .   ;D# next one up
i3 . . . 7.11 . .   ;B
i3 . . . 8.04 . .   ;E;

;Gmaj6 chord on a guitar
i3 37.5 15 0 5.07 0.5 1.7   ;G
i3 . . . 6.02 . .   ;D above
i3 . . . 6.07 . .   ;G octave above 1st one
i3 . . . 6.11 . .   ;B on G string
i3 . . . 6.11 . .   ;B
i3 . . . 7.04 . .   ;E

;F#7addB chord on a guitar
i3 45 15 0 7.06 0.2 2.0 ;F#
i3 . . . 8.01 . .   ;C# above
i3 . . . 8.06 . .   ;F# octave above 1st one
i3 . . . 8.10 . .   ;Bb next one up
i3 . . . 8.11 . .   ;B
i3 . . . 9.04 . .   ;E

; This section adds the plucked chords to the beginning of each
; section.

;F#7addB chord on a guitar
i1 0 10 0 8.06  ;F#
i1 0.1 . . 9.01 ;C# above
i1 0.2 . . 9.06 ;F# octave above 1st one
i1 0.3 . . 9.10 ;Bb next one up
i1 0.4 . . 9.11 ;B
i1 0.5 . . 10.04    ;E

;D6add9 chord on a guitar
i2 7.5 10 0 8.02    ;D
i2 7.6 . . 8.09     ;A above
i2 7.7 . . 9.02     ;D octave above 1st one
i2 7.8 . . 9.06     ;F# next one up
i2 7.9 . . 9.11     ;B
i2 8.0 . . 10.04    ;E

;Bmajadd11 chord on a guitar
i2 15 10 0 8.11     ;B
i2 15.1 . . 9.06    ;F# above
i2 15.2 . . 9.11    ;B octave above 1st one
i2 15.3 . . 10.03   ;D# next one up
i2 15.4 . . 9.11    ;B
i2 15.5 . . 10.04   ;E;

;Amajadd9 chord on a guitar
i2 22.5 10 0 8.09   ;A
i2 22.6 . . 9.04    ;E above
i2 22.7 . . 10.09   ;A octave above 1st one
i2 22.8 . . 10.01   ;C# next one up
i2 22.9 . . 9.11    ;B
i2 23.0 . . 10.04   ;E

;Bmajadd11 chord on a guitar
i2 30 10 0 8.11     ;B
i2 30.1 . . 9.06    ;F# above
i2 30.2 . . 9.11    ;B octave above 1st one
i2 30.3 . . 10.03   ;D# next one up
i2 30.4 . . 9.11    ;B
i2 30.5 . . 10.04   ;E;

;Gmaj6 chord on a guitar
i2 37.5 10 0 8.07   ;G
i2 37.6 . . 9.02    ;D above
i2 37.7 . . 9.07    ;G octave above 1st one
i2 37.8 . . 9.11    ;B on G string
i2 37.9 . . 9.11    ;B
i2 38.0 . . 10.04   ;E

;F#7addB chord on a guitar
i1 45 10 0 9.06     ;F#
i1 45.1 . . 10.01   ;C# above
i1 45.2 . . 10.06   ;F# octave above 1st one
i1 45.3 . . 10.10   ;Bb next one up
i1 45.4 . . 10.11   ;B
i1 45.5 . . 11.04   ;E
e

</CsScore>
</CsoundSynthesizer>


Removed because redundant.

Removed because redundant.

<CsoundSynthesizer>
<CsOptions>
--midi-key=4 --midi-velocity=5
</CsOptions>
<CsInstruments>

; Sample frames per second.

sr = 44100

; Sample frames per control period.

ksmps = 100

; Audio output channel.

nchnls = 1

; Output amplitudes will be normalized so 32767 is maximum.

0dbfs = 32767

; Allocate global sine wave table for oscillators.

giafno ftgen 1,          0,      65537,  10,     1

instr 1
			; Note duration is -1 for MIDI (note stays on till turned off), or else comes from the score.
                        mididefault             -1, p3
			; p4 is MIDI key translated to linear octaves, p5 is MIDI velocity, or else comes from the score.
                        midinoteonoct           p4, p5
			; Print pfield values.
                        print                   p2, p3, p4, p5
			; Simple sine wave instrument.
a1                      oscili                  ampdb(p5), cpsoct(p4), giafno
                        out                     a1
endin

</CsInstruments>
</CsoundSynthesizer>


no message

no message


Some tweaks

Some tweaks


adding csound PD class

adding csound PD class

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr=44100
kr=44.1
ksmps=1000
nchnls=2
/*
        FLpanel "This Panel contains a Knob and shows its current value",400,300
ih1     FLvalue "This is current value of output of the Knob", 100,20,50,20
gk1,gih  FLknob  "Current value of this Knob is shown in a text field", 80,5000,-1,1, ih1, 90, 150,100
        FLpanelEnd
        FLrun
*/
        instr 1
;        FLsetVal_i 440, gih
a1      oscili  3000, p4, 1
        outs     a1,a1
        endin
</CsInstruments>
<CsScore>
f1 0 1024 10 1
i1 0 2 440

</CsScore>
</CsoundSynthesizer>

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr=44100
kr=441
ksmps=100
nchnls=2

        FLpanel "This Panel contains a Knob and shows its current value",400,300
ih1     FLvalue "This is current value of output of the Knob", 100,20,50,20
gk1,gih  FLknob  "Current value of this Knob is shown in a text field", 80,5000,-1,1, ih1, 90, 150,100
        FLpanelEnd
        FLrun

        instr 1
        FLsetVal_i 440, gih
a1      oscili  3000, gk1, 1
        outs     a1,a1
        endin
</CsInstruments>
<CsScore>
f1 0 1024 10 1
i1 0 3600

</CsScore>
</CsoundSynthesizer>


made named instrument use name starting with 'i' to test that the token being read by the parser is forced into generic T_IDENT

<CsoundSynthesizer>

<CsInstruments>
sr=48000
ksmps=1
nchnls=2

giamp = 10000

		opcode testUDO, i, i
ipch	xin
print ipch
ipch 	= ipch * 2
		xout ipch
		endop

	instr itest	;untitled

iamp = giamp

ipch = p4

kenv	linseg 0, p3 * (.25 + .25), 1, p3 * .5 * 1, 0
kenv 	= kenv * iamp

ifreq	testUDO ipch

aout	vco2 kenv, ifreq

	outs aout, aout
	endin

</CsInstruments>

<CsScore>

i"itest"	0.0	1 440
i"itest"  + . 550
i"itest"  + . 660
i"itest"  + . 770
i"itest"  + . 880

e

</CsScore>

</CsoundSynthesizer>

<CsoundSynthesizer>

<CsInstruments>
sr=48000
ksmps=1
nchnls=2

giamp = 10000

		opcode testUDO, i, i
ipch	xin
print ipch
ipch 	= ipch * 2
		xout ipch
		endop

	instr test	;untitled

iamp = giamp

ipch = p4

kenv	linseg 0, p3 * (.25 + .25), 1, p3 * .5 * 1, 0
kenv 	= kenv * iamp

ifreq	testUDO ipch

aout	vco2 kenv, ifreq

	outs aout, aout
	endin

</CsInstruments>

<CsScore>

i"test"	0.0	1 440
i"test"  + . 550
i"test"  + . 660
i"test"  + . 770
i"test"  + . 880

e

</CsScore>

</CsoundSynthesizer>


Restored 1 and 2.

Restored 1 and 2.