no message

no message


*** empty log message ***

*** empty log message ***

<CsoundSynthesizer>
<CsOptions>
csound -m255 -M0 -+rtmidi=null -RWf --midi-key=4 --midi-velocity=5 -o jacko_test.wav
</CsOptions>
<CsInstruments>

; Unit tests for the Jack opcodes.
; To do:
; -- Python score generator and client runner.

sr    	   = 48000
ksmps 	   = 128
nchnls 	   = 2
0dbfs 	   = 1

	   JackoInit		"default", "csound"

	   ; To use ALSA midi ports, use "jackd -Xseq"
	   ; and use "jack_lsp -A -c" or aliases from JackInfo
	   ; to figure out the damn port names.

	   JackoMidiInConnect   "alsa_pcm:in-134-0-Master", "midiin"
	   JackoAudioInConnect 	"aeolus:out.L", "leftin"
	   JackoAudioInConnect 	"aeolus:out.R", "rightin"
	   JackoMidiOutConnect 	"midiout", "aeolus:Midi/in"

           ; Note that Jack enables audio to be output to a regular
 	   ; Csound soundfile and, at the same time, to a sound
	   ; card in real time to the system client via Jack.

       	   JackoAudioOutConnect "leftout", "system:playback_1"
	   JackoAudioOutConnect "rightout", "system:playback_2"
	   JackoInfo

	   ; Turning freewheeling on seems automatically
           ; to turn system playback off. This is good!

	   JackoFreewheel	1
	   JackoOn

	   alwayson		"jackin"

	   instr 1
	   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ichannel   =			p1 - 1
itime 	   = 			p2
iduration  = 			p3
ikey 	   = 			p4
ivelocity  = 			p5
	   JackoNoteOut 	"midiout", ichannel, ikey, ivelocity
	   print 		itime, iduration, ichannel, ikey, ivelocity
	   endin

	   instr jackin
	   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	   JackoTransport	3, 1.0
aleft 	   JackoAudioIn		"leftin"
aright 	   JackoAudioIn 	"rightin"

	   ; Aeolus uses MIDI controller 98 to control stops.
           ; Only 1 data value byte is used, not the 2 data
	   ; bytes often used  with NRPNs.
           ; The format for control mode is 01mm0ggg:
	   ; mm 10 to set stops, 0, ggg group (or Division, 0 based).
	   ; The format for stop selection is 000bbbbb:
	   ; bbbbb for button number (0 based).

	   ; Mode to enable stops for Divison I: b1100010 (98
           ; [this controller VALUE is a pure coincidence]).

	   JackoMidiOut          "midiout", 176, 0, 98, 98

	   ; Stops: Principal 8 (0), Principal 4 (1) , Flote 8 (8) , Flote 2 (10)

	   JackoMidiOut          "midiout", 176, 0, 98, 0
	   JackoMidiOut          "midiout", 176, 0, 98, 1
	   JackoMidiOut          "midiout", 176, 0, 98, 8
	   JackoMidiOut          "midiout", 176, 0, 98, 10

	   ; Sends audio coming in from Aeolus out
	   ; not only to the Jack system out (sound card),
	   ; but also to the output soundfile.
           ; Note that in freewheeling mode, "leftout"
           ; and "rightout" simply go silent.

 	   JackoAudioOut 	"leftout", aleft
	   JackoAudioOut 	"rightout", aright
	   outs  		aright, aleft
	   endin

</CsInstruments>
<CsScore>

i 1 1 30 60 60
i 1 2 30 64 60
i 1 3 30 71 60
e 2

</CsScore>
</CsoundSynthesizer>


fix tones

fix tones

<CsoundSynthesizer>
<CsOptions>
;;-+rtaudio=alsa
;;-odac
;; Android
-odac -d -m3
</CsOptions>
<CsInstruments>

/*
 * "Chord Improvisation" as posted to Soundcloud January 6 2014 by matthew skala
 * Gutted and android-ified by Abram Hindle 2016
 */

sr = 44100
ksmps = 32
nchnls = 1
0dbfs  = 1

/***** ANDROID ******/

gkslider1 init 0
gkslider2 init 0
gkslider3 init 0
gkslider4 init 0
gkslider5 init 0
gkbutt1 init 0
gkbutt2 init 0
gkbutt3 init 0
gkbutt4 init 0
gkbutt5 init 0
gktrackpadx init 0
gktrackpady init 0
gklasttrackpadx init 0
gklasttrackpady init 0
gkaccelerometerx init 0
gkaccelerometery init 0
gkaccelerometerz init 0

alwayson "Controls"

       instr Controls
gkslider1         chnget "slider1"
gkslider2         chnget "slider2"
gkslider3         chnget "slider3"
gkslider4         chnget "slider4"
gkslider5         chnget "slider5"
gkbutt1           chnget "butt1"
gkbutt2           chnget "butt2"
gkbutt3           chnget "butt3"
gkbutt4           chnget "butt4"
gkbutt5           chnget "butt5"
gktrackpadx       chnget "trackpad.x"
gktrackpady       chnget "trackpad.y"
gkaccelerometerx  chnget "accelerometerX"
gkaccelerometery  chnget "accelerometerY"
gkaccelerometerz  chnget "accelerometerZ"
        endin

gkfreq init 1000
gkamp init 1

gkamp1 init 1 ;; control the volume of instr 1
gkamp2 init 0 ;; control the volume of instr 2
gkamp3 init 0 ;; control the volume of instr 3
gkamp4 init 0 ;; control the volume of instr 4
gkamp5 init 0 ;; control the volume of instr 5

/**************************************************************************/

gisintbl = 1
girisetbl = 2
gisheptbl = 3
gisquaretbl = 4
gisawtbl = 5

gkinstr init 1
/**************************************************************************/

/* slider 1 - volume
   slider 2 - low pitch range 0 to 1000
   slider 3 - high pitch range 0 to 1000
*/

alwayson 1
alwayson 2
alwayson 3
alwayson 4
alwayson 5

/* Play Sine */
        instr 1
krange  = (gkslider3 - gkslider2)*gkfreq
kfreq   = gkslider2*gkfreq + gklasttrackpadx*krange
kenv    = gkslider1*gkamp1*gkamp
a1      oscili kenv,kfreq,gisintbl
        out a1
        endin

        instr 2
krange  = (gkslider3 - gkslider2)*gkfreq
kfreq   = gkslider2*gkfreq + gklasttrackpadx*krange
kenv    = gkslider1*gkamp2*gkamp
a1      oscili kenv,kfreq,girisetbl
        out a1
        endin

        instr 3
krange  = (gkslider3 - gkslider2)*gkfreq
kfreq   = gkslider2*gkfreq + gklasttrackpadx*krange
kenv    = gkslider1*gkamp3*gkamp
a1      oscili kenv,kfreq,gisheptbl
        out a1
        endin

        instr 4
krange  = (gkslider3 - gkslider2)*gkfreq
kfreq   = gkslider2*gkfreq + gklasttrackpadx*krange
kenv    = gkslider1*gkamp4*gkamp
a1      oscili kenv,kfreq,gisquaretbl
        out a1
        endin

        instr 5
krange  = (gkslider3 - gkslider2)*gkfreq
kfreq   = gkslider2*gkfreq + gklasttrackpadx*krange
kenv    = gkslider1*gkamp5*gkamp
a1      oscili kenv,kfreq,gisawtbl
        out a1
        endin

;; Code from: http://en.flossmanuals.net/csound/f-csound-on-android/

alwayson "VariablesForControls"

        instr VariablesForControls
        if (gktrackpady + gktrackpadx) > 0 then
            gklasttrackpadx = gktrackpadx
            gklasttrackpady = gktrackpady
        endif
kbutt1    trigger gkbutt1, .5, 0
        if kbutt1 > 0 then
           ;; trigger instr 1
           ;;   event "i", 1, 0.01, 5, gkfreq
           gkinstr = 1
           kbutt1 = 0
           gkamp1 = 1
           gkamp2 = 0
           gkamp3 = 0
           gkamp4 = 0
           gkamp5 = 0
        endif
kbutt2    trigger gkbutt2, .5, 0
        if kbutt2 > 0 then
           ;; trigger instr 2
           ;;   event "i", 2, 0.01, 5, gkfreq
           gkinstr = 2
           kbutt2 = 0
           gkamp1 = 0
           gkamp2 = 1
           gkamp3 = 0
           gkamp4 = 0
           gkamp5 = 0
        endif
kbutt3    trigger gkbutt3, .5, 0
        if kbutt3 > 0 then
           ;; trigger instr 3
           ;;   event "i", 3, 0.01, 5, gkfreq
           gkinstr = 3
           kbutt3 = 0
           gkamp1 = 0
           gkamp2 = 0
           gkamp3 = 1
           gkamp4 = 0
           gkamp5 = 0
        endif
kbutt4    trigger gkbutt4, .5, 0
        if kbutt4 > 0 then
           ;; trigger instr 4
           ;;   event "i", 4, 0.01, 5, gkfreq
           gkinstr = 4
           kbutt4 = 0
           gkamp1 = 0
           gkamp2 = 0
           gkamp3 = 0
           gkamp4 = 1
           gkamp5 = 0
        endif
kbutt5    trigger gkbutt5, .5, 0
        if kbutt5 > 0 then
           ;; trigger instr 5
           ;;   event "i", 5, 0.01, 5, gkfreq
           gkinstr = 5
           kbutt5 = 0
           gkamp1 = 0
           gkamp2 = 0
           gkamp3 = 0
           gkamp4 = 0
           gkamp5 = 1
        endif

endin

</CsInstruments>
<CsScore>
; plain old sine wave
f 1 0 4096 10   1

; sinusoidal rise shape for granular synthesis
f 2 0 1024 19   0.5 0.5 270 0.5

; Shepardesque tone:  octaves with exponential dropoff
f 3 0 4096 9    1 1 0        2 [1/2] 0     4 [1/4] 0   8 [1/8] 0  \
               16 [1/16] 0  32 [1/32] 0   64 [1/64] 0

; square wave (rise/fall limited a little)
f 4 0 1024 7   0 10 1 492 1 20 -1 492 -1 10 0

; nice sharp sawtooth
f 5 0 1024 7   -1 1024 1

t 0 80
f 0 33600
</CsScore>
</CsoundSynthesizer>

<CsoundSynthesizer>
<CsOptions>
;;-+rtaudio=alsa
;;-odac
;; Android
-odac -d -m3
</CsOptions>
<CsInstruments>

/*
 * "Chord Improvisation" as posted to Soundcloud January 6 2014 by matthew skala
 * Gutted and android-ified by Abram Hindle 2016
 */

sr = 44100
ksmps = 32
nchnls = 1
0dbfs  = 1

/***** ANDROID ******/

gkslider1 init 0
gkslider2 init 0
gkslider3 init 0
gkslider4 init 0
gkslider5 init 0
gkbutt1 init 0
gkbutt2 init 0
gkbutt3 init 0
gkbutt4 init 0
gkbutt5 init 0
gktrackpadx init 0
gktrackpady init 0
gklasttrackpadx init 0
gklasttrackpady init 0
gkaccelerometerx init 0
gkaccelerometery init 0
gkaccelerometerz init 0

alwayson "Controls"

       instr Controls
gkslider1         chnget "slider1"
gkslider2         chnget "slider2"
gkslider3         chnget "slider3"
gkslider4         chnget "slider4"
gkslider5         chnget "slider5"
gkbutt1           chnget "butt1"
gkbutt2           chnget "butt2"
gkbutt3           chnget "butt3"
gkbutt4           chnget "butt4"
gkbutt5           chnget "butt5"
gktrackpadx       chnget "trackpad.x"
gktrackpady       chnget "trackpad.y"
gkaccelerometerx  chnget "accelerometerX"
gkaccelerometery  chnget "accelerometerY"
gkaccelerometerz  chnget "accelerometerZ"
        endin

gkfreq init 1000
gkamp init 1

gkamp1 init 1 ;; control the volume of instr 1
gkamp2 init 0 ;; control the volume of instr 2
gkamp3 init 0 ;; control the volume of instr 3
gkamp4 init 0 ;; control the volume of instr 4
gkamp5 init 0 ;; control the volume of instr 5

/**************************************************************************/

gisintbl = 1
girisetbl = 2
gisheptbl = 3
gisquaretbl = 4
gisawtbl = 5

gkinstr init 1
/**************************************************************************/

/* slider 1 - volume
   slider 2 - low pitch range 0 to 1000
   slider 3 - high pitch range 0 to 1000
*/

alwayson 1
alwayson 2
alwayson 3
alwayson 4
alwayson 5

/* Play Sine */
        instr 1
krange  = (gkslider3 - gkslider2)*gkfreq
kfreq   = gkslider2*gkfreq + gklasttrackpadx*krange
kenv    = gkslider1*gkamp1*gkamp
a1      oscili kenv,kfreq,gisintbl
        out a1
        endin

        instr 2
krange  = (gkslider3 - gkslider2)*gkfreq
kfreq   = gkslider2*gkfreq + gklasttrackpadx*krange
kenv    = gkslider1*gkamp2*gkamp
a1      oscili kenv,kfreq,girisetbl
        out a1
        endin

        instr 3
krange  = (gkslider3 - gkslider2)*gkfreq
kfreq   = gkslider2*gkfreq + gklasttrackpadx*krange
kenv    = gkslider1*gkamp3*gkamp
a1      oscili kenv,kfreq,gisheptbl
        out a1
        endin

        instr 4
krange  = (gkslider3 - gkslider2)*gkfreq
kfreq   = gkslider2*gkfreq + gklasttrackpadx*krange
kenv    = gkslider1*gkamp4*gkamp
a1      oscili kenv,kfreq,gisquaretbl
        out a1
        endin

        instr 5
krange  = (gkslider3 - gkslider2)*gkfreq
kfreq   = gkslider2*gkfreq + gklasttrackpadx*krange
kenv    = gkslider1*gkamp5*gkamp
a1      oscili kenv,kfreq,gisawtbl
        out a1
        endin

;; Code from: http://en.flossmanuals.net/csound/f-csound-on-android/

alwayson "VariablesForControls"

        instr VariablesForControls
        if (gktrackpady + gktrackpadx) > 0 then
            gklasttrackpadx = gktrackpadx
            gklasttrackpady = gktrackpady
        endif
kbutt1    trigger gkbutt1, .5, 0
        if kbutt1 > 0 then
           ;; trigger instr 1
           ;;   event "i", 1, 0.01, 5, gkfreq
           gkinstr = 1
           kbutt1 = 0
           gkamp1 = (1 + gkamp1) % 2
        endif
kbutt2    trigger gkbutt2, .5, 0
        if kbutt2 > 0 then
           ;; trigger instr 2
           ;;   event "i", 2, 0.01, 5, gkfreq
           gkinstr = 2
           kbutt2 = 0
           gkamp2 = (1 + gkamp2) % 2
        endif
kbutt3    trigger gkbutt3, .5, 0
        if kbutt3 > 0 then
           ;; trigger instr 3
           ;;   event "i", 3, 0.01, 5, gkfreq
           gkinstr = 3
           kbutt3 = 0
           gkamp3 = (1 + gkamp3) % 2
        endif
kbutt4    trigger gkbutt4, .5, 0
        if kbutt4 > 0 then
           ;; trigger instr 4
           ;;   event "i", 4, 0.01, 5, gkfreq
           gkinstr = 4
           kbutt4 = 0
           gkamp4 = (1 + gkamp4) % 2
        endif
kbutt5    trigger gkbutt5, .5, 0
        if kbutt5 > 0 then
           ;; trigger instr 5
           ;;   event "i", 5, 0.01, 5, gkfreq
           gkinstr = 5
           kbutt5 = 0
           gkamp5 = (1 + gkamp5) % 2
        endif

endin

</CsInstruments>
<CsScore>
; plain old sine wave
f 1 0 4096 10   1

; sinusoidal rise shape for granular synthesis
f 2 0 1024 19   0.5 0.5 270 0.5

; Shepardesque tone:  octaves with exponential dropoff
f 3 0 4096 9    1 1 0        2 [1/2] 0     4 [1/4] 0   8 [1/8] 0  \
               16 [1/16] 0  32 [1/32] 0   64 [1/64] 0

; square wave (rise/fall limited a little)
f 4 0 1024 7   0 10 1 492 1 20 -1 492 -1 10 0

; nice sharp sawtooth
f 5 0 1024 7   -1 1024 1

t 0 80
f 0 33600
</CsScore>
</CsoundSynthesizer>


No comment.

No comment.

<CsoundSynthesizer>
<CsOptions>
-d -R -W -Z -f -o xanadu-high.wav
</CsOptions>
<CsInstruments>
sr          =           88200
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        poscil      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
adamping    linsegr     0.0, 0.006, 1.0, p3 - 0.066, 1.0, 0.06, 0.0
ag          =           adamping * ag
agleft      =           adamping * agleft
agright     =           adamping * agright
af1         expon       .1, p3, 1.0             ;exponential from 0.1 to 1.0
af2         expon       1.0, p3, .1             ;exponential from 1.0 to 0.1
adump       delayr      2.0                     ;set delay line of 2.0 sec
atap1       deltap3     af1                     ;tap delay line with kf1 func.
atap2       deltap3     af2                     ;tap delay line with kf2 func.
ad1         deltap3     2.0                     ;delay 2 sec.
ad2         deltap3     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        poscil      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
adamping    linsegr     0.0, 0.006, 1.0, p3 - 0.066, 1.0, 0.06, 0.0
ag          =           adamping * ag
agleft      =           adamping * agleft
agright     =           adamping * agright
adump       delayr      0.3                     ;set delay line of 0.3 sec
ad1         deltap3     0.1                     ;delay 100 msec.
ad2         deltap3     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.
aadsr       linsegr     0, p3/3, 1.0, p3/3, 1.0, p3/3, 0 ;ADSR envelope
amodi       linseg      0, p3/3, 5, p3/3, 3, p3/3, 0 ;ADSR envelope for I
amodr       linseg      p6, p3, p7              ;r moves from p6->p7 in p3 sec.
a1          =           amodi*(amodr-1/amodr)/2
a1ndx       =           abs(a1*2/20)            ;a1*2 is normalized from 0-1.
a2          =           amodi*(amodr+1/amodr)/2
a3          tablei      a1ndx, 3, 1             ;lookup tbl in f3, normal index
ao1         poscil      a1, ipch, 2             ;cosine
a4          =           exp(-0.5*a3+ao1)
ao2         poscil      a2*ipch, ipch, 2        ;cosine
aoutl       poscil      1000*aadsr*a4, ao2+cpsoct(ioct+ishift), 1 ;fnl outleft
aoutr       poscil      1000*aadsr*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
;            Instruments modified for higher precision
;                         Michael Gogins, 07/22/2006

;           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 65537  10 1      ;sine wave
f2 0 65537  11 1      ;cosine wave
f3 0 65537 -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 -d -R -W -Z -f -o xanadu-high-resolution.wav
</CsOptions>
<CsInstruments>
sr          =           88200
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        poscil      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
adamping    linsegr     0.0, 0.006, 1.0, p3 - 0.066, 1.0, 0.06, 0.0
ag          =           adamping * ag
agleft      =           adamping * agleft
agright     =           adamping * agright
af1         expon       .1, p3, 1.0             ;exponential from 0.1 to 1.0
af2         expon       1.0, p3, .1             ;exponential from 1.0 to 0.1
adump       delayr      2.0                     ;set delay line of 2.0 sec
atap1       deltap3     af1                     ;tap delay line with kf1 func.
atap2       deltap3     af2                     ;tap delay line with kf2 func.
ad1         deltap3     2.0                     ;delay 2 sec.
ad2         deltap3     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        poscil      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
adamping    linsegr     0.0, 0.006, 1.0, p3 - 0.066, 1.0, 0.06, 0.0
ag          =           adamping * ag
agleft      =           adamping * agleft
agright     =           adamping * agright
adump       delayr      0.3                     ;set delay line of 0.3 sec
ad1         deltap3     0.1                     ;delay 100 msec.
ad2         deltap3     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.
aadsr       linsegr     0, p3/3, 1.0, p3/3, 1.0, p3/3, 0 ;ADSR envelope
amodi       linseg      0, p3/3, 5, p3/3, 3, p3/3, 0 ;ADSR envelope for I
amodr       linseg      p6, p3, p7              ;r moves from p6->p7 in p3 sec.
a1          =           amodi*(amodr-1/amodr)/2
a1ndx       =           abs(a1*2/20)            ;a1*2 is normalized from 0-1.
a2          =           amodi*(amodr+1/amodr)/2
a3          tablei      a1ndx, 3, 1             ;lookup tbl in f3, normal index
ao1         poscil      a1, ipch, 2             ;cosine
a4          =           exp(-0.5*a3+ao1)
ao2         poscil      a2*ipch, ipch, 2        ;cosine
aoutl       poscil      1000*aadsr*a4, ao2+cpsoct(ioct+ishift), 1 ;fnl outleft
aoutr       poscil      1000*aadsr*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
;            Instruments modified for higher precision
;                         Michael Gogins, 07/22/2006

;           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 65537  10 1      ;sine wave
f2 0 65537  11 1      ;cosine wave
f3 0 65537 -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>


Fixed overflow due to very long performance (2^31 or more control periods)

<CsoundSynthesizer>
<CsOptions>
</CsOptions>

<CsInstruments>

sr= 44100
kr = 4410
ksmps = 10
nchnls= 4

instr 1
kfreq invalue "freq"
kamp  invalue "amp"
a0    = 0
asyn  oscili p4*kamp, p5*kfreq, 1
        outq asyn*0.7, asyn*0.3,a0,a0
endin

instr 2

as1,as2,as3,as4 inq
krvt  invalue "rev"
klt   invalue "del"
kfm   invalue "modf"
kmod  phasor kfm
adel upsamp klt
a0  = 0
acmb flanger  as4, adel, krvt
      outvalue "mod",  kmod
        outs a0,a0,acmb*0.3, acmb*0.7
endin

</CsInstruments>

<CsScore>
f0 450000
f1 0 4096 10 1
i2 0 450000
</CsScore>

</CsoundSynthesizer>

<CsoundSynthesizer>
<CsOptions>
</CsOptions>

<CsInstruments>

sr= 44100
kr = 4410
ksmps = 10
nchnls= 4

instr 1
kfreq invalue "freq"
kamp  invalue "amp"
a0    = 0
asyn  oscili p4*kamp, p5*kfreq, 1
        outq asyn*0.7, asyn*0.3,a0,a0
endin

instr 2

as1,as2,as3,as4 inq
krvt  invalue "rev"
klt   invalue "del"
kfm   invalue "modf"
kmod  phasor kfm
adel upsamp klt
a0  = 0
acmb flanger  as4, adel, krvt
      outvalue "mod",  kmod
        outs a0,a0,acmb*0.3, acmb*0.7
endin

</CsInstruments>

<CsScore>
f0 36000000
f1 0 4096 10 1
i2 0 36000
</CsScore>

</CsoundSynthesizer>