diff options
author | Felipe Sateler <fsateler@gmail.com> | 2008-03-24 16:39:11 -0300 |
---|---|---|
committer | Felipe Sateler <fsateler@gmail.com> | 2008-03-24 16:39:11 -0300 |
commit | 2af72543872544f18b7e3812cb64d9fe5886c47b (patch) | |
tree | e35d9468794be891222d3ddc05e46e2810add952 /examples |
Imported Upstream version 5.08
Diffstat (limited to 'examples')
546 files changed, 26691 insertions, 0 deletions
diff --git a/examples/01hpschd.sf2 b/examples/01hpschd.sf2 Binary files differnew file mode 100644 index 0000000..8a409d4 --- /dev/null +++ b/examples/01hpschd.sf2 diff --git a/examples/07AcousticGuitar.sf2 b/examples/07AcousticGuitar.sf2 Binary files differnew file mode 100755 index 0000000..5f11973 --- /dev/null +++ b/examples/07AcousticGuitar.sf2 diff --git a/examples/0dbfs-1.csd b/examples/0dbfs-1.csd new file mode 100644 index 0000000..6677998 --- /dev/null +++ b/examples/0dbfs-1.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o 0dbfs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Set the 0dbfs to 1. +0dbfs = 1 + +; Instrument #1. +instr 1 + ; Linearly increase the amplitude value "kamp" from + ; -90 to p4 (in dBfs) over the duration defined by p3. + kamp line -90, p3, p4 + print ampdbfs(p4) + ; Generate a basic tone using our amplitude value. +a1 oscil ampdbfs(kamp), 440, 1 + + ; Since 0dbfs = 1 we don't need to multiply the output + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for three seconds. +i 1 0 3 -6 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/0dbfs.csd b/examples/0dbfs.csd new file mode 100644 index 0000000..e39b32d --- /dev/null +++ b/examples/0dbfs.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o 0dbfs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Set the 0dbfs to the 16-bit maximum. +0dbfs = 32767 + +; Instrument #1. +instr 1 + ; Linearly increase the amplitude value "kamp" from + ; 0 to 1 over the duration defined by p3. + kamp line 0, p3, 1 + + ; Generate a basic tone using our amplitude value. + a1 oscil kamp, 440, 1 + + ; Multiply the basic tone (with its amplitude between + ; 0 and 1) by the full-scale 0dbfs value. + out a1 * 0dbfs +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/19Trumpet.sf2 b/examples/19Trumpet.sf2 Binary files differnew file mode 100755 index 0000000..26ce4ea --- /dev/null +++ b/examples/19Trumpet.sf2 diff --git a/examples/22Bassoon.sf2 b/examples/22Bassoon.sf2 Binary files differnew file mode 100755 index 0000000..de744e1 --- /dev/null +++ b/examples/22Bassoon.sf2 diff --git a/examples/FLbox.csd b/examples/FLbox.csd new file mode 100644 index 0000000..403969f --- /dev/null +++ b/examples/FLbox.csd @@ -0,0 +1,53 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLbox.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +FLpanel "Text Box", 700, 400, 50, 50 + ; Box border type (7=embossed box) + itype = 7 + ; Font type (10='Times Bold') + ifont = 10 + ; Font size + isize = 20 + ; Width of the flbox + iwidth = 400 + ; Height of the flbox + iheight = 30 + ; Distance of the left edge of the flbox + ; from the left edge of the panel + ix = 150 + ; Distance of the upper edge of the flbox + ; from the upper edge of the panel + iy = 100 + + ih3 FLbox "Use Text Boxes For Labelling", itype, ifont, isize, iwidth, iheight, ix, iy +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +instr 1 +endin + + +</CsInstruments> +<CsScore> + +; Real-time performance for 1 hour. +f 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLbutBank.csd b/examples/FLbutBank.csd new file mode 100644 index 0000000..08aca55 --- /dev/null +++ b/examples/FLbutBank.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLbutton.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +nchnls = 1 + +FLpanel "Button Bank", 520, 140, 100, 100 + ;itype = 2 ;Light Buttons + itype = 22 ;Plastic Light Buttons + inumx = 10 + inumy = 4 + iwidth = 500 + iheight = 120 + ix = 10 + iy = 10 + iopcode = 0 + istarttim = 0 + idur = 1 + + gkbutton, ihbb FLbutBank itype, inumx, inumy, iwidth, iheight, ix, iy, iopcode, 1, istarttim, idur + +FLpanelEnd +FLrun + +instr 1 + ibutton = i(gkbutton) + prints "Button %i pushed!\\n", ibutton +endin + +</CsInstruments> +<CsScore> + +; Real-time performance for 1 hour. +f 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLbutton.csd b/examples/FLbutton.csd new file mode 100644 index 0000000..1cfad6d --- /dev/null +++ b/examples/FLbutton.csd @@ -0,0 +1,82 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLbutton.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Using FLbuttons to create on screen controls for play, +; stop, fast forward and fast rewind of a sound file +; This example also makes use of a preset graphic for buttons. + +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 2 + +FLpanel "Buttons", 240, 400, 100, 100 + ion = 0 + ioff = 0 + itype = 1 + iwidth = 50 + iheight = 50 + ix = 10 + iy = 10 + iopcode = 0 + istarttim = 0 + idur = -1 ;Turn instruments on idefinitely + + ; Normal speed forwards + gkplay, ihb1 FLbutton "@>", ion, ioff, itype, iwidth, iheight, ix, iy, iopcode, 1, istarttim, idur, 1 + ; Stationary + gkstop, ihb2 FLbutton "@square", ion,ioff, itype, iwidth, iheight, ix+55, iy, iopcode, 2, istarttim, idur + ; Double speed backwards + gkrew, ihb3 FLbutton "@<<", ion, ioff, itype, iwidth, iheight, ix + 110, iy, iopcode, 1, istarttim, idur, -2 + ; Double speed forward + gkff, ihb4 FLbutton "@>>", ion, ioff, itype, iwidth, iheight, ix+165, iy, iopcode, 1, istarttim, idur, 2 + ; Type 1 + gkt1, iht1 FLbutton "1-Normal Button", ion, ioff, 1, 200, 40, ix, iy + 65, -1 + ; Type 2 + gkt2, iht2 FLbutton "2-Light Button", ion, ioff, 2, 200, 40, ix, iy + 110, -1 + ; Type 3 + gkt3, iht3 FLbutton "3-Check Button", ion, ioff, 3, 200, 40, ix, iy + 155, -1 + ; Type 4 + gkt4, iht4 FLbutton "4-Round Button", ion, ioff, 4, 200, 40, ix, iy + 200, -1 + ; Type 21 + gkt5, iht5 FLbutton "21-Plastic Button", ion, ioff, 21, 200, 40, ix, iy + 245, -1 + ; Type 22 + gkt6, iht6 FLbutton "22-Plastic Light Button", ion, ioff, 22, 200, 40, ix, iy + 290, -1 + ; Type 23 + gkt7, iht7 FLbutton "23-Plastic Check Button", ion, ioff, 23, 200, 40, ix, iy + 335, -1 +FLpanelEnd +FLrun + +; Ensure that only 1 instance of instr 1 +; plays even if the play button is clicked repeatedly +insnum = 1 +icount = 1 +maxalloc insnum, icount + +instr 1 + asig diskin "beats.wav", p4, 0, 1 + outs asig, asig +endin + +instr 2 + turnoff2 1, 0, 0 ;Turn off instr 1 + turnoff ;Turn off this instrument +endin + +</CsInstruments> +<CsScore> + +; Real-time performance for 1 hour. +f 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLcount.csd b/examples/FLcount.csd new file mode 100644 index 0000000..f609df9 --- /dev/null +++ b/examples/FLcount.csd @@ -0,0 +1,72 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLcount.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Demonstration of the flcount opcode +; clicking on the single arrow buttons +; increments the oscillator in semitone steps +; clicking on the double arrow buttons +; increments the oscillator in octave steps +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +FLpanel "Counter", 900, 400, 50, 50 + ; Minimum value output by counter + imin = 6 + ; Maximum value output by counter + imax = 12 + ; Single arrow step size (semitones) + istep1 = 1/12 + ; Double arrow step size (octave) + istep2 = 1 + ; Counter type (1=double arrow counter) + itype = 1 + ; Width of the counter in pixels + iwidth = 200 + ; Height of the counter in pixels + iheight = 30 + ; Distance of the left edge of the counter + ; from the left edge of the panel + ix = 50 + ; Distance of the top edge of the counter + ; from the top edge of the panel + iy = 50 + ; Score event type (-1=ignored) + iopcode = -1 + + gkoct, ihandle FLcount "pitch in oct format", imin, imax, istep1, istep2, itype, iwidth, iheight, ix, iy, iopcode, 1, 0, 1 +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +instr 1 + iamp = 15000 + ifn = 1 + asig oscili iamp, cpsoct(gkoct), ifn + out asig +endin + + +</CsInstruments> +<CsScore> + +; Function table that defines a single cycle +; of a sine wave. +f 1 0 1024 10 1 + +; Instrument 1 will play a note for 1 hour. +i 1 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLexecButton.csd b/examples/FLexecButton.csd new file mode 100644 index 0000000..9f19d08 --- /dev/null +++ b/examples/FLexecButton.csd @@ -0,0 +1,120 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No display +-odac -iadc -d ;;;RT audio I/O +</CsOptions> + +<CsInstruments> + + sr = 44100 + ksmps = 10 + nchnls = 1 + +; Example by Jonathan Murphy 2007 + +;;; reset amplitude range + 0dbfs = 1 + +;;; set the base colour for the panel + FLcolor 100, 0, 200 +;;; define the panel + FLpanel "FLexecButton", 250, 100, 0, 0 +;;; sliders to control time stretch and pitch + gkstr, gistretch FLslider "Time", 0.5, 1.5, 0, 6, -1, 10, 60, 150, 20 + gkpch, gipitch FLslider "Pitch", 0.5, 1.5, 0, 6, -1, 10, 60, 200, 20 +;;; set FLexecButton colour + FLcolor 255, 255, 0 +;;; when this button is pressed, fourier analysis is performed on the file +;;; "beats.wav", producing the analysis file "beats.pvx" + gipvoc FLexecButton "csound -U pvanal beats.wav beats.pvx", 60, 20, 20, 20 +;;; set FLexecButton text + FLsetText "PVOC", gipvoc +;;; when this button is pressed, instr 10000 is called, exiting +;;; Csound immediately + +;;; cancel previous colour + FLcolor -1 +;;; set colour for kill button + FLcolor 255, 0, 0 + gkkill, gikill FLbutton "X", 1, 1, 1, 20, 20, 100, 20, 0, 10000, 0, 0.1 +;;; cancel previous colour + FLcolor -1 +;;; set colour for play/stop and pause buttons + FLcolor 0, 200, 0 +;;; pause and play/stop buttons + gkpause, gipause FLbutton "@||", 1, 0, 2, 40, 20, 20, 60, -1 + gkplay, giplay FLbutton "@|>", 1, 0, 2, 40, 20, 80, 60, -1 +;;; end the panel + FLpanelEnd +;;; set initial values for time stretch and pitch + FLsetVal_i 1, gistretch + FLsetVal_i 1, gipitch +;;; run the panel + FLrun + + + instr 1 ; trigger play/stop +;;; is the play/stop button on or off? +;;; either way we need to trigger something, +;;; so we can't just use the value of gkplay + kon trigger gkplay, 0, 0 + koff trigger gkplay, 1, 1 +;;; if on, start instr 2 + schedkwhen kon, -1, -1, 2, 0, -1 +;;; if off, stop instr 2 + schedkwhen koff, -1, -1, -2, 0, -1 + + endin + + instr 2 + +;;; paused or playing? +if (gkpause == 1) kgoto pause + kgoto start +pause: +;;; if the pause button is on, skip sound production + kgoto end +start: +;;; get the length of the analysis file in seconds + ilen filelen "beats.pvx" +;;; determine base frequency of playback + icps = 1/ilen +;;; create a table over the length of the file + itpt ftgen 0, 0, 513, -7, 0, 512, ilen +;;; phasor for time control + kphs phasor icps * gkstr +;;; use phasor as index into table + kndx = kphs * 512 +;;; read table + ktpt tablei kndx, itpt +;;; use value from table as time pointer into file + fsig1 pvsfread ktpt, "beats.pvx" +;;; change playback pitch + fsig2 pvscale fsig1, gkpch +;;; resynthesize + aout pvsynth fsig2 +;;; envelope to avoid clicks and clipping + aenv linsegr 0, 0.3, 0.75, 0.1, 0 + aout = aout * aenv + out aout +end: + + endin + + + instr 10000 ; kill + + exitnow + + endin + +</CsInstruments> + +<CsScore> +i1 0 10000 +e +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/FLhvsBox.csd b/examples/FLhvsBox.csd new file mode 100644 index 0000000..cbd5999 --- /dev/null +++ b/examples/FLhvsBox.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + +;Example by Andres Cabrera 2007 + +inumlinesX = 3 +inumlinesY = 3 +iwidth = 200 +iheight = 200 +ix = 20 +iy = 20 + +FLpanel "FLhvsBox", 400, 240, -1, -1, 5, 1, 1 +ihandle FLhvsBox inumlinesX, inumlinesY, iwidth, iheight, ix, iy ; [, image] +FLpanelEnd + +FLrun + +0dbfs = 1 + +instr 1 + +endin + +</CsInstruments> +<CsScore> +i 1 0 120 +e + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/FLjoy.csd b/examples/FLjoy.csd new file mode 100644 index 0000000..a781cd5 --- /dev/null +++ b/examples/FLjoy.csd @@ -0,0 +1,73 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLjoy.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Demonstration of the flpanel opcode +; Horizontal click-dragging controls the frequency of the oscillator +; Vertical click-dragging controls the amplitude of the oscillator +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +FLpanel "X Y Panel", 900, 400, 50, 50 + ; Minimum value output by x movement (frequency) + iminx = 200 + ; Maximum value output by x movement (frequency) + imaxx = 5000 + ; Minimum value output by y movement (amplitude) + iminy = 0 + ; Maximum value output by y movement (amplitude) + imaxy = 15000 + ; Logarithmic change in x direction + iexpx = -1 + ; Linear change in y direction + iexpy = 0 + ; Display handle x direction (-1=not used) + idispx = -1 + ; Display handle y direction (-1=not used) + idispy = -1 + ; Width of the x y panel in pixels + iwidth = 800 + ; Height of the x y panel in pixels + iheight = 300 + ; Distance of the left edge of the x y panel from + ; the left edge of the panel + ix = 50 + ; Distance of the top edge of the x y + ; panel from the top edge of the panel + iy = 50 + + gkfreqx, gkampy, ihandlex, ihandley FLjoy "X - Frequency Y - Amplitude", iminx, imaxx, iminy, imaxy, iexpx, iexpy, idispx, idispy, iwidth, iheight, ix, iy +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +instr 1 + ifn = 1 + asig oscili gkampy, gkfreqx, ifn + out asig +endin + + +</CsInstruments> +<CsScore> + +; Function table that defines a single cycle +; of a sine wave. +f 1 0 1024 10 1 + +; Instrument 1 will play a note for 1 hour. +i 1 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLkeyIn.csd b/examples/FLkeyIn.csd new file mode 100644 index 0000000..2920721 --- /dev/null +++ b/examples/FLkeyIn.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + +;Example by Andres Cabrera 2007 + +FLpanel "FLkeyIn", 400, 300, -1, -1, 5, 1, 1 +FLpanelEnd + +FLrun + +0dbfs = 1 + +instr 1 +kascii FLkeyIn +ktrig changed kascii +if (kascii > 0) then + printf "Key Down: %i\n", ktrig, kascii +else + printf "Key Up: %i\n", ktrig, -kascii +endif +endin + +</CsInstruments> +<CsScore> +i 1 0 120 +e + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/FLknob-2.csd b/examples/FLknob-2.csd new file mode 100644 index 0000000..16e17b9 --- /dev/null +++ b/examples/FLknob-2.csd @@ -0,0 +1,72 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLknob.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +;By Andres Cabrera 2007 +FLpanel "Knob Types", 330, 230, 50, 50 + ; Distance of the left edge of the knob + ; from the left edge of the panel + ix = 20 + ; Distance of the top edge of the knob + ; from the top of the panel + iy = 20 + + ;Create boxes that display a widget's value + ihandleA FLvalue "A", 60, 20, ix + 130, iy + 110 + ihandleB FLvalue "B", 60, 20, ix + 220, iy + 110 + ihandleC FLvalue "C", 60, 20, ix + 130, iy + 160 + ihandleD FLvalue "D", 60, 20, ix + 220, iy + 160 + + ; The foru types of FLknobs + gkdummy1, ihandle1 FLknob "Type 1", 200, 5000, -1, 1, ihandleA, 70, ix, iy, 90 + gkdummy2, ihandle2 FLknob "Type 2", 200, 5000, -1, 2, ihandleB, 70, ix + 100, iy + gkdummy3, ihandle3 FLknob "Type 3", 200, 5000, -1, 3, ihandleC, 70, ix + 200, iy + gkdummy4, ihandle4 FLknob "Type 4", 200, 5000, -1, 4, ihandleD, 70, ix , iy + 100 +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +; Set the color of widgets +FLsetColor 20, 23, 100, ihandle1 +FLsetColor 0, 123, 100, ihandle2 +FLsetColor 180, 23, 12, ihandle3 +FLsetColor 10, 230, 0, ihandle4 + +FLsetColor2 200, 230, 0, ihandle1 +FLsetColor2 200,0 ,123 , ihandle2 +FLsetColor2 180, 180, 100, ihandle3 +FLsetColor2 180, 23, 12, ihandle4 + + +; Set the initial value of the widget +FLsetVal_i 300, ihandle1 +FLsetVal_i 1000, ihandle2 + + +instr 1 +; Nothing here for now +endin + + +</CsInstruments> +<CsScore> + +f 0 3600 ;Dumy table to make csound wait for realtime events + +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLknob.csd b/examples/FLknob.csd new file mode 100644 index 0000000..de3bf79 --- /dev/null +++ b/examples/FLknob.csd @@ -0,0 +1,67 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLknob.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; A sine with oscillator with flknob controlled frequency +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +FLpanel "Frequency Knob", 900, 400, 50, 50 + ; Minimum value output by the knob + imin = 200 + ; Maximum value output by the knob + imax = 5000 + ; Logarithmic type knob selected + iexp = -1 + ; Knob graphic type (1=3D knob) + itype = 1 + ; Display handle (-1=not used) + idisp = -1 + ; Width of the knob in pixels + iwidth = 70 + ; Distance of the left edge of the knob + ; from the left edge of the panel + ix = 70 + ; Distance of the top edge of the knob + ; from the top of the panel + iy = 125 + + gkfreq, ihandle FLknob "Frequency", imin, imax, iexp, itype, idisp, iwidth, ix, iy +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +; Set the widget's initial value +FLsetVal_i 300, ihandle + +instr 1 + iamp = 15000 + ifn = 1 + asig oscili iamp, gkfreq, ifn + out asig +endin + + +</CsInstruments> +<CsScore> + +; Function table that defines a single cycle +; of a sine wave. +f 1 0 1024 10 1 + +; Instrument 1 will play a note for 1 hour. +i 1 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLmouse.csd b/examples/FLmouse.csd new file mode 100644 index 0000000..4c0ba0f --- /dev/null +++ b/examples/FLmouse.csd @@ -0,0 +1,44 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + +;Example by Andres Cabrera 2007 +giwidth = 400 +giheight = 300 +FLpanel "FLmouse", giwidth, giheight, 10, 10 +FLpanelEnd + +FLrun + +0dbfs = 1 + +instr 1 + kx, ky, kb1, kb2, kb3 FLmouse 2 + ktrig changed kx, ky ;Print only if coordinates have changed + printf "kx = %f ky = %f \n", ktrig, kx, ky +kfreq = ((giwidth - ky)*1000/giwidth) + 300 + +; y coordinate determines frequency, x coordinate determines amplitude +; Left mouse button (kb1) doubles the frequency +; Right mouse button (kb3) activates sound on channel 2 + aout oscil kx /giwidth , kfreq * (kb1 + 1), 1 + outs aout, aout * kb3 +endin + +</CsInstruments> +<CsScore> +f 1 0 1024 10 1 + +i 1 0 120 +e + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/FLpanel-sensekey.csd b/examples/FLpanel-sensekey.csd new file mode 100644 index 0000000..484264e --- /dev/null +++ b/examples/FLpanel-sensekey.csd @@ -0,0 +1,42 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLpanel-sensekey.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> +; Example by Johnathan Murphy + + sr = 44100 + ksmps = 128 + nchnls = 2 + + + ; ikbdcapture flag set to 1 + ikey init 1 + + FLpanel "sensekey", 740, 340, 100, 250, 2, ikey + gkasc, giasc FLbutBank 2, 16, 8, 700, 300, 20, 20, -1 + FLpanelEnd + FLrun + + instr 1 + + kkey sensekey + kprint changed kkey + FLsetVal kprint, kkey, giasc + + endin + +</CsInstruments> + +<CsScore> +i1 0 60 +e +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/FLpanel-sensekey2.csd b/examples/FLpanel-sensekey2.csd new file mode 100644 index 0000000..83f4c2b --- /dev/null +++ b/examples/FLpanel-sensekey2.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac ; -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLpanel-sensekey2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +sr = 48000 +ksmps = 32 +nchnls = 1 +; Example by Istvan Varga +; if the FLTK opcodes are commented out, sensekey will read keyboard +; events from stdin + FLpanel "", 150, 50, 100, 100, 0, 1 + FLlabel 18, 10, 1, 0, 0, 0 + FLgroup "Keyboard Input", 150, 50, 0, 0, 0 + FLgroupEnd + FLpanelEnd + + FLrun + + instr 1 + +ktrig1 init 1 +ktrig2 init 1 +nxtKey1: +k1, k2 sensekey + if (k1 != -1 || k2 != 0) then + printf "Key code = %02X, state = %d\n", ktrig1, k1, k2 +ktrig1 = 3 - ktrig1 + kgoto nxtKey1 + endif +nxtKey2: +k3 sensekey + if (k3 != -1) then + printf "Character = '%c'\n", ktrig2, k3 +ktrig2 = 3 - ktrig2 + kgoto nxtKey2 + endif + + endin + +</CsInstruments> +<CsScore> +i 1 0 3600 +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/FLpanel.csd b/examples/FLpanel.csd new file mode 100644 index 0000000..d6739a5 --- /dev/null +++ b/examples/FLpanel.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLpanel.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Creates an empty window panel +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +; Panel height in pixels +ipanelheight = 900 +; Panel width in pixels +ipanelwidth = 400 +; Horizontal position of the panel on screen in pixels +ix = 50 +; Vertical position of the panel on screen in pixels +iy = 50 + +FLpanel "A Window Panel", ipanelheight, ipanelwidth, ix, iy +; End of panel contents +FLpanelEnd + +;Run the widget thread! +FLrun + +instr 1 +endin + + +</CsInstruments> +<CsScore> + +; 'Dummy' score event of 1 hour. +f 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLroller.csd b/examples/FLroller.csd new file mode 100644 index 0000000..522fea7 --- /dev/null +++ b/examples/FLroller.csd @@ -0,0 +1,68 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLroller.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; A sine with oscillator with flroller controlled frequency +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +FLpanel "Frequency Roller", 900, 400, 50, 50 + ; Minimum value output by the roller + imin = 200 + ; Maximum value output by the roller + imax = 5000 + ; Increment with each pixel + istep = 1 + ; Logarithmic type roller selected + iexp = -1 + ; Roller graphic type (1=horizontal) + itype = 1 + ; Display handle (-1=not used) + idisp = -1 + ; Width of the roller in pixels + iwidth = 300 + ; Height of the roller in pixels + iheight = 50 + ; Distance of the left edge of the knob + ; from the left edge of the panel + ix = 300 + ; Distance of the top edge of the knob + ; from the top edge of the panel + iy = 50 + + gkfreq, ihandle FLroller "Frequency", imin, imax, istep, iexp, itype, idisp, iwidth, iheight, ix, iy +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +instr 1 + iamp = 15000 + ifn = 1 + asig oscili iamp, gkfreq, ifn + out asig +endin + + +</CsInstruments> +<CsScore> + +; Function table that defines a single cycle +; of a sine wave. +f 1 0 1024 10 1 + +; Instrument 1 will play a note for 1 hour. +i 1 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLsavesnap.csd b/examples/FLsavesnap.csd new file mode 100644 index 0000000..c4259a5 --- /dev/null +++ b/examples/FLsavesnap.csd @@ -0,0 +1,119 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +</CsOptions> +<CsInstruments> + +sr=48000 +ksmps=128 +nchnls=2 + +; Example by Hector Centeno and Andres Cabrera 2007 + +; giSWMtab4 ftgen 0, 0, 513, 21, 10, 1, .3 +; giSWMtab4M ftgen 0, 0, 64, 7, 1, 50, 1 + +FLpanel "Snapshots", 530, 350, 40, 410, 3 + FLcolor 100, 118 ,140 + FLsetSnapGroup 0 + ivalSM1 FLvalue "", 70, 20, 270, 20 + ivalSM2 FLvalue "", 70, 20, 270, 60 + ivalSM3 FLvalue "", 70, 20, 270, 100 + ivalSM4 FLvalue "", 70, 20, 270, 140 + gksliderA, gislidSM1 FLslider "Slider A", -4, 4, 0, 3, ivalSM1, 250, 20, 20, 20 + gksliderB, gislidSM2 FLslider "Slider B", 1, 10, 0, 3, ivalSM2, 250, 20, 20, 60 + gksliderC, gislidSM3 FLslider "Slider C", 0, 1, 0, 3, ivalSM3, 250, 20, 20, 100 + gksliderD, gislidSM4 FLslider "Slider D", 0, 1, 0, 3, ivalSM4, 250, 20, 20, 140 + itext1 FLbox "store", 1, 1, 14, 50, 25, 355, 15 + itext2 FLbox "load", 1, 1, 14, 50, 25, 415, 15 + itext3 FLbox "G\nr\no\nu\np\n \n1", 1, 1, 14, 30, 145, 485, 15 + gksnap, ibuttn1 FLbutton "1", 1, 0, 11, 25, 25, 364, 45, 0, 3, 0, 3, 1 + gksnap, ibuttn2 FLbutton "2", 1, 0, 11, 25, 25, 364, 75, 0, 3, 0, 3, 2 + gksnap, ibuttn3 FLbutton "3", 1, 0, 11, 25, 25, 364, 105, 0, 3, 0, 3, 3 + gksnap, ibuttn4 FLbutton "4", 1, 0, 11, 25, 25, 364, 135, 0, 3, 0, 3, 4 + gkload, ibuttn1 FLbutton "1", 1, 0, 11, 25, 25, 424, 45, 0, 4, 0, 3, 1 + gkload, ibuttn2 FLbutton "2", 1, 0, 11, 25, 25, 424, 75, 0, 4, 0, 3, 2 + gkload, ibuttn3 FLbutton "3", 1, 0, 11, 25, 25, 424, 105, 0, 4, 0, 3, 3 + gkload, ibuttn4 FLbutton "4", 1, 0, 11, 25, 25, 424, 135, 0, 4, 0, 3, 4 + + FLcolor 100, 140 ,118 + FLsetSnapGroup 1 + ivalSM5 FLvalue "", 70, 20, 270, 190 + ivalSM6 FLvalue "", 70, 20, 270, 230 + ivalSM7 FLvalue "", 70, 20, 270, 270 + ivalSM8 FLvalue "", 70, 20, 270, 310 + gkknobA, gislidSM5 FLknob "Knob A", -4, 4, 0, 3, ivalSM5, 45, 10, 230 + gkknobB, gislidSM6 FLknob "Knob B", 1, 10, 0, 3, ivalSM6, 45, 75, 230 + gkknobC, gislidSM7 FLknob "Knob C", 0, 1, 0, 3, ivalSM7, 45, 140, 230 + gkknobD, gislidSM8 FLknob "Knob D", 0, 1, 0, 3, ivalSM8, 45, 205, 230 + itext4 FLbox "store", 1, 1, 14, 50, 25, 355, 185 + itext5 FLbox "load", 1, 1, 14, 50, 25, 415, 185 + itext6 FLbox "G\nr\no\nu\np\n \n2", 1, 1, 14, 30, 145, 485, 185 + gksnap, ibuttn1 FLbutton "5", 1, 0, 11, 25, 25, 364, 215, 0, 3, 0, 3, 5 + gksnap, ibuttn2 FLbutton "6", 1, 0, 11, 25, 25, 364, 245, 0, 3, 0, 3, 6 + gksnap, ibuttn3 FLbutton "7", 1, 0, 11, 25, 25, 364, 275, 0, 3, 0, 3, 7 + gksnap, ibuttn4 FLbutton "8", 1, 0, 11, 25, 25, 364, 305, 0, 3, 0, 3, 8 + gkload, ibuttn1 FLbutton "5", 1, 0, 11, 25, 25, 424, 215, 0, 4, 0, 3, 5 + gkload, ibuttn2 FLbutton "6", 1, 0, 11, 25, 25, 424, 245, 0, 4, 0, 3, 6 + gkload, ibuttn3 FLbutton "7", 1, 0, 11, 25, 25, 424, 275, 0, 4, 0, 3, 7 + gkload, ibuttn4 FLbutton "8", 1, 0, 11, 25, 25, 424, 305, 0, 4, 0, 3, 8 +FLpanelEnd +FLsetVal_i 1, gislidSM1 +FLsetVal_i 1, gislidSM2 +FLsetVal_i 0, gislidSM3 +FLsetVal_i 0, gislidSM4 +FLsetVal_i 1, gislidSM5 +FLsetVal_i 1, gislidSM6 +FLsetVal_i 0, gislidSM7 +FLsetVal_i 0, gislidSM8 +FLrun + + instr 1 + + endin + +instr 3 ; Save snapshot +index init 0 +ipstno = p4 +igroup = 0 +Sfile sprintf "PVCsynth.%d.snap", ipstno +if ipstno > 4 then + igroup = 1 +endif + + + inumsnap, inumval FLsetsnap index , -1, igroup +FLsavesnap Sfile + + endin + + +instr 4 ;Load snapshot +index init 0 +ipstno = p4 +igroup = 0 +Sfile sprintf "PVCsynth.%d.snap", ipstno +if ipstno > 4 then + igroup = 1 +endif + +FLloadsnap Sfile + inumload FLgetsnap index , igroup + + endin + + +</CsInstruments> + +<CsScore> + ;Dummy table for FLgetsnap +; f 1 0 1024 10 1 +f 0 3600 + +e + +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/FLsavesnap_simple.csd b/examples/FLsavesnap_simple.csd new file mode 100644 index 0000000..cc9386e --- /dev/null +++ b/examples/FLsavesnap_simple.csd @@ -0,0 +1,77 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +</CsOptions> +<CsInstruments> + +sr=48000 +ksmps=128 +nchnls=2 + +; Example by Hector Centeno and Andres Cabrera 2007 + +; giSWMtab4 ftgen 0, 0, 513, 21, 10, 1, .3 +; giSWMtab4M ftgen 0, 0, 64, 7, 1, 50, 1 + +FLpanel "Snapshots", 530, 190, 40, 410, 3 + FLcolor 100, 118 ,140 + ivalSM1 FLvalue "", 70, 20, 270, 20 + gksliderA, gislidSM1 FLslider "Slider", -4, 4, 0, 3, ivalSM1, 250, 20, 20, 20 + itext1 FLbox "store", 1, 1, 14, 50, 25, 355, 15 + itext2 FLbox "load", 1, 1, 14, 50, 25, 415, 15 + gksnap, ibuttn1 FLbutton "1", 1, 0, 11, 25, 25, 364, 45, 0, 3, 0, 3, 1 + gksnap, ibuttn2 FLbutton "2", 1, 0, 11, 25, 25, 364, 75, 0, 3, 0, 3, 2 + gksnap, ibuttn3 FLbutton "3", 1, 0, 11, 25, 25, 364, 105, 0, 3, 0, 3, 3 + gksnap, ibuttn4 FLbutton "4", 1, 0, 11, 25, 25, 364, 135, 0, 3, 0, 3, 4 + + gkload, ibuttn1 FLbutton "1", 1, 0, 11, 25, 25, 424, 45, 0, 4, 0, 3, 1 + gkload, ibuttn2 FLbutton "2", 1, 0, 11, 25, 25, 424, 75, 0, 4, 0, 3, 2 + gkload, ibuttn3 FLbutton "3", 1, 0, 11, 25, 25, 424, 105, 0, 4, 0, 3, 3 + gkload, ibuttn4 FLbutton "4", 1, 0, 11, 25, 25, 424, 135, 0, 4, 0, 3, 4 + + ivalSM2 FLvalue "", 70, 20, 270, 80 + gkknobA, gislidSM2 FLknob "Knob", -4, 4, 0, 3, ivalSM2, 60, 120, 60 +FLpanelEnd +FLsetVal_i 1, gislidSM1 +FLsetVal_i 1, gislidSM2 +FLrun + + instr 1 + + endin + +instr 3 ; Save snapshot +index init 0 +ipstno = p4 +Sfile sprintf "snapshot_simple.%d.snap", ipstno + + +inumsnap, inumval FLsetsnap index ;, -1, igroup +FLsavesnap Sfile + + endin + + +instr 4 ;Load snapshot +index init 0 +ipstno = p4 +Sfile sprintf "snapshot_simple.%d.snap", ipstno + +FLloadsnap Sfile +inumload FLgetsnap index ;, igroup + + endin + + +</CsInstruments> + +<CsScore> +f 0 3600 + +e + +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/FLscroll.csd b/examples/FLscroll.csd new file mode 100644 index 0000000..75c6cbc --- /dev/null +++ b/examples/FLscroll.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLscroll.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Demonstration of the flscroll opcode which enables +; the use of widget sizes and placings beyond the +; dimensions of the containing panel +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +FLpanel "Text Box", 420, 200, 50, 50 + iwidth = 420 + iheight = 200 + ix = 0 + iy = 0 + FLscroll iwidth, iheight, ix, iy + ih3 FLbox "DRAG THE SCROLL BAR TO THE RIGHT IN ORDER TO READ THE REST OF THIS TEXT!", 1, 10, 20, 870, 30, 10, 100 + FLscrollEnd +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +instr 1 +endin + + +</CsInstruments> +<CsScore> + +; 'Dummy' score event of 1 hour. +f 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLsetText.csd b/examples/FLsetText.csd new file mode 100644 index 0000000..3b86691 --- /dev/null +++ b/examples/FLsetText.csd @@ -0,0 +1,59 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLsetText.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 128 +nchnls = 2 + +; Example by Giorgio Zucco and Andres Cabrera 2007 + +FLpanel "FLsetText",250,100,50,50 + +gk1,giha FLcount "", 1, 20, 1, 20, 1, 200, 40, 20, 20, 0, 1, 0, 1 + +FLpanelEnd +FLrun + + + instr 1 +; This instrument is triggered by FLcount above each time +; its value changes +iname = i(gk1) +print iname +; Must use FLsetText on the init pass! +if (iname == 1) igoto text1 +if (iname == 2) igoto text2 +if (iname == 3) igoto text3 + +igoto end + +text1: +FLsetText "FM",giha +igoto end + +text2: +FLsetText "GRANUL",giha +igoto end + +text3: +FLsetText "PLUCK",giha +igoto end + +end: + endin + + +</CsInstruments> +<CsScore> + +f 0 3600 + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/FLsetVal.csd b/examples/FLsetVal.csd new file mode 100644 index 0000000..d60b522 --- /dev/null +++ b/examples/FLsetVal.csd @@ -0,0 +1,44 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLsetVal.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +; By Andres Cabrera 2007 + +FLpanel "Frequency Slider", 340, 100, 50, 50 + gkvalue1, gihandle1 FLslider "Slider A", 200, 5000, -1, 1, -1, 320, 20, 10, 10 + gkvalue2, gihandle2 FLslider "Slider B", 200, 5000, -1, 1, -1, 320, 20, 10, 50 +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +;Set the widget's initial value +FLsetVal_i 300, gihandle1 + +instr 1 + +endin + + +</CsInstruments> +<CsScore> + +; Function table that defines a single cycle +; of a sine wave. +f 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLsetcolor.csd b/examples/FLsetcolor.csd new file mode 100644 index 0000000..ce66920 --- /dev/null +++ b/examples/FLsetcolor.csd @@ -0,0 +1,54 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLsetcolor.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Using the opcode flsetcolor to change from the +; default colours for widgets +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +FLpanel "Coloured Sliders", 900, 360, 50, 50 + gkfreq, ihandle FLslider "A Red Slider", 200, 5000, -1, 5, -1, 750, 30, 85, 50 + ired1 = 255 + igreen1 = 0 + iblue1 = 0 + FLsetColor ired1, igreen1, iblue1, ihandle + + gkfreq, ihandle FLslider "A Green Slider", 200, 5000, -1, 5, -1, 750, 30, 85, 150 + ired1 = 0 + igreen1 = 255 + iblue1 = 0 + FLsetColor ired1, igreen1, iblue1, ihandle + + gkfreq, ihandle FLslider "A Blue Slider", 200, 5000, -1, 5, -1, 750, 30, 85, 250 + ired1 = 0 + igreen1 = 0 + iblue1 = 255 + FLsetColor ired1, igreen1, iblue1, ihandle +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +instr 1 +endin + + +</CsInstruments> +<CsScore> + +; 'Dummy' score event for 1 hour. +f 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLslidBnk.csd b/examples/FLslidBnk.csd new file mode 100644 index 0000000..25f2b3c --- /dev/null +++ b/examples/FLslidBnk.csd @@ -0,0 +1,60 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLslidBnk.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +gitypetable ftgen 0, 0, 8, -2, 1, 1, 3, 3, 5, 5, 7, 7 +giouttable ftgen 0, 0, 8, -2, 0, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1 + +FLpanel "Slider Bank", 400, 380, 50, 50 + ;Number of sliders + inum = 8 + ; Table to store output + iouttable = giouttable + ; Width of the slider bank in pixels + iwidth = 350 + ; Height of the slider in pixels + iheight = 160 + ; Distance of the left edge of the slider + ; from the left edge of the panel + ix = 30 + ; Distance of the top edge of the slider + ; from the top edge of the panel + iy = 10 + ; Table containing fader types + itypetable = gitypetable + FLslidBnk "1@2@3@4@5@6@7@8", inum , iouttable , iwidth , iheight , ix \ + , iy , itypetable + FLslidBnk "1@2@3@4@5@6@7@8", inum , iouttable , iwidth , iheight , ix \ + , iy + 200 , -23 +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + + +instr 1 +;Dummy instrument +endin + + +</CsInstruments> +<CsScore> + +; Instrument 1 will play a note for 1 hour. +i 1 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLslidBnk2.csd b/examples/FLslidBnk2.csd new file mode 100644 index 0000000..912ef73 --- /dev/null +++ b/examples/FLslidBnk2.csd @@ -0,0 +1,59 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc -M0 ;;;RT audio I/O with MIDI in +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 100 +nchnls = 2 + +;Example by Gabriel Maldonado + +giElem init 8 +giOutTab ftgen 1,0,128, 2, 0 + + ;min1, max1, exp1, type1, min2, max2, exp2, type2, min3, max3, exp3, type3 etc. +giConfigTab ftgen 2,0,128,-2, .1, 1000, -1, 3, .1, 1000, -1, 3, .1, 1000, -1, 3, 30, 2000, -1, 3, \ + .1, 5000, -1, 5, .1, 5000, -1, 5, .1, 5000, -1, 5, .1, 5000, -1, 5 +giSine ftgen 3,0,256,10, 1 + + FLpanel "This Panel contains a Slider Bank",600,600 + FLslidBnk2 "mod1@mod2@mod3@amp@freq1@freq2@freq3@freqPo", giElem, giOutTab, giConfigTab, 400, 500, 100, 10 + FLpanel_end + + FLrun + + instr 1 + +kmodindex1 init 0 +kmodindex2 init 0 +kmodindex3 init 0 +kamp init 0 +kfreq1 init 0 +kfreq2 init 0 +kfreq3 init 0 +kfreq4 init 0 + + + vtable1k giOutTab, kmodindex1 , kmodindex2, kmodindex3, kamp, kfreq1, kfreq2 , kfreq3, kfreq4 + +amod1 oscili kmodindex1, kfreq1, giSine +amod2 oscili kmodindex2, kfreq2, giSine +amod3 oscili kmodindex3, kfreq3, giSine +aout oscili kamp, kfreq4+amod1+amod2+amod3, giSine + + outs aout, aout + endin + + +</CsInstruments> +<CsScore> + +i1 0 3600 +f0 3600 + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLslidBnk2Setk.csd b/examples/FLslidBnk2Setk.csd new file mode 100644 index 0000000..9f6a9d7 --- /dev/null +++ b/examples/FLslidBnk2Setk.csd @@ -0,0 +1,93 @@ +<CsoundSynthesizer>
+<CsOptions>
+; Select audio/midi flags here according to platform
+; Audio out Audio in No messages
+-odac -iadc -d ;;;RT audio I/O
+</CsOptions>
+
+<CsInstruments>
+
+sr = 44100
+ksmps = 10
+nchnls = 2
+
+;Example by Gabriel Maldonado 2007
+
+giElem init 8
+giOutTab ftgen 1,0,128, 2, 0
+giSine ftgen 3,0,256,10, 1
+giOutTab2 ftgen 4,0,128, 2, 0
+
+itab ftgen 29, 0, 129, 5, .002, 128, 1 ;** exponential ascending curve for slider mapping
+giExpTab ftgen 30, 0, 129, -24, itab, 0, 1 ;** rescaled curve for slider mapping
+
+
+giConfigTab ftgen 2,0,128,-2, 1, 500, -1, 13, \
+ 1, 500, -1, 13, \
+ 1, 500, -1, 13, \
+ 1, 5000, -1, 13, \
+\
+ 1, 1000, -1, 5, \
+ 1, 1000, -1, 5, \
+ 1, 1000, -1, 5, \
+ 1, 5000, -1, 5
+
+ FLpanel "Multiple FM",600,600
+ FLslidBnk2 "mod1@mod2@mod3@amp@freq1@freq2@freq3@freqPo", giElem, giOutTab2, giConfigTab, 400, 500, 100, 10
+giHandle FLslidBnkGetHandle
+
+ FLpanel_end
+
+ FLrun
+
+
+
+ instr 1
+
+ktrig slider8table 1, giOutTab, 0,\
+\; ctl min max init func
+ 27, 1, 500, 3, -1, \;1 repeat rate
+ 28, 1, 500, 4, -1, \;2 random freq. amount
+ 29, 1, 500, 1, -1, \;3 random amp. amount
+ 30, 1, 5000, 1, -1, \;4 number of concurrent loop points
+\
+ 31, 1, 1000, 1, -1, \;5 kloop1
+ 32, 1, 1000, 1, -1, \;6 kloop2
+ 33, 1, 1000, 1, -1, \;7 kloop3
+ 34, 1, 1000, 1, -1 \;8 kloop4
+
+
+kmodindex1 init 0
+kmodindex2 init 0
+kmodindex3 init 0
+kamp init 0
+kfreq1 init 0
+kfreq2 init 0
+kfreq3 init 0
+kfreq4 init 0
+
+ vtable1k giOutTab2, kmodindex1, kmodindex2, kmodindex3, kamp, kfreq1, kfreq2, kfreq3, kfreq4
+
+; *kflag, *ihandle, *ifn, *startInd, *startSlid, *numSlid;
+ FLslidBnk2Setk ktrig, giHandle, giOutTab, 0, 0, giElem
+printk2 kmodindex1
+printk2 kmodindex2,10
+printk2 kmodindex3,20
+printk2 kamp,30
+
+
+amod1 oscili kmodindex1, kfreq1, giSine
+amod2 oscili kmodindex2, kfreq2, giSine
+amod3 oscili kmodindex3, kfreq3, giSine
+aout oscili kamp, kfreq4+amod1+amod2+amod3, giSine
+ outs aout, aout
+
+ endin
+</CsInstruments>
+
+<CsScore>
+i1 0 3600
+</CsScore>
+
+</CsoundSynthesizer>
+
diff --git a/examples/FLslider-2.csd b/examples/FLslider-2.csd new file mode 100644 index 0000000..5fadc6e --- /dev/null +++ b/examples/FLslider-2.csd @@ -0,0 +1,153 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLslider-2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +;By Andres Cabrera 2007 + +FLpanel "Slider Types", 410, 260, 50, 50 + ; Distance of the left edge of the slider + ; from the left edge of the panel + ix = 10 + ; Distance of the top edge of the slider + ; from the top edge of the panel + iy = 10 + ; Create boxes to display widget values + givalue1 FLvalue "1", 60, 20, ix + 330, iy + givalue3 FLvalue "3", 60, 20, ix + 330, iy + 40 + givalue5 FLvalue "5", 60, 20, ix + 330, iy + 80 + + givalue2 FLvalue "2", 60, 20, ix + 60, iy + 140 + givalue4 FLvalue "4", 60, 20, ix + 195, iy + 140 + givalue6 FLvalue "6", 60, 20, ix + 320, iy + 140 + + ;Horizontal sliders + gkdummy1, gihandle1 FLslider "Type 1", 200, 5000, -1, 1, givalue1, 320, 20, ix, iy + gkdummy3, gihandle3 FLslider "Type 3", 0, 15000, 0, 3, givalue3, 320, 20, ix, iy + 40 + ; Reversed slider + gkdummy5, gihandle5 FLslider "Type 5", 1, 0, 0, 5, givalue5, 320, 20, ix, iy + 80 + + ;Vertical sliders + gkdummy2, gihandle2 FLslider "Type 2", 0, 1, 0, 2, givalue2, 20, 100, ix+ 30 , iy + 120 + ; Reversed slider + gkdummy4, gihandle4 FLslider "Type 4", 1, 0, 0, 4, givalue4, 20, 100, ix + 165 , iy + 120 + gkdummy6, gihandle6 FLslider "Type 6", 0, 1, 0, 6, givalue6, 20, 100, ix + 290 , iy + 120 +FLpanelEnd + +FLpanel "Plastic Slider Types", 410, 300, 150, 150 + ; Distance of the left edge of the slider + ; from the left edge of the panel + ix = 10 + ; Distance of the top edge of the slider + ; from the top edge of the panel + iy = 10 + ; Create boxes to display widget values + givalue21 FLvalue "21", 60, 20, ix + 330, iy + givalue23 FLvalue "23", 60, 20, ix + 330, iy + 40 + givalue25 FLvalue "25", 60, 20, ix + 330, iy + 80 + + givalue22 FLvalue "22", 60, 20, ix + 60, iy + 140 + givalue24 FLvalue "24", 60, 20, ix + 195, iy + 140 + givalue26 FLvalue "26", 60, 20, ix + 320, iy + 140 + + ;Horizontal sliders + gkdummy21, gihandle21 FLslider "Type 21", 200, 5000, -1, 21, givalue21, 320, 20, ix, iy + gkdummy23, gihandle23 FLslider "Type 23", 0, 15000, 0, 23, givalue23, 320, 20, ix, iy + 40 + ; Reversed slider + gkdummy25, gihandle25 FLslider "Type 25", 1, 0, 0, 25, givalue25, 320, 20, ix, iy + 80 + + ;Vertical sliders + gkdummy22, gihandle22 FLslider "Type 22", 0, 1, 0, 22, givalue22, 20, 100, ix+ 30 , iy + 120 + ; Reversed slider + gkdummy24, gihandle24 FLslider "Type 24", 1, 0, 0, 24, givalue24, 20, 100, ix + 165 , iy + 120 + gkdummy26, gihandle26 FLslider "Type 26", 0, 1, 0, 26, givalue26, 20, 100, ix + 290 , iy + 120 + ;Button to add color to the sliders + gkcolors, ihdummy FLbutton "Color", 1, 0, 21, 150, 30, 30, 260, 0, 10, 0, 1 +FLpanelEnd +FLrun + + + +;Set some widget's initial value +FLsetVal_i 500, gihandle1 +FLsetVal_i 1000, gihandle3 + +instr 10 +; Set the color of widgets +FLsetColor 200, 230, 0, gihandle1 +FLsetColor 0, 123, 100, gihandle2 +FLsetColor 180, 23, 12, gihandle3 +FLsetColor 10, 230, 0, gihandle4 +FLsetColor 0, 0, 0, gihandle5 +FLsetColor 0, 0, 0, gihandle6 + +FLsetColor 200, 230, 0, givalue1 +FLsetColor 0, 123, 100, givalue2 +FLsetColor 180, 23, 12, givalue3 +FLsetColor 10, 230, 0, givalue4 +FLsetColor 255, 255, 255, givalue5 +FLsetColor 255, 255, 255, givalue6 + +FLsetColor2 20, 23, 100, gihandle1 +FLsetColor2 200,0 ,123 , gihandle2 +FLsetColor2 180, 180, 100, gihandle3 +FLsetColor2 180, 23, 12, gihandle4 +FLsetColor2 180, 180, 100, gihandle5 +FLsetColor2 180, 23, 12, gihandle6 + +FLsetColor 200, 230, 0, gihandle21 +FLsetColor 0, 123, 100, gihandle22 +FLsetColor 180, 23, 12, gihandle23 +FLsetColor 10, 230, 0, gihandle24 +FLsetColor 0, 0, 0, gihandle25 +FLsetColor 0, 0, 0, gihandle26 + +FLsetColor 200, 230, 0, givalue21 +FLsetColor 0, 123, 100, givalue22 +FLsetColor 180, 23, 12, givalue23 +FLsetColor 10, 230, 0, givalue24 +FLsetColor 255, 255, 255, givalue25 +FLsetColor 255, 255, 255, givalue26 + +FLsetColor2 20, 23, 100, gihandle21 +FLsetColor2 200,0 ,123 , gihandle22 +FLsetColor2 180, 180, 100, gihandle23 +FLsetColor2 180, 23, 12, gihandle24 +FLsetColor2 180, 180, 100, gihandle25 +FLsetColor2 180, 23, 12, gihandle26 + +; Slider values must be updated for colors to change +FLsetVal_i 250, gihandle1 +FLsetVal_i 0.5, gihandle2 +FLsetVal_i 0, gihandle3 +FLsetVal_i 0, gihandle4 +FLsetVal_i 0, gihandle5 +FLsetVal_i 0.5, gihandle6 +FLsetVal_i 250, gihandle21 +FLsetVal_i 0.5, gihandle22 +FLsetVal_i 500, gihandle23 +FLsetVal_i 0, gihandle24 +FLsetVal_i 0, gihandle25 +FLsetVal_i 0.5, gihandle26 + +endin + + +</CsInstruments> +<CsScore> +f 0 3600 ;Dumy table to make csound wait for realtime events + +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLslider.csd b/examples/FLslider.csd new file mode 100644 index 0000000..1db21fc --- /dev/null +++ b/examples/FLslider.csd @@ -0,0 +1,70 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLslider.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; A sine with oscillator with flslider controlled frequency +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +FLpanel "Frequency Slider", 900, 400, 50, 50 + ; Minimum value output by the slider + imin = 200 + ; Maximum value output by the slider + imax = 5000 + ; Logarithmic type slider selected + iexp = -1 + ; Slider graphic type (5='nice' slider) + itype = 5 + ; Display handle (-1=not used) + idisp = -1 + ; Width of the slider in pixels + iwidth = 750 + ; Height of the slider in pixels + iheight = 30 + ; Distance of the left edge of the slider + ; from the left edge of the panel + ix = 125 + ; Distance of the top edge of the slider + ; from the top edge of the panel + iy = 50 + + gkfreq, ihandle FLslider "Frequency", imin, imax, iexp, itype, idisp, iwidth, iheight, ix, iy +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +;Set the widget's initial value +FLsetVal_i 300, ihandle + +instr 1 + iamp = 15000 + ifn = 1 + kfreq portk gkfreq, 0.005 ;Smooth gkfreq to avoid zipper noise + asig oscili iamp, kfreq, ifn + out asig +endin + + +</CsInstruments> +<CsScore> + +; Function table that defines a single cycle +; of a sine wave. +f 1 0 1024 10 1 + +; Instrument 1 will play a note for 1 hour. +i 1 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLtabs.csd b/examples/FLtabs.csd new file mode 100644 index 0000000..46e6666 --- /dev/null +++ b/examples/FLtabs.csd @@ -0,0 +1,76 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLtabs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; A single oscillator with frequency, amplitude and +; panning controls on separate file tab cards +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 2 + +FLpanel "Tabs", 300, 350, 100, 100 +itabswidth = 280 +itabsheight = 330 +ix = 5 +iy = 5 +FLtabs itabswidth,itabsheight, ix,iy + + itab1width = 280 + itab1height = 300 + itab1x = 10 + itab1y = 40 + FLgroup "Tab 1", itab1width, itab1height, itab1x, itab1y + gkfreq, i1 FLknob "Frequency", 200, 5000, -1, 1, -1, 70, 70, 130 + FLsetVal_i 400, i1 + FLgroupEnd + + itab2width = 280 + itab2height = 300 + itab2x = 10 + itab2y = 40 + FLgroup "Tab 2", itab2width, itab2height, itab2x, itab2y + gkamp, i2 FLknob "Amplitude", 0, 15000, 0, 1, -1, 70, 70, 130 + FLsetVal_i 15000, i2 + FLgroupEnd + + itab3width = 280 + itab3height = 300 + itab3x = 10 + itab3y = 40 + FLgroup "Tab 3", itab3width, itab3height, itab3x, itab3y + gkpan, i3 FLknob "Pan position", 0, 1, 0, 1, -1, 70, 70, 130 + FLsetVal_i 0.5, i3 + FLgroupEnd +FLtabsEnd +FLpanelEnd +; Run the widget thread! +FLrun + +instr 1 + ifn = 1 + asig oscili gkamp, gkfreq, ifn + outs asig*(1-gkpan), asig*gkpan +endin + + +</CsInstruments> +<CsScore> + +; Function table that defines a single cycle +; of a sine wave. +f 1 0 1024 10 1 + +; Instrument 1 will play a note for 1 hour. +i 1 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLtext.csd b/examples/FLtext.csd new file mode 100644 index 0000000..dc37ff0 --- /dev/null +++ b/examples/FLtext.csd @@ -0,0 +1,66 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLtext.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; A sine with oscillator with fltext box controlled +; frequency either click and drag or double click and +; type to change frequency value +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +FLpanel "Frequency Text Box", 270, 600, 50, 50 + ; Minimum value output by the text box + imin = 200 + ; Maximum value output by the text box + imax = 5000 + ; Step size + istep = 1 + ; Text box graphic type + itype = 1 + ; Width of the text box in pixels + iwidth = 70 + ; Height of the text box in pixels + iheight = 30 + ; Distance of the left edge of the text box + ; from the left edge of the panel + ix = 100 + ; Distance of the top edge of the text box + ; from the top edge of the panel + iy = 300 + + gkfreq,ihandle FLtext "Enter the frequency", imin, imax, istep, itype, iwidth, iheight, ix, iy +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +instr 1 + iamp = 15000 + ifn = 1 + asig oscili iamp, gkfreq, ifn + out asig +endin + + +</CsInstruments> +<CsScore> + +; Function table that defines a single cycle +; of a sine wave. +f 1 0 1024 10 1 + +; Instrument 1 will play a note for 1 hour. +i 1 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLvalue.csd b/examples/FLvalue.csd new file mode 100644 index 0000000..f9ff6c6 --- /dev/null +++ b/examples/FLvalue.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o FLvalue.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Using the opcode flvalue to display the output of a slider +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +FLpanel "Value Display Box", 900, 200, 50, 50 + ; Width of the value display box in pixels + iwidth = 50 + ; Height of the value display box in pixels + iheight = 20 + ; Distance of the left edge of the value display + ; box from the left edge of the panel + ix = 65 + ; Distance of the top edge of the value display + ; box from the top edge of the panel + iy = 55 + + idisp FLvalue "Hertz", iwidth, iheight, ix, iy + gkfreq, ihandle FLslider "Frequency", 200, 5000, -1, 5, idisp, 750, 30, 125, 50 + FLsetVal_i 500, ihandle +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + +instr 1 + iamp = 15000 + ifn = 1 + asig oscili iamp, gkfreq, ifn + out asig +endin + + +</CsInstruments> +<CsScore> + +; Function table that defines a single cycle +; of a sine wave. +f 1 0 1024 10 1 + +; Instrument 1 will play a note for 1 hour. +i 1 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLvslidBnk.csd b/examples/FLvslidBnk.csd new file mode 100644 index 0000000..696e0a7 --- /dev/null +++ b/examples/FLvslidBnk.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +gitypetable ftgen 0, 0, 8, -2, 1, 1, 3, 3, 5, 5, 7, 7 +giouttable ftgen 0, 0, 8, -2, 0, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1 + +FLpanel "Slider Bank", 400, 400, 50, 50 + ;Number of sliders + inum = 8 + ; Table to store output + iouttable = giouttable + ; Width of the slider bank in pixels + iwidth = 350 + ; Height of the slider in pixels + iheight = 160 + ; Distance of the left edge of the slider + ; from the left edge of the panel + ix = 30 + ; Distance of the top edge of the slider + ; from the top edge of the panel + iy = 10 + ; Table containing fader types + itypetable = gitypetable + FLvslidBnk "1@2@3@4@5@6@7@8@9@10@11@12@13@14@15@16", 16 , iouttable , iwidth , iheight , ix \ + , iy , itypetable + FLvslidBnk " ", inum , iouttable , iwidth , iheight , ix \ + , iy + 200 , -23 +; End of panel contents +FLpanelEnd +; Run the widget thread! +FLrun + + +instr 1 +;Dummy instrument +endin + + +</CsInstruments> +<CsScore> + +; Instrument 1 will play a note for 1 hour. +i 1 0 3600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/FLxyin-2.csd b/examples/FLxyin-2.csd new file mode 100644 index 0000000..d5ccc81 --- /dev/null +++ b/examples/FLxyin-2.csd @@ -0,0 +1,44 @@ +<CsoundSynthesizer>
+<CsOptions>
+; Select audio/midi flags here according to platform
+; Audio out Audio in No messages
+-odac -iadc -d ;;;RT audio I/O
+</CsOptions>
+<CsInstruments>
+
+sr=44100
+kr=441
+ksmps=100
+nchnls=2
+
+; Example by Gabriel Maldonado
+
+ FLpanel "Move the mouse inside this panel to hear the effect",400,400
+ FLpanel_end
+ FLrun
+
+ instr 1
+
+k1, k2, kinside FLxyin 50, 1000, 50, 1000, 100, 300, 50, 250, -2,-3
+;if k1 <= 50 || k1 >=5000 || k2 <=100 || k2 >= 8000 kgoto end ; if cursor is outside bounds, then don't play!!!
+
+a1 oscili 3000, k1, 1
+a2 oscili 3000, k2, 1
+
+ outs a1,a2
+printk2 k1
+printk2 k2, 10
+printk2 kinside, 20
+end:
+ endin
+
+</CsInstruments>
+<CsScore>
+
+f1 0 1024 10 1
+f2 0 17 19 1 1 90 1
+f3 0 17 19 2 1 90 1
+i1 0 3600
+
+</CsScore>
+</CsoundSynthesizer>
diff --git a/examples/FLxyin.csd b/examples/FLxyin.csd new file mode 100644 index 0000000..7e5891f --- /dev/null +++ b/examples/FLxyin.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +</CsOptions> +<CsInstruments> + +sr=48000 +ksmps=128 +nchnls=2 + +; Example by Andres Cabrera 2007 + +FLpanel "FLxyin", 200, 100, -1, -1, 3 +FLpanelEnd +FLrun + +instr 1 + koutx, kouty, kinside FLxyin 0, 10, 100, 1000, 10, 190, 10, 90 + aout buzz 10000, kouty, koutx, 1 + printk2 koutx + outs aout, aout +endin + + +</CsInstruments> + +<CsScore> +f 1 0 1024 10 1 +i 1 0 3600 + +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/HRTFcompact b/examples/HRTFcompact Binary files differnew file mode 100644 index 0000000..5c2761a --- /dev/null +++ b/examples/HRTFcompact diff --git a/examples/OSCmidircv.csd b/examples/OSCmidircv.csd new file mode 100644 index 0000000..6dca43b --- /dev/null +++ b/examples/OSCmidircv.csd @@ -0,0 +1,96 @@ +<CsoundSynthesizer> +; network_recv.csd +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +</CsOptions> +<CsInstruments> + + sr = 44100 + ksmps = 128 + nchnls = 1 + +; Example by Jonathan Murphy and Andres Cabrera 2007 +; Use file OSCmidisend.csd to generate OSC events for this file + + 0dbfs = 1 + + gilisten OSCinit 47120 + + gisin ftgen 1, 0, 16384, 10, 1 + givel ftgen 2, 0, 128, -2, 0 + gicc ftgen 3, 0, 128, -7, 100, 128, 100 ;Default all controllers to 100 + +;Define scale tuning + giji_12 ftgen 202, 0, 32, -2, 12, 2, 256, 60, 1, 16/15, 9/8, 6/5, 5/4, 4/3, 7/5, \ + 3/2, 8/5, 5/3, 9/5, 15/8, 2 + +#define DEST #"/midi"# +; Use controller number 7 for volume +#define VOL #7# + +turnon 1000 + + + instr 1000 + + kst init 0 + kch init 0 + kd1 init 0 + kd2 init 0 + +next: + + kk OSClisten gilisten, $DEST, "iiii", kst, kch, kd1, kd2 + +if (kk == 0) goto done + +printks "kst = %i, kch = %i, kd1 = %i, kd2 = %i\\n", \ + 0, kst, kch, kd1, kd2 + +if (kst == 176) then +;Store controller information in a table + tablew kd2, kd1, gicc +endif + +if (kst == 144) then +;Process noteon and noteoff messages. + kkey = kd1 + kvel = kd2 + kcps cpstun kvel, kkey, giji_12 + kamp = kvel/127 + +if (kvel == 0) then + turnoff2 1001, 4, 1 +elseif (kvel > 0) then + event "i", 1001, 0, -1, kcps, kamp +endif +endif + + kgoto next ;Process all events in queue + +done: + endin + + + + instr 1001 ;Simple instrument + + icps init p4 + kvol table $VOL, gicc ;Read MIDI volume from controller table + kvol = kvol/127 + + aenv linsegr 0, .003, p5, 0.03, p5 * 0.5, 0.3, 0 + aosc oscil aenv, icps, gisin + + out aosc * kvol + endin + + +</CsInstruments> +<CsScore> +f 0 3600 ;Dummy f-table +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/OSCmidisend.csd b/examples/OSCmidisend.csd new file mode 100644 index 0000000..08de1f0 --- /dev/null +++ b/examples/OSCmidisend.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +</CsOptions> +<CsInstruments> + + sr = 44100 + ksmps = 128 + nchnls = 1 + +; Example by David Akbari 2007 +; Modified by Jonathan Murphy +; Use this file to generate OSC events for OSCmidircv.csd + +#define IPADDRESS # "localhost" # +#define PORT # 47120 # + +turnon 1000 + + + instr 1000 + + kst, kch, kd1, kd2 midiin + + OSCsend kst+kch+kd1+kd2, $IPADDRESS, $PORT, "/midi", "iiii", kst, kch, kd1, kd2 + + endin + + +</CsInstruments> +<CsScore> +f 0 3600 ;Dummy f-table +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/PartikkelExample1.csd b/examples/PartikkelExample1.csd new file mode 100644 index 0000000..4327817 --- /dev/null +++ b/examples/PartikkelExample1.csd @@ -0,0 +1,152 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out +-odac ;;;RT audio +; For Non-realtime ouput leave only the line below: +; -o partikkel.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> + +sr = 44100 +ksmps = 20 +nchnls = 2 + +; Example by Joachim Heintz and Oeyvind Brandtsegg 2008 + +giCosine ftgen 0, 0, 8193, 9, 1, 1, 90 ; cosine +giDisttab ftgen 0, 0, 32768, 7, 0, 32768, 1 ; for kdistribution +giFile ftgen 0, 0, 0, 1, "fox.wav", 0, 0, 0 ; soundfile for source waveform +giWin ftgen 0, 0, 4096, 20, 9, 1 ; grain envelope +giPan ftgen 0, 0, 32768, -21, 1 ; for panning (random values between 0 and 1) + + +; ************************************************* +; partikkel example, processing of soundfile +; uses the file "fox.wav" +; ************************************************* + instr 1 + +/*score parameters*/ +ispeed = p4 ; 1 = original speed +igrainrate = p5 ; grain rate +igrainsize = p6 ; grain size in ms +icent = p7 ; transposition in cent +iposrand = p8 ; time position randomness (offset) of the pointer in ms +icentrand = p9 ; transposition randomness in cents +ipan = p10 ; panning narrow (0) to wide (1) +idist = p11 ; grain distribution (0=periodic, 1=scattered) + +/*get length of source wave file, needed for both transposition and time pointer*/ +ifilen tableng giFile +ifildur = ifilen / sr + +/*sync input (disabled)*/ +async = 0 + +/*grain envelope*/ +kenv2amt = 1 ; use only secondary envelope +ienv2tab = giWin ; grain (secondary) envelope +ienv_attack = -1 ; default attack envelope (flat) +ienv_decay = -1 ; default decay envelope (flat) +ksustain_amount = 0.5 ; no meaning in this case (use only secondary envelope, ienv2tab) +ka_d_ratio = 0.5 ; no meaning in this case (use only secondary envelope, ienv2tab) + +/*amplitude*/ +kamp = 0.4*0dbfs ; grain amplitude +igainmasks = -1 ; (default) no gain masking + +/*transposition*/ +kcentrand rand icentrand ; random transposition +iorig = 1 / ifildur ; original pitch +kwavfreq = iorig * cent(icent + kcentrand) + +/*other pitch related (disabled)*/ +ksweepshape = 0 ; no frequency sweep +iwavfreqstarttab = -1 ; default frequency sweep start +iwavfreqendtab = -1 ; default frequency sweep end +awavfm = 0 ; no FM input +ifmamptab = -1 ; default FM scaling (=1) +kfmenv = -1 ; default FM envelope (flat) + +/*trainlet related (disabled)*/ +icosine = giCosine ; cosine ftable +kTrainCps = igrainrate ; set trainlet cps equal to grain rate for single-cycle trainlet in each grain +knumpartials = 1 ; number of partials in trainlet +kchroma = 1 ; balance of partials in trainlet + +/*panning, using channel masks*/ +imid = .5; center +ileftmost = imid - ipan/2 +irightmost = imid + ipan/2 +giPanthis ftgen 0, 0, 32768, -24, giPan, ileftmost, irightmost ; rescales giPan according to ipan + tableiw 0, 0, giPanthis ; change index 0 ... + tableiw 32766, 1, giPanthis ; ... and 1 for ichannelmasks +ichannelmasks = giPanthis ; ftable for panning + +/*random gain masking (disabled)*/ +krandommask = 0 + +/*source waveforms*/ +kwaveform1 = giFile ; source waveform +kwaveform2 = giFile ; all 4 sources are the same +kwaveform3 = giFile +kwaveform4 = giFile +iwaveamptab = -1 ; (default) equal mix of source waveforms and no amplitude for trainlets + +/*time pointer*/ +afilposphas phasor ispeed / ifildur +/*generate random deviation of the time pointer*/ +iposrandsec = iposrand / 1000 ; ms -> sec +iposrand = iposrandsec / ifildur ; phase values (0-1) +krndpos linrand iposrand ; random offset in phase values +/*add random deviation to the time pointer*/ +asamplepos1 = afilposphas + krndpos; resulting phase values (0-1) +asamplepos2 = asamplepos1 +asamplepos3 = asamplepos1 +asamplepos4 = asamplepos1 + +/*original key for each source waveform*/ +kwavekey1 = 1 +kwavekey2 = kwavekey1 +kwavekey3 = kwavekey1 +kwavekey4 = kwavekey1 + +/* maximum number of grains per k-period*/ +imax_grains = 100 + +aL, aR partikkel igrainrate, idist, giDisttab, async, kenv2amt, ienv2tab, \ + ienv_attack, ienv_decay, ksustain_amount, ka_d_ratio, igrainsize, kamp, igainmasks, \ + kwavfreq, ksweepshape, iwavfreqstarttab, iwavfreqendtab, awavfm, \ + ifmamptab, kfmenv, icosine, kTrainCps, knumpartials, \ + kchroma, ichannelmasks, krandommask, kwaveform1, kwaveform2, kwaveform3, kwaveform4, \ + iwaveamptab, asamplepos1, asamplepos2, asamplepos3, asamplepos4, \ + kwavekey1, kwavekey2, kwavekey3, kwavekey4, imax_grains + + outs aL, aR + +endin + + +</CsInstruments> +<CsScore> +;i1 st dur speed grate gsize cent posrnd cntrnd pan dist +i1 0 2.757 1 200 15 0 0 0 0 0 +s +i1 0 2.757 1 200 15 400 0 0 0 0 +s +i1 0 2.757 1 15 450 400 0 0 0 0 +s +i1 0 2.757 1 15 450 400 0 0 0 0.4 +s +i1 0 2.757 1 200 15 0 400 0 0 1 +s +i1 0 5.514 .5 200 20 0 0 600 .5 1 +s +i1 0 11.028 .25 200 15 0 1000 400 1 1 + + +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/abs.csd b/examples/abs.csd new file mode 100644 index 0000000..70a3fe1 --- /dev/null +++ b/examples/abs.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o abs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = -6 + i2 = abs(i1) + + print i2 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/active.csd b/examples/active.csd new file mode 100644 index 0000000..3581dd3 --- /dev/null +++ b/examples/active.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o active.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a noisy waveform. +instr 1 + ; Generate a really noisy waveform. + anoisy rand 44100 + ; Turn down its amplitude. + aoutput gain anoisy, 2500 + ; Send it to the output. + out aoutput +endin + +; Instrument #2 - counts active instruments. +instr 2 + ; Count the active instances of Instrument #1. + icount active 1 + ; Print the number of active instances. + print icount +endin + + +</CsInstruments> +<CsScore> + +; Start the first instance of Instrument #1 at 0:00 seconds. +i 1 0.0 3.0 + +; Start the second instance of Instrument #1 at 0:015 seconds. +i 1 1.5 1.5 + +; Play Instrument #2 at 0:01 seconds, when we have only +; one active instance of Instrument #1. +i 2 1.0 0.1 + +; Play Instrument #2 at 0:02 seconds, when we have +; two active instances of Instrument #1. +i 2 2.0 0.1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/active_k.csd b/examples/active_k.csd new file mode 100644 index 0000000..bd14dd4 --- /dev/null +++ b/examples/active_k.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o active_k.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a noisy waveform. +instr 1 + ; Generate a really noisy waveform. + anoisy rand 44100 + ; Turn down its amplitude. + aoutput gain anoisy, 2500 + ; Send it to the output. + out aoutput +endin + +; Instrument #2 - counts active instruments at k-rate. +instr 2 + ; Count the active instances of Instrument #1. + kcount active 1 + ; Print the number of active instances. + printk2 kcount +endin + + +</CsInstruments> +<CsScore> + +; Start the first instance of Instrument #1 at 0:00 seconds. +i 1 0.0 3.0 + +; Start the second instance of Instrument #1 at 0:015 seconds. +i 1 1.5 1.5 + +; Play Instrument #2 at 0:01 seconds, when we have only +; one active instance of Instrument #1. +i 2 1.0 0.1 + +; Play Instrument #2 at 0:02 seconds, when we have +; two active instances of Instrument #1. +i 2 2.0 0.1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/adds.csd b/examples/adds.csd new file mode 100644 index 0000000..ccb2c23 --- /dev/null +++ b/examples/adds.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o adds.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = 24 + 8 + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/adsr.csd b/examples/adsr.csd new file mode 100644 index 0000000..a73a405 --- /dev/null +++ b/examples/adsr.csd @@ -0,0 +1,93 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o adsr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a simple instrument. +instr 1 + ; Set the amplitude. + kamp init 20000 + ; Get the frequency from the fourth p-field. + kcps = cpspch(p4) + + a1 vco kamp, kcps, 1 + out a1 +endin + +; Instrument #2 - instrument with an ADSR envelope. +instr 2 + iatt = 0.05 + idec = 0.5 + islev = 0.08 + irel = 0.008 + + ; Create an amplitude envelope. + kenv adsr iatt, idec, islev, irel + kamp = kenv * 20000 + + ; Get the frequency from the fourth p-field. + kcps = cpspch(p4) + + a1 vco kamp, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Set the tempo to 120 beats per minute. +t 0 120 + +; Play a melody with Instrument #1. +; p4 = frequency in pitch-class notation. +i 1 0 1 8.04 +i 1 1 1 8.04 +i 1 2 1 8.05 +i 1 3 1 8.07 +i 1 4 1 8.07 +i 1 5 1 8.05 +i 1 6 1 8.04 +i 1 7 1 8.02 +i 1 8 1 8.00 +i 1 9 1 8.00 +i 1 10 1 8.02 +i 1 11 1 8.04 +i 1 12 2 8.04 +i 1 14 2 8.02 + +; Repeat the melody with Instrument #2. +; p4 = frequency in pitch-class notation. +i 2 16 1 8.04 +i 2 17 1 8.04 +i 2 18 1 8.05 +i 2 19 1 8.07 +i 2 20 1 8.07 +i 2 21 1 8.05 +i 2 22 1 8.04 +i 2 23 1 8.02 +i 2 24 1 8.00 +i 2 25 1 8.00 +i 2 26 1 8.02 +i 2 27 1 8.04 +i 2 28 2 8.04 +i 2 30 2 8.02 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/adsyn.csd b/examples/adsyn.csd new file mode 100644 index 0000000..22dd512 --- /dev/null +++ b/examples/adsyn.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o adsyn.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; If the modulation amounts are set to 1, adsyn + ; will not perform any special modulation. + kamod init 1 + kfmod init 1 + ksmod init 1 + + ; Re-synthesizes the file "kickroll.het". + a1 adsyn kamod, kfmod, ksmod, "kickroll.het" + + out a1 * 32768 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/adsynt.csd b/examples/adsynt.csd new file mode 100644 index 0000000..efd641d --- /dev/null +++ b/examples/adsynt.csd @@ -0,0 +1,104 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o adsynt.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Generate a sinewave table. +giwave ftgen 1, 0, 1024, 10, 1 +; Generate two empty tables for adsynt. +gifrqs ftgen 2, 0, 32, 7, 0, 32, 0 +; A table for freqency and amp parameters. +giamps ftgen 3, 0, 32, 7, 0, 32, 0 + +; Generates parameters at init time +instr 1 + ; Generate 10 voices. + icnt = 10 + ; Init loop index. + index = 0 + +; Loop only executed at init time. +loop: + ; Define non-harmonic partials. + ifreq pow index + 1, 1.5 + ; Define amplitudes. + iamp = 1 / (index+1) + ; Write to tables. + tableiw ifreq, index, gifrqs + ; Used by adsynt. + tableiw iamp, index, giamps + + index = index + 1 + ; Do loop/ + if (index < icnt) igoto loop + + asig adsynt 5000, 150, giwave, gifrqs, giamps, icnt + out asig +endin + +; Generates parameters every k-cycle. +instr 2 + ; Generate 10 voices. + icnt = 10 + ; Reset loop index. + kindex = 0 + +; Loop executed every k-cycle. +loop: + ; Generate lfo for frequencies. + kspeed pow kindex + 1, 1.6 + ; Individual phase for each voice. + kphas phasorbnk kspeed * 0.7, kindex, icnt + klfo table kphas, giwave, 1 + ; Arbitrary parameter twiddling... + kdepth pow 1.4, kindex + kfreq pow kindex + 1, 1.5 + kfreq = kfreq + klfo*0.006*kdepth + + ; Write freqs to table for adsynt. + tablew kfreq, kindex, gifrqs + + ; Generate lfo for amplitudes. + kspeed pow kindex + 1, 0.8 + ; Individual phase for each voice. + kphas phasorbnk kspeed*0.13, kindex, icnt, 2 + klfo table kphas, giwave, 1 + ; Arbitrary parameter twiddling... + kamp pow 1 / (kindex + 1), 0.4 + kamp = kamp * (0.3+0.35*(klfo+1)) + + ; Write amps to table for adsynt. + tablew kamp, kindex, giamps + + kindex = kindex + 1 + ; Do loop. + if (kindex < icnt) kgoto loop + + asig adsynt 5000, 150, giwave, gifrqs, giamps, icnt + out asig +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 2.5 seconds. +i 1 0 2.5 +; Play Instrument #2 for 2.5 seconds. +i 2 3 2.5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/aftouch.csd b/examples/aftouch.csd new file mode 100644 index 0000000..ceafd49 --- /dev/null +++ b/examples/aftouch.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o aftouch.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + k1 aftouch + + printk2 k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 12 seconds. +i 1 0 12 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ahh.aiff b/examples/ahh.aiff Binary files differnew file mode 100644 index 0000000..0b9828b --- /dev/null +++ b/examples/ahh.aiff diff --git a/examples/alpass.csd b/examples/alpass.csd new file mode 100644 index 0000000..2dfeddc --- /dev/null +++ b/examples/alpass.csd @@ -0,0 +1,68 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o alpass.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the audio mixer. +gamix init 0 + +; Instrument #1. +instr 1 + ; Generate a source signal. + a1 oscili 30000, cpspch(p4), 1 + ; Output the direct sound. + out a1 + + ; Add the source signal to the audio mixer. + gamix = gamix + a1 +endin + +; Instrument #99 (highest instr number executed last) +instr 99 + krvt = 1.5 + ilpt = 0.1 + + ; Filter the mixed signal. + a99 alpass gamix, krvt, ilpt + ; Output the result. + out a99 + + ; Empty the mixer for the next pass. + gamix = 0 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 128 10 1 + +; p4 = frequency (in a pitch-class) +; Play Instrument #1 for a tenth of a second, p4=7.00 +i 1 0 0.1 7.00 +; Play Instrument #1 for a tenth of a second, p4=7.02 +i 1 1 0.1 7.02 +; Play Instrument #1 for a tenth of a second, p4=7.04 +i 1 2 0.1 7.04 +; Play Instrument #1 for a tenth of a second, p4=7.06 +i 1 3 0.1 7.06 + +; Make sure the filter remains active. +i 99 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ampdb.csd b/examples/ampdb.csd new file mode 100644 index 0000000..c355969 --- /dev/null +++ b/examples/ampdb.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ampdb.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + idb = 90 + iamp = ampdb(idb) + + print iamp +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ampdbfs.csd b/examples/ampdbfs.csd new file mode 100644 index 0000000..178d47d --- /dev/null +++ b/examples/ampdbfs.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ampdbfs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + idb = -1 + iamp = ampdbfs(idb) + + print iamp +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ampmidi.csd b/examples/ampmidi.csd new file mode 100644 index 0000000..9434d9c --- /dev/null +++ b/examples/ampmidi.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o ampmidi.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Scale the amplitude between 0 and 1. + ; This example expects MIDI note inputs on channel 1 + i1 ampmidi 1 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +;Dummy f-table to give time for real-time MIDI events +f 0 8000 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/areson.csd b/examples/areson.csd new file mode 100644 index 0000000..ccf5eec --- /dev/null +++ b/examples/areson.csd @@ -0,0 +1,53 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o areson.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - an unfiltered noise waveform. +instr 1 + ; Generate a white noise signal. + asig rand 20000 + + out asig +endin + + +; Instrument #2 - a filtered noise waveform. +instr 2 + ; Generate a white noise signal. + asig rand 20000 + + ; Filter it using the areson opcode. + kcf init 1000 + kbw init 100 + afilt areson asig, kcf, kbw + + ; Clip the filtered signal's amplitude to 85 dB. + a1 clip afilt, 2, ampdb(85) + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/assign.csd b/examples/assign.csd new file mode 100644 index 0000000..7c10e9d --- /dev/null +++ b/examples/assign.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o assign.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Assign a value to the variable i1. + i1 = 1234 + + ; Print the value of the i1 variable. + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/atone.csd b/examples/atone.csd new file mode 100644 index 0000000..4e6fef2 --- /dev/null +++ b/examples/atone.csd @@ -0,0 +1,52 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o atone.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - an unfiltered noise waveform. +instr 1 + ; Generate a white noise signal. + asig rand 20000 + + out asig +endin + + +; Instrument #2 - a filtered noise waveform. +instr 2 + ; Generate a white noise signal. + asig rand 20000 + + ; Filter it using the atone opcode. + khp init 2000 + afilt atone asig, khp + + ; Clip the filtered signal's amplitude to 85 dB. + a1 clip afilt, 2, ampdb(85) + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/babo.csd b/examples/babo.csd new file mode 100644 index 0000000..bfa2a92 --- /dev/null +++ b/examples/babo.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o babo.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Nicola Bernardini */ +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +; minimal babo instrument +; +instr 1 + ix = p4 ; x position of source + iy = p5 ; y position of source + iz = p6 ; z position of source + ixsize = p7 ; width of the resonator + iysize = p8 ; depth of the resonator + izsize = p9 ; height of the resonator + +ainput soundin "beats.wav" + +al,ar babo ainput*0.7, ix, iy, iz, ixsize, iysize, izsize + + outs al,ar +endin + + +</CsInstruments> +<CsScore> + +/* Written by Nicola Bernardini */ +; simple babo usage: +; +;p4 : x position of source +;p5 : y position of source +;p6 : z position of source +;p7 : width of the resonator +;p8 : depth of the resonator +;p9 : height of the resonator +; +i 1 0 10 6 4 3 14.39 11.86 10 +; ^^^^^^^ ^^^^^^^^^^^^^^ +; ||||||| ++++++++++++++: optimal room dims according to +; ||||||| Milner and Bernard JASA 85(2), 1989 +; +++++++++: source position +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/babo_expert.csd b/examples/babo_expert.csd new file mode 100644 index 0000000..dadbbf4 --- /dev/null +++ b/examples/babo_expert.csd @@ -0,0 +1,96 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o babo_expert.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Nicola Bernardini */ +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +; full blown babo instrument with movement +; +instr 2 + ixstart = p4 ; start x position of source (left-right) + ixend = p7 ; end x position of source + iystart = p5 ; start y position of source (front-back) + iyend = p8 ; end y position of source + izstart = p6 ; start z position of source (up-down) + izend = p9 ; end z position of source + ixsize = p10 ; width of the resonator + iysize = p11 ; depth of the resonator + izsize = p12 ; height of the resonator + idiff = p13 ; diffusion coefficient + iexpert = p14 ; power user values stored in this function + +ainput soundin "beats.wav" +ksource_x line ixstart, p3, ixend +ksource_y line iystart, p3, iyend +ksource_z line izstart, p3, izend + +al,ar babo ainput*0.7, ksource_x, ksource_y, ksource_z, ixsize, iysize, izsize, idiff, iexpert + + outs al,ar +endin + + +</CsInstruments> +<CsScore> + +/* Written by Nicola Bernardini */ +; full blown instrument +;p4 : start x position of source (left-right) +;p5 : end x position of source +;p6 : start y position of source (front-back) +;p7 : end y position of source +;p8 : start z position of source (up-down) +;p9 : end z position of source +;p10 : width of the resonator +;p11 : depth of the resonator +;p12 : height of the resonator +;p13 : diffusion coefficient +;p14 : power user values stored in this function + +; decay hidecay rx ry rz rdistance direct early_diff +f1 0 8 -2 0.95 0.95 0 0 0 0.3 0.5 0.8 ; brighter +f2 0 8 -2 0.95 0.5 0 0 0 0.3 0.5 0.8 ; default (to be set as) +f3 0 8 -2 0.95 0.01 0 0 0 0.3 0.5 0.8 ; darker +f4 0 8 -2 0.95 0.7 0 0 0 0.3 0.1 0.4 ; to hear the effect of diffusion +f5 0 8 -2 0.9 0.5 0 0 0 0.3 2.0 0.98 ; to hear the movement +f6 0 8 -2 0.99 0.1 0 0 0 0.3 0.5 0.8 ; default vals +; ^ +; ----- gen. number: negative to avoid rescaling + + +i2 0 10 6 4 3 6 4 3 14.39 11.86 10 1 6 ; defaults +i2 + 4 6 4 3 6 4 3 14.39 11.86 10 1 1 ; hear brightness 1 +i2 + 4 6 4 3 -6 -4 3 14.39 11.86 10 1 2 ; hear brightness 2 +i2 + 4 6 4 3 -6 -4 3 14.39 11.86 10 1 3 ; hear brightness 3 +i2 + 3 .6 .4 .3 -.6 -.4 .3 1.439 1.186 1.0 0.0 4 ; hear diffusion 1 +i2 + 3 .6 .4 .3 -.6 -.4 .3 1.439 1.186 1.0 1.0 4 ; hear diffusion 2 +i2 + 4 12 4 3 -12 -4 -3 24.39 21.86 20 1 5 ; hear movement +; +i2 + 4 6 4 3 6 4 3 14.39 11.86 10 1 1 ; hear brightness 1 +i2 + 4 6 4 3 -6 -4 3 14.39 11.86 10 1 2 ; hear brightness 2 +i2 + 4 6 4 3 -6 -4 3 14.39 11.86 10 1 3 ; hear brightness 3 +i2 + 3 .6 .4 .3 -.6 -.4 .3 1.439 1.186 1.0 0.0 4 ; hear diffusion 1 +i2 + 3 .6 .4 .3 -.6 -.4 .3 1.439 1.186 1.0 1.0 4 ; hear diffusion 2 +i2 + 4 12 4 3 -12 -4 -3 24.39 21.86 20 1 5 ; hear movement +; ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^ ^ +; ||||||||||||||||||| ||||||||||||||||| | --: expert values function +; ||||||||||||||||||| ||||||||||||||||| +--: diffusion +; ||||||||||||||||||| ----------------: optimal room dims according to Milner and Bernard JASA 85(2), 1989 +; ||||||||||||||||||| +; --------------------: source position start and end +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/balance.csd b/examples/balance.csd new file mode 100644 index 0000000..5faad69 --- /dev/null +++ b/examples/balance.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o balance.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a band-limited pulse train. + asrc buzz 30000, 440, sr/440, 1 + + ; Send the source signal through 2 filters. + a1 reson asrc, 1000, 100 + a2 reson a1, 3000, 500 + + ; Balance the filtered signal with the source. + afin balance a2, asrc + + out afin +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/bamboo.csd b/examples/bamboo.csd new file mode 100644 index 0000000..b1c2375 --- /dev/null +++ b/examples/bamboo.csd @@ -0,0 +1,30 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o bamboo.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 01 ;example of bamboo +a1 bamboo p4, 0.01 + out a1 + endin + + +</CsInstruments> +<CsScore> + +i1 0 1 20000 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/barmodel.csd b/examples/barmodel.csd new file mode 100644 index 0000000..0ba9986 --- /dev/null +++ b/examples/barmodel.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o barmodel.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. + sr = 44100 + kr = 4410 + ksmps = 10 + nchnls = 1 + +; Instrument #1. +instr 1 + aq barmodel 1, 1, p4, 0.001, 0.23, 5, p5, p6, p7 + out aq +endin + + +</CsInstruments> +<CsScore> + + +i1 0.0 0.5 3 0.2 500 0.05 +i1 0.5 0.5 -3 0.3 1000 0.05 +i1 1.0 0.5 -3 0.4 1000 0.1 +i1 1.5 4.0 -3 0.5 800 0.05 +e +/* barmodel */ + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/bbcutm.csd b/examples/bbcutm.csd new file mode 100644 index 0000000..40822a9 --- /dev/null +++ b/examples/bbcutm.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o bbcutm.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - Play an audio file normally. +instr 1 + asource soundin "beats.wav" + out asource +endin + +; Instrument #2 - Cut-up an audio file. +instr 2 + asource soundin "beats.wav" + + ibps = 4 + isubdiv = 8 + ibarlength = 4 + iphrasebars = 1 + inumrepeats = 2 + + a1 bbcutm asource, ibps, isubdiv, ibarlength, iphrasebars, inumrepeats + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 3 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/beats.wav b/examples/beats.wav Binary files differnew file mode 100644 index 0000000..1d4e9cf --- /dev/null +++ b/examples/beats.wav diff --git a/examples/betarand.csd b/examples/betarand.csd new file mode 100644 index 0000000..347fe4d --- /dev/null +++ b/examples/betarand.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o betarand.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a number between 0 and 1 with a + ; uniform distribution. + ; krange = 1 + ; kalpha = 1 + ; kbeta = 1 + + i1 betarand 1, 1, 1 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/bexprnd.csd b/examples/bexprnd.csd new file mode 100644 index 0000000..2ae60ba --- /dev/null +++ b/examples/bexprnd.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o bexprnd.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number between -1 and 1. + ; krange = 1 + + i1 bexprnd 1 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/bformenc.csd b/examples/bformenc.csd new file mode 100644 index 0000000..49ba647 --- /dev/null +++ b/examples/bformenc.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +;-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: + -o bformenc.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 8 + +instr 1 + ; generate pink noise + anoise pinkish 1000 + + ; two full turns + kalpha line 0, p3, 720 + kbeta = 0 + + ; fade ambisonic order from 2nd to 0th during second turn + kord0 = 1 + kord1 linseg 1, p3 / 2, 1, p3 / 2, 0 + kord2 linseg 1, p3 / 2, 1, p3 / 2, 0 + + ; generate B format + aw, ax, ay, az, ar, as, at, au, av bformenc anoise, kalpha, kbeta, kord0, kord1, kord2 + + ; decode B format for 8 channel circle loudspeaker setup + a1, a2, a3, a4, a5, a6, a7, a8 bformdec 4, aw, ax, ay, az, ar, as, at, au, av + + ; write audio out + outo a1, a2, a3, a4, a5, a6, a7, a8 +endin + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 20 seconds. +i 1 0 20 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/biquad-2.csd b/examples/biquad-2.csd new file mode 100644 index 0000000..72e6584 --- /dev/null +++ b/examples/biquad-2.csd @@ -0,0 +1,139 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o biquad-2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +/* modal synthesis using biquad filters as oscillators + Example by Scott Lindroth 2007 */ + + +instr 1 + + ipi = 3.1415926 + idenom = sr*0.5 + + ipulseSpd = p4 + icps = p5 + ipan = p6 + iamp = p7 + iModes = p8 + + apulse mpulse iamp, 0 + + icps = cpspch( icps ) + + ; filter gain + + iamp1 = 600 + iamp2 = 1000 + iamp3 = 1000 + iamp4 = 1000 + iamp5 = 1000 + iamp6 = 1000 + + ; resonance + + irpole1 = 0.99999 + irpole2 = irpole12 + irpole3 = irpole13 + irpole4 = irpole14 + irpole5 = irpole15 + irpole6 = irpole16 + + ; modal frequencies + + if (iModes == 1) goto modes1 + if (iModes == 2) goto modes2 + + modes1: + if1 = icps * 1 ;pot lid + if2 = icps * 6.27 + if3 = icps * 3.2 + if4 = icps * 9.92 + if5 = icps * 14.15 + if6 = icps * 6.23 + goto nextPart + + modes2: + if1 = icps * 1 ;uniform wood bar + if2 = icps * 2.572 + if3 = icps * 4.644 + if4 = icps * 6.984 + if5 = icps * 9.723 + if6 = icps * 12.0 + goto nextPart + + nextPart: + + ; convert frequency to radian frequency + + itheta1 = (if1/idenom) * ipi + itheta2 = (if2/idenom) * ipi + itheta3 = (if3/idenom) * ipi + itheta4 = (if4/idenom) * ipi + itheta5 = (if5/idenom) * ipi + itheta6 = (if6/idenom) * ipi + + ; calculate coefficients + + ib11 = -2 * irpole1 * cos(itheta1) + ib21 = irpole1 * irpole1 + ib12 = -2 * irpole2 * cos(itheta2) + ib22 = irpole2 * irpole2 + ib13 = -2 * irpole3 * cos(itheta3) + ib23 = irpole3 * irpole3 + ib14 = -2 * irpole4 * cos(itheta4) + ib24 = irpole4 * irpole4 + ib15 = -2 * irpole5 * cos(itheta5) + ib25 = irpole5 * irpole5 + ib16 = -2 * irpole6 * cos(itheta6) + ib26 = irpole6 * irpole6 + + ;printk 1, ib 11 + ;printk 1, ib 21 + + ; also try setting the -1 coeff. to 0, but be sure to scale down the amplitude! + + asin1 biquad apulse * iamp1, 1, 0, -1, 1, ib11, ib21 + asin2 biquad apulse * iamp2, 1, 0, -1, 1, ib12, ib22 + asin3 biquad apulse * iamp3, 1, 0, -1, 1, ib13, ib23 + asin4 biquad apulse * iamp4, 1, 0, -1, 1, ib14, ib24 + asin5 biquad apulse * iamp5, 1, 0, -1, 1, ib15, ib25 + asin6 biquad apulse * iamp6, 1, 0, -1, 1, ib16, ib26 + + + afin = (asin1 + asin2 + asin3 + asin4 + asin5 + asin6) + + outs afin * sqrt(p6), afin*sqrt(1-p6) + +endin +</CsInstruments> +<CsScore> +;ins st dur pulseSpd pch pan amp Modes +i1 0 12 0 7.089 0 0.7 2 +i1 . . . 7.09 1 . . +i1 . . . 7.091 0.5 . . + +i1 0 12 0 8.039 0 0.7 2 +i1 0 12 0 8.04 1 0.7 2 +i1 0 12 0 8.041 0.5 0.7 2 + +i1 9 . . 7.089 0 . 2 +i1 . . . 7.09 1 . . +i1 . . . 7.091 0.5 . . + +i1 9 12 0 8.019 0 0.7 2 +i1 9 12 0 8.02 1 0.7 2 +i1 9 12 0 8.021 0.5 0.7 2 +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/biquad.csd b/examples/biquad.csd new file mode 100644 index 0000000..8f34c27 --- /dev/null +++ b/examples/biquad.csd @@ -0,0 +1,63 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o biquad.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +; Instrument #1. +instr 1 + ; Get the values from the score. + idur = p3 + iamp = p4 + icps = cpspch(p5) + kfco = p6 + krez = p7 + + ; Calculate the biquadratic filter's coefficients + kfcon = 2*3.14159265*kfco/sr + kalpha = 1-2*krez*cos(kfcon)*cos(kfcon)+krez*krez*cos(2*kfcon) + kbeta = krez*krez*sin(2*kfcon)-2*krez*cos(kfcon)*sin(kfcon) + kgama = 1+cos(kfcon) + km1 = kalpha*kgama+kbeta*sin(kfcon) + km2 = kalpha*kgama-kbeta*sin(kfcon) + kden = sqrt(km1*km1+km2*km2) + kb0 = 1.5*(kalpha*kalpha+kbeta*kbeta)/kden + kb1 = kb0 + kb2 = 0 + ka0 = 1 + ka1 = -2*krez*cos(kfcon) + ka2 = krez*krez + + ; Generate an input signal. + axn vco 1, icps, 1 + + ; Filter the input signal. + ayn biquad axn, kb0, kb1, kb2, ka0, ka1, ka2 + outs ayn*iamp/2, ayn*iamp/2 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Sta Dur Amp Pitch Fco Rez +i 1 0.0 1.0 20000 6.00 1000 .8 +i 1 1.0 1.0 20000 6.03 2000 .95 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/birnd.csd b/examples/birnd.csd new file mode 100644 index 0000000..d8fec3e --- /dev/null +++ b/examples/birnd.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o birnd.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number from -1 to 1. + i1 = birnd(1) + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #1 for one second. +i 1 1 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/bqrez.csd b/examples/bqrez.csd new file mode 100644 index 0000000..ba5e11d --- /dev/null +++ b/examples/bqrez.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o bqrez.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Matt Gerassimof from example by Kevin Conder */ +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a nice sawtooth waveform. + asig vco 16000, 220, 1 + + ; Vary the filter-cutoff frequency from .2 to 2 KHz. + kfco line 200, p3, 2000 + + ; Set the resonance amount. + kres init 0.99 + + a1 bqrez asig, kfco, kres + + out a1 +endin + + +</CsInstruments> +<CsScore> + +/* Written by Matt Gerassimof from example by Kevin Conder */ +; Table #1, a sine wave for the vco opcode. +f 1 0 16384 10 1 + +; Play Instrument #1 for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/butterbp.csd b/examples/butterbp.csd new file mode 100644 index 0000000..1bf23a1 --- /dev/null +++ b/examples/butterbp.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o butterbp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - an unfiltered noise waveform. +instr 1 + ; White noise signal + asig rand 22050 + + out asig +endin + + +; Instrument #2 - a filtered noise waveform. +instr 2 + ; White noise signal + asig rand 22050 + + ; Filter it, passing only 1950 to 2050 Hz. + abp butterbp asig, 2000, 100 + + out abp +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/butterbr.csd b/examples/butterbr.csd new file mode 100644 index 0000000..443d62f --- /dev/null +++ b/examples/butterbr.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o butterbr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - an unfiltered noise waveform. +instr 1 + ; White noise signal + asig rand 22050 + + out asig +endin + + +; Instrument #2 - a filtered noise waveform. +instr 2 + ; White noise signal + asig rand 22050 + + ; Filter it, cutting 2000 to 6000 Hz. + abr butterbr asig, 4000, 2000 + + out abr +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/butterhp.csd b/examples/butterhp.csd new file mode 100644 index 0000000..939c2ba --- /dev/null +++ b/examples/butterhp.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in Silent +-odac -idac -d ;;;realtime output +; For Non-realtime ouput leave only the line below: +; -o butterhp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - an unfiltered noise waveform. +instr 1 + ; White noise signal + asig rand 22050 + + out asig +endin + + +; Instrument #2 - a filtered noise waveform. +instr 2 + ; White noise signal + asig rand 22050 + + ; Filter it, passing frequencies above 250 Hz. + ahp butterhp asig, 250 + + out ahp +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/butterlp.csd b/examples/butterlp.csd new file mode 100644 index 0000000..33b1d6d --- /dev/null +++ b/examples/butterlp.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o butterlp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - an unfiltered noise waveform. +instr 1 + ; White noise signal + asig rand 22050 + + out asig +endin + + +; Instrument #2 - a filtered noise waveform. +instr 2 + ; White noise signal + asig rand 22050 + + ; Filter it, cutting frequencies above 1 KHz. + alp butterlp asig, 1000 + + out alp +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/buzz.csd b/examples/buzz.csd new file mode 100644 index 0000000..1c2d32e --- /dev/null +++ b/examples/buzz.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o buzz.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 20000 + kcps = 440 + knh = 3 + ifn = 1 + + a1 buzz kamp, kcps, knh, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cabasa.csd b/examples/cabasa.csd new file mode 100644 index 0000000..80c1205 --- /dev/null +++ b/examples/cabasa.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cabasa.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +;orchestra --------------- + + sr = 44100 + kr = 4410 + ksmps = 10 + nchnls = 1 + + instr 01 ;an example of a cabasa +a1 cabasa p4, 0.01 + out a1 + endin + + +</CsInstruments> +<CsScore> + +;score ------------------- + + i1 0 1 26000 + e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cauchy.csd b/examples/cauchy.csd new file mode 100644 index 0000000..52a4831 --- /dev/null +++ b/examples/cauchy.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cauchy.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number, spread from 10. + ; kalpha = 10 + + i1 cauchy 10 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cent.csd b/examples/cent.csd new file mode 100644 index 0000000..209edef --- /dev/null +++ b/examples/cent.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cent.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; The root note is A above middle-C (440 Hz) + iroot = 440 + + ; Raise the root note by 300 cents to C. + icents = 300 + + ; Calculate the new note. + ifactor = cent(icents) + inew = iroot * ifactor + + ; Print out of all of the values. + print iroot + print ifactor + print inew +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cggoto.csd b/examples/cggoto.csd new file mode 100644 index 0000000..686c684 --- /dev/null +++ b/examples/cggoto.csd @@ -0,0 +1,52 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cggoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = p4 + + ; If i1 is equal to one, play a high note. + ; Otherwise play a low note. + cggoto (i1 == 1), highnote + +lownote: + a1 oscil 10000, 220, 1 + goto playit + +highnote: + a1 oscil 10000, 440, 1 + goto playit + +playit: + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a simple sine wave. +f 1 0 32768 10 1 + +; Play lownote for one second. +i 1 0 1 1 +; Play highnote for one second. +i 1 0 1 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/changed.csd b/examples/changed.csd new file mode 100644 index 0000000..64a7dd5 --- /dev/null +++ b/examples/changed.csd @@ -0,0 +1,27 @@ +<CsoundSynthesizer> +<CsOptions> +-odac -B441 -b441 +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 100 +ksmps = 441 +nchnls = 2 + + instr 1 +ksig oscil 2,0.5,1 +kint = int(ksig) +ktrig changed kint +printk 0.2, kint +printk2 ktrig + endin + +</CsInstruments> +<CsScore> +f 1 0 1024 10 1 +i 1 0 20 + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/chebyshevpoly.csd b/examples/chebyshevpoly.csd new file mode 100644 index 0000000..fcb3775 --- /dev/null +++ b/examples/chebyshevpoly.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o abs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 441 + +; time-varying mixture of first six harmonics +instr 1 + ; According to the GEN13 manual entry, + ; the pattern + - - + + - - for the signs of + ; the chebyshev coefficients has nice properties. + + ; these six lines control the relative powers of the harmonics + k1 line 1.0, p3, 0.0 + k2 line -0.5, p3, 0.0 + k3 line -0.333, p3, -1.0 + k4 line 0.0, p3, 0.5 + k5 line 0.0, p3, 0.7 + k6 line 0.0, p3, -1.0 + + ; play the sine wave at a frequency of 256 Hz + ax oscili 1.0, 256, 1 + + ; waveshape it + ay chebyshevpoly ax, 0, k1, k2, k3, k4, k5, k6 + + ; avoid clicks, scale final amplitude, and output + adeclick linseg 0.0, 0.05, 1.0, p3 - 0.1, 1.0, 0.05, 0.0 + out ay * adeclick * 10000 +endin + +</CsInstruments> +<CsScore> +f1 0 32768 10 1 ; a sine wave + +i1 0 5 +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/checkbox.csd b/examples/checkbox.csd new file mode 100644 index 0000000..3771d8f --- /dev/null +++ b/examples/checkbox.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o checkbox.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +instr 1 + ; Get the value from the checkbox. + k1 checkbox 1 + + ; If the checkbox is selected then k2=440, otherwise k2=880. + k2 = (k1 == 0 ? 440 : 880) + + a1 oscil 10000, k2, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Just generate a nice, ordinary sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for ten seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cigoto.csd b/examples/cigoto.csd new file mode 100644 index 0000000..d4df895 --- /dev/null +++ b/examples/cigoto.csd @@ -0,0 +1,60 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Get the value of the 4th p-field from the score. + iparam = p4 + + ; If iparam is 1 then play the high note. + ; If not then play the low note. + cigoto (iparam ==1), highnote + igoto lownote + +highnote: + ifreq = 880 + goto playit + +lownote: + ifreq = 440 + goto playit + +playit: + ; Print the values of iparam and ifreq. + print iparam + print ifreq + + a1 oscil 10000, ifreq, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a simple sine wave. +f 1 0 32768 10 1 + +; p4: 1 = high note, anything else = low note +; Play Instrument #1 for one second, a low note. +i 1 0 1 0 +; Play a Instrument #1 for one second, a high note. +i 1 1 1 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ckgoto.csd b/examples/ckgoto.csd new file mode 100644 index 0000000..0a80ef0 --- /dev/null +++ b/examples/ckgoto.csd @@ -0,0 +1,57 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ckgoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Change kval linearly from 0 to 2 over + ; the period set by the third p-field. + kval line 0, p3, 2 + + ; If kval is greater than or equal to 1 then play the high note. + ; If not then play the low note. + ckgoto (kval >= 1), highnote + kgoto lownote + +highnote: + kfreq = 880 + goto playit + +lownote: + kfreq = 440 + goto playit + +playit: + ; Print the values of kval and kfreq. + printks "kval = %f, kfreq = %f\\n", 1, kval, kfreq + + a1 oscil 10000, kfreq, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table: a simple sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/clfilt_highpass.csd b/examples/clfilt_highpass.csd new file mode 100644 index 0000000..2630f61 --- /dev/null +++ b/examples/clfilt_highpass.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o clfilt_highpass.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - an unfiltered noise waveform. +instr 1 + ; White noise signal + asig rand 22050 + + out asig +endin + + +; Instrument #2 - a filtered noise waveform. +instr 2 + ; White noise signal + asig rand 22050 + + ; Highpass filter signal asig with a 6-pole Chebyshev + ; Type I at 20 Hz with 3 dB of passband ripple. + a1 clfilt asig, 20, 1, 6, 1, 3 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/clfilt_lowpass.csd b/examples/clfilt_lowpass.csd new file mode 100644 index 0000000..0acdf62 --- /dev/null +++ b/examples/clfilt_lowpass.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o clfilt_lowpass.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - an unfiltered noise waveform. +instr 1 + ; White noise signal + asig rand 22050 + + out asig +endin + + +; Instrument #2 - a filtered noise waveform. +instr 2 + ; White noise signal + asig rand 22050 + + ; Lowpass filter signal asig with a + ; 10-pole Butterworth at 500 Hz. + a1 clfilt asig, 500, 0, 10 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/clip.csd b/examples/clip.csd new file mode 100644 index 0000000..96502c5 --- /dev/null +++ b/examples/clip.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o clip.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a noisy waveform. + arnd rand 44100 + ; Clip the noisy waveform's amplitude to 20,000 + a1 clip arnd, 2, 20000 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cngoto.csd b/examples/cngoto.csd new file mode 100644 index 0000000..badca76 --- /dev/null +++ b/examples/cngoto.csd @@ -0,0 +1,57 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cngoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Change kval linearly from 0 to 2 over + ; the period set by the third p-field. + kval line 0, p3, 2 + + ; If kval *is not* greater than or equal to 1 then play + ; the high note. Otherwise, play the low note. + cngoto (kval >= 1), highnote + kgoto lownote + +highnote: + kfreq = 880 + goto playit + +lownote: + kfreq = 440 + goto playit + +playit: + ; Print the values of kval and kfreq. + printks "kval = %f, kfreq = %f\\n", 1, kval, kfreq + + a1 oscil 10000, kfreq, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table: a simple sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/comb.csd b/examples/comb.csd new file mode 100644 index 0000000..14a1572 --- /dev/null +++ b/examples/comb.csd @@ -0,0 +1,68 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o comb.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the audio mixer. +gamix init 0 + +; Instrument #1. +instr 1 + ; Generate a source signal. + a1 oscili 30000, cpspch(p4), 1 + ; Output the direct sound. + out a1 + + ; Add the source signal to the audio mixer. + gamix = gamix + a1 +endin + +; Instrument #99 (highest instr number executed last) +instr 99 + krvt = 1.5 + ilpt = 0.1 + + ; Comb-filter the mixed signal. + a99 comb gamix, krvt, ilpt + ; Output the result. + out a99 + + ; Empty the mixer for the next pass. + gamix = 0 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 128 10 1 + +; p4 = frequency (in a pitch-class) +; Play Instrument #1 for a tenth of a second, p4=7.00 +i 1 0 0.1 7.00 +; Play Instrument #1 for a tenth of a second, p4=7.02 +i 1 1 0.1 7.02 +; Play Instrument #1 for a tenth of a second, p4=7.04 +i 1 2 0.1 7.04 +; Play Instrument #1 for a tenth of a second, p4=7.06 +i 1 3 0.1 7.06 + +; Make sure the comb-filter remains active. +i 99 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cos.csd b/examples/cos.csd new file mode 100644 index 0000000..cf151a3 --- /dev/null +++ b/examples/cos.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cos.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + irad = 25 + i1 = cos(irad) + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cosh.csd b/examples/cosh.csd new file mode 100644 index 0000000..758704e --- /dev/null +++ b/examples/cosh.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cosh.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + irad = 1 + i1 = cosh(irad) + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cosinv.csd b/examples/cosinv.csd new file mode 100644 index 0000000..61f6716 --- /dev/null +++ b/examples/cosinv.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cosinv.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + irad = 0.5 + i1 = cosinv(irad) + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cps2pch.csd b/examples/cps2pch.csd new file mode 100644 index 0000000..1ee4373 --- /dev/null +++ b/examples/cps2pch.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cps2pch.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a normal twelve-tone scale. + ipch = 8.02 + iequal = 12 + + icps cps2pch ipch, iequal + + print icps +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cps2pch_19et.csd b/examples/cps2pch_19et.csd new file mode 100644 index 0000000..ef889a6 --- /dev/null +++ b/examples/cps2pch_19et.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cps2pch_19et.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use 19ET scale. + ipch = 8.02 + iequal = 19 + + icps cps2pch ipch, iequal + + print icps +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cps2pch_ftable.csd b/examples/cps2pch_ftable.csd new file mode 100644 index 0000000..9997b19 --- /dev/null +++ b/examples/cps2pch_ftable.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cps2pch_ftable.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ipch = 8.02 + + ; Use Table #1, a table of frequency multipliers. + icps cps2pch ipch, -1 + + print icps +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a table of frequency multipliers. +; Creates a 10-note scale of unequal divisions. +f 1 0 16 -2 1 1.1 1.2 1.3 1.4 1.6 1.7 1.8 1.9 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpsmidi.csd b/examples/cpsmidi.csd new file mode 100644 index 0000000..b568f5d --- /dev/null +++ b/examples/cpsmidi.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o cpsmidi.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 cpsmidi + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 12 seconds. +i 1 0 12 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpsmidib.csd b/examples/cpsmidib.csd new file mode 100644 index 0000000..2aace95 --- /dev/null +++ b/examples/cpsmidib.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o cpsmidib.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 cpsmidib + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 12 seconds. +i 1 0 12 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpsmidinn.csd b/examples/cpsmidinn.csd new file mode 100644 index 0000000..1b942eb --- /dev/null +++ b/examples/cpsmidinn.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +; Prints a table showing the equivalents of all Midi +; note numbers from 0-127 in cycles-per-second, +; octave.decimal, and octave.pitchclass units. + +<CsOptions> +; Select audio/midi flags here according to platform. +; This example produces no audio, so we render in +; non-realtime and turn off sound to disk: +-n +</CsOptions> +<CsInstruments> + +instr 1 + ; i-time loop to print conversion table + imidiNN = 0 + loop1: + icps = cpsmidinn(imidiNN) + ioct = octmidinn(imidiNN) + ipch = pchmidinn(imidiNN) + + print imidiNN, icps, ioct, ipch + + imidiNN = imidiNN + 1 + if (imidiNN < 128) igoto loop1 +endin + +instr 2 + ; test k-rate converters + kMiddleC = 60 + kcps = cpsmidinn(kMiddleC) + koct = octmidinn(kMiddleC) + kpch = pchmidinn(kMiddleC) + + printks "%d %f %f %f\n", 1.0, kMiddleC, kcps, koct, kpch +endin + +</CsInstruments> +<CsScore> +i1 0 0 +i2 0 0.1 +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpsoct.csd b/examples/cpsoct.csd new file mode 100644 index 0000000..215cf97 --- /dev/null +++ b/examples/cpsoct.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cpsoct.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Convert an octave-point-decimal value into a + ; cycles-per-second value. + ioct = 8.75 + icps = cpsoct(ioct) + + print icps +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpspch.csd b/examples/cpspch.csd new file mode 100644 index 0000000..5229395 --- /dev/null +++ b/examples/cpspch.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cpspch.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Convert a pitch-class value into a + ; cycles-per-second value. + ipch = 8.09 + icps = cpspch(ipch) + + print icps +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpstmid.csd b/examples/cpstmid.csd new file mode 100644 index 0000000..8cf3804 --- /dev/null +++ b/examples/cpstmid.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o cpstmid.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Table #1, a normal 12-tone equal temperament scale. +; numgrades = 12 (twelve tones) +; interval = 2 (one octave) +; basefreq = 261.659 (Middle C) +; basekeymidi = 60 (Middle C) +gitemp ftgen 1, 0, 64, -2, 12, 2, 261.659, 60, 1.00, \ + 1.059, 1.122, 1.189, 1.260, 1.335, 1.414, \ + 1.498, 1.588, 1.682, 1.782, 1.888, 2.000 + +; Instrument #1. +instr 1 + ; Use Table #1. + ifn = 1 + i1 cpstmid ifn + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 12 seconds. +i 1 0 12 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpstun.csd b/examples/cpstun.csd new file mode 100644 index 0000000..3550557 --- /dev/null +++ b/examples/cpstun.csd @@ -0,0 +1,53 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cpstun.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Table #1, a normal 12-tone equal temperament scale. +; numgrades = 12 (twelve tones) +; interval = 2 (one octave) +; basefreq = 261.659 (Middle C) +; basekeymidi = 60 (Middle C) +gitemp ftgen 1, 0, 64, -2, 12, 2, 261.659, 60, 1.00, \ + 1.059, 1.122, 1.189, 1.260, 1.335, 1.414, \ + 1.498, 1.588, 1.682, 1.782, 1.888, 2.000 + +; Instrument #1. +instr 1 + ; Set the trigger. + ktrig init 1 + + ; Use Table #1. + kfn init 1 + + ; If the base key (note #60) is C, then 9 notes + ; above it (note #60 + 9 = note #69) should be A. + kindex init 69 + + k1 cpstun ktrig, kindex, kfn + + printk2 k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpstuni.csd b/examples/cpstuni.csd new file mode 100644 index 0000000..f3c9cc3 --- /dev/null +++ b/examples/cpstuni.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cpstuni.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Table #1, a normal 12-tone equal temperament scale. +; numgrades = 12 (twelve tones) +; interval = 2 (one octave) +; basefreq = 261.659 (Middle C) +; basekeymidi = 60 (Middle C) +gitemp ftgen 1, 0, 64, -2, 12, 2, 261.659, 60, 1.00, \ + 1.059, 1.122, 1.189, 1.260, 1.335, 1.414, \ + 1.498, 1.588, 1.682, 1.782, 1.888, 2.000 + +; Instrument #1. +instr 1 + ; Use Table #1. + ifn = 1 + + ; If the base key (note #60) is C, then 9 notes + ; above it (note #60 + 9 = note #69) should be A. + index = 69 + + i1 cpstuni index, ifn + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpsxpch.csd b/examples/cpsxpch.csd new file mode 100644 index 0000000..7593438 --- /dev/null +++ b/examples/cpsxpch.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cpsxpch.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a normal twelve-tone scale. + ipch = 8.02 + iequal = 12 + irepeat = 2 + ibase = 1.02197503906 + + icps cpsxpch ipch, iequal, irepeat, ibase + + print icps +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpsxpch_105et.csd b/examples/cpsxpch_105et.csd new file mode 100644 index 0000000..b68f490 --- /dev/null +++ b/examples/cpsxpch_105et.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cpsxpch_105et.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a 10.5ET scale. + ipch = 4.02 + iequal = 21 + irepeat = 4 + ibase = 16.35160062496 + + icps cpsxpch ipch, iequal, irepeat, ibase + + print icps +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpsxpch_pierce.csd b/examples/cpsxpch_pierce.csd new file mode 100644 index 0000000..282a2c5 --- /dev/null +++ b/examples/cpsxpch_pierce.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cpsxpch_pierce.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a Pierce scale centered on middle A. + ipch = 2.02 + iequal = 12 + irepeat = 3 + ibase = 261.62561 + + icps cpsxpch ipch, iequal, irepeat, ibase + + print icps +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cpuprc.csd b/examples/cpuprc.csd new file mode 100644 index 0000000..99f3e85 --- /dev/null +++ b/examples/cpuprc.csd @@ -0,0 +1,39 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cpuprc.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Limit Instrument #1 to 5% of the CPU processing time. +cpuprc 1, 5 + +; Instrument #1 +instr 1 + a1 oscil 10000, 440, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Just generate a nice, ordinary sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/cross2.csd b/examples/cross2.csd new file mode 100644 index 0000000..22c3f1e --- /dev/null +++ b/examples/cross2.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cross2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - Play an audio file. +instr 1 + ; Use the "beats.wav" audio file. + aout soundin "beats.wav" + out aout +endin + +; Instrument #2 - Cross-synthesize! +instr 2 + ; Use the "ahh" sound stored in Table #1. + ain1 loscil 30000, 1, 1, 1 + ; Use the "beats.wav" audio file. + ain2 soundin "beats.wav" + + isize = 4096 + ioverlap = 2 + iwin = 2 + kbias init 1 + + aout cross2 ain1, ain2, isize, ioverlap, iwin, kbias + + out aout +endin + + +</CsInstruments> +<CsScore> + +; Table #1: An audio file. +f 1 0 128 1 "ahh.aiff" 0 4 0 +; Table #2: A windowing function. +f 2 0 2048 20 2 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +; Play Instrument #2 for 2 seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/crunch.csd b/examples/crunch.csd new file mode 100644 index 0000000..edfbe17 --- /dev/null +++ b/examples/crunch.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o crunch.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +;orchestra --------------- + + sr = 44100 + kr = 4410 + ksmps = 10 + nchnls = 1 + +instr 01 ;an example of a crunch +a1 crunch p4, 0.01 + out a1 + endin + + +</CsInstruments> +<CsScore> + +;score ------------------- + + i1 0 1 26000 + e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/dam.csd b/examples/dam.csd new file mode 100644 index 0000000..6256d1e --- /dev/null +++ b/examples/dam.csd @@ -0,0 +1,71 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +;-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o dam.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1, uncompressed signal. +instr 1 + ; Use the "beats.wav" audio file. + asig soundin "beats.wav" + + out asig +endin + +; Instrument #2, compressed signal. +instr 2 + ; Use the "beats.wav" audio file. + asig soundin "beats.wav" + + ; Compress the audio signal. + kthreshold = 25000 + icomp1 = 0.5 + icomp2 = 0.763 + irtime = 0.1 + iftime = 0.1 + a1 dam asig, kthreshold, icomp1, icomp2, irtime, iftime + + out a1 +endin + +; Instrument #3, compressed signal. +instr 3 + ; Use the "beats.wav" audio file. + asig soundin "beats.wav" + + ; Compress the audio signal. + kthreshold line 25000, p3, 4410000 + icomp1 = 0.5 + icomp2 = 0.763 + irtime = 0.1 + iftime = 0.1 + a1 dam asig, kthreshold, icomp1, icomp2, irtime, iftime + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +; Play Instrument #2 for 2 seconds. +i 2 2 2 +; Play Instrument #3 for 2 seconds. +i 3 4 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/dam_expanded.csd b/examples/dam_expanded.csd new file mode 100644 index 0000000..603c5a5 --- /dev/null +++ b/examples/dam_expanded.csd @@ -0,0 +1,53 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o dam_expanded.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1, normal audio signal. +instr 1 + ; Use the "mary.wav" audio file. + asig soundin "mary.wav" + + out asig +endin + +; Instrument #2, expanded audio signal. +instr 2 + ; Use the "mary.wav" audio file. + asig soundin "mary.wav" + + ; Expand the audio signal. + kthreshold init 7500 + icomp1 = 2.25 + icomp2 = 2.25 + irtime = 0.1 + iftime = 0.6 + a1 dam asig, kthreshold, icomp1, icomp2, irtime, iftime + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1. +i 1 0.0 3.5 +; Play Instrument #2. +i 2 3.5 3.5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/date.csd b/examples/date.csd new file mode 100644 index 0000000..c579027 --- /dev/null +++ b/examples/date.csd @@ -0,0 +1,28 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o date.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +instr 1 + ii date + print ii + Sa dates ii + prints Sa + Ss dates -1 + prints Ss + St dates 1 + prints St +endin + +</CsInstruments> + +<CsScore> +i 1 0 1 +e +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/db.csd b/examples/db.csd new file mode 100644 index 0000000..657c714 --- /dev/null +++ b/examples/db.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o db.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Calculate the amplitude of 40 decibels. + idecibels = 40 + iamp = db(idecibels) + + print iamp +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/dbamp.csd b/examples/dbamp.csd new file mode 100644 index 0000000..5f09249 --- /dev/null +++ b/examples/dbamp.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o dbamp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + iamp = 30000 + idb = dbamp(iamp) + + print idb +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/dbfsamp.csd b/examples/dbfsamp.csd new file mode 100644 index 0000000..c74e074 --- /dev/null +++ b/examples/dbfsamp.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o dbfsamp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + iamp = 30000 + idb = dbfsamp(iamp) + + print idb +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/dcblock.csd b/examples/dcblock.csd new file mode 100644 index 0000000..ffb50df --- /dev/null +++ b/examples/dcblock.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o dcblock.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 -- normal audio signal. +instr 1 + asig soundin "beats.wav" + out asig +endin + +; Instrument #2 -- dcblock-ed audio signal. +instr 2 + asig soundin "beats.wav" + + igain = 0.75 + a1 dcblock asig, igain + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +; Play Instrument #2 for 2 seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/dconv.csd b/examples/dconv.csd new file mode 100644 index 0000000..2ced613 --- /dev/null +++ b/examples/dconv.csd @@ -0,0 +1,59 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o dconv.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +#define RANDI(A) #kout randi 1, kfq, $A*.001+iseed, 1 + tablew kout, $A, itable# + +instr 1 +itable init 1 +iseed init .6 +isize init ftlen(itable) +kfq line 1, p3, 10 + +$RANDI(0) +$RANDI(1) +$RANDI(2) +$RANDI(3) +$RANDI(4) +$RANDI(5) +$RANDI(6) +$RANDI(7) +$RANDI(8) +$RANDI(9) +$RANDI(10) +$RANDI(11) +$RANDI(12) +$RANDI(13) +$RANDI(14) +$RANDI(15) + +asig rand 10000, .5, 1 +asig butlp asig, 5000 +asig dconv asig, isize, itable + + out asig *.5 +endin + + +</CsInstruments> +<CsScore> + +f1 0 16 10 1 +i1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/define.csd b/examples/define.csd new file mode 100644 index 0000000..3f5307d --- /dev/null +++ b/examples/define.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o define.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Define the macros. +#define VOLUME #5000# +#define FREQ #440# +#define TABLE #1# + +; Instrument #1 +instr 1 + ; Use the macros. + ; This will be expanded to "a1 oscil 5000, 440, 1". + a1 oscil $VOLUME, $FREQ, $TABLE + + ; Send it to the output. + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Define Table #1 with an ordinary sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/define_args.csd b/examples/define_args.csd new file mode 100644 index 0000000..b414e65 --- /dev/null +++ b/examples/define_args.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o define_args.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Define the oscillator macro. +#define OSCMACRO(VOLUME'FREQ'TABLE) #oscil $VOLUME, $FREQ, $TABLE# + +; Instrument #1 +instr 1 + ; Use the oscillator macro. + ; This will be expanded to "a1 oscil 5000, 440, 1". + a1 $OSCMACRO(5000'440'1) + + ; Send it to the output. + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Define Table #1 with an ordinary sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/delay.csd b/examples/delay.csd new file mode 100644 index 0000000..9667c4d --- /dev/null +++ b/examples/delay.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o delay.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +; Instrument #1 -- Delayed beeps. +instr 1 + ; Make a basic sound. + abeep vco 20000, 440, 1 + + ; Delay the beep by .1 seconds. + idlt = 0.1 + adel delay abeep, idlt + + ; Send the beep to the left speaker and + ; the delayed beep to the right speaker. + outs abeep, adel +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Keep the score running for 2 seconds. +f 0 2 + +; Play Instrument #1. +i 1 0.0 0.2 +i 1 0.5 0.2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/delayw.csd b/examples/delayw.csd new file mode 100644 index 0000000..65b5599 --- /dev/null +++ b/examples/delayw.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o delayw.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +; Instrument #1 -- Delayed beeps. +instr 1 + ; Make a basic sound. + abeep vco 20000, 440, 1 + + ; Set up a delay line. + idlt = 0.1 + adel delayr idlt + + ; Write the beep to the delay line. + delayw abeep + + ; Send the beep to the left speaker and + ; the delayed beep to the right speaker. + outs abeep, adel +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Keep the score running for 2 seconds. +f 0 2 + +; Play Instrument #1. +i 1 0.0 0.2 +i 1 0.5 0.2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/diff.csd b/examples/diff.csd new file mode 100644 index 0000000..08328fc --- /dev/null +++ b/examples/diff.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o diff.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 -- a normal instrument. +instr 1 + ; Generate a band-limited pulse train. + asrc buzz 20000, 440, 20, 1 + + out asrc +endin + +; Instrument #2 -- a differentiated instrument. +instr 2 + ; Generate a band-limited pulse train. + asrc buzz 20000, 440, 20, 1 + + ; Emphasize the highs. + a1 diff asrc + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 1 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/diskgrain.csd b/examples/diskgrain.csd new file mode 100644 index 0000000..f9517cf --- /dev/null +++ b/examples/diskgrain.csd @@ -0,0 +1,39 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +</CsOptions> +<CsInstruments> + +sr = 48000 +ksmps = 128 + +instr 1 +iolaps = 2 +igrsize = 0.04 +ifreq = iolaps/igrsize +ips = 1/iolaps + +istr = p4 /* timescale */ +ipitch = p5 /* pitchscale */ + +a1 diskgrain "mary.wav", 32000, ifreq, ipitch, igrsize, ips*istr, 1, iolaps + +out a1 +endin + +</CsInstruments> +<CsScore> +f 1 0 8192 20 1 1 ;Hamming function + +; timescale pitchscale +i 1 0 5 1 1 +i 1 + 5 2 1 +i 1 + 5 1 0.75 +i 1 + 5 1.5 1.5 +i 1 + 5 0.5 1.5 + +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/diskin.csd b/examples/diskin.csd new file mode 100644 index 0000000..de6138f --- /dev/null +++ b/examples/diskin.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o diskin.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1 - play an audio file. +instr 1 + ; Play the audio file backwards. + asig diskin "beats.wav", -1 + out asig +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1, the audio file, for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/diskin2.csd b/examples/diskin2.csd new file mode 100644 index 0000000..6a9139e --- /dev/null +++ b/examples/diskin2.csd @@ -0,0 +1,25 @@ +<CsoundSynthesizer> +<CsOptions> +; set this to a directory where beats.wav can be found +--env:SSDIR+=/Csound/Documentation/manual/examples +</CsOptions> +<CsInstruments> +sr = 48000 +ksmps = 32 +nchnls = 2 + + instr 1 + +ktrans linseg 1, 5, 2, 10, -2 +a1 diskin2 "beats.wav", ktrans, 0, 1, 0, 32 + outs a1, a1 + endin + +</CsInstruments> +<CsScore> + +i 1 0 15 +e + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/dispfft.csd b/examples/dispfft.csd new file mode 100644 index 0000000..2080a13 --- /dev/null +++ b/examples/dispfft.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o dispfft.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + asig soundin "beats.wav" + dispfft asig, 1, 512 + out asig +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/display.csd b/examples/display.csd new file mode 100644 index 0000000..1010a04 --- /dev/null +++ b/examples/display.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o display.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Go from 1000 to 0 linearly, over the period defined by p3. + klin line 1000, p3, 0 + + ; Create a new display each second, wait for the user. + display klin, 1, 1, 1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 5 seconds. +i 1 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/distort1.csd b/examples/distort1.csd new file mode 100644 index 0000000..8bfc4c1 --- /dev/null +++ b/examples/distort1.csd @@ -0,0 +1,54 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o distort1.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +gadist init 0 + +instr 1 + iamp = p4 + ifqc = cpspch(p5) + asig pluck iamp, ifqc, ifqc, 0, 1 + gadist = gadist + asig +endin + +instr 50 + kpre init p4 + kpost init p5 + kshap1 init p6 + kshap2 init p7 + aout distort1 gadist, kpre, kpost, kshap1, kshap2 + + outs aout, aout + + gadist = 0 +endin + + +</CsInstruments> +<CsScore> + +; Sta Dur Amp Pitch +i1 0.0 3.0 10000 6.00 +i1 0.5 2.5 10000 7.00 +i1 1.0 2.0 10000 7.07 +i1 1.5 1.5 10000 8.00 + +; Sta Dur PreGain PostGain Shape1 Shape2 +i50 0 3 2 1 0 0 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/divides.csd b/examples/divides.csd new file mode 100644 index 0000000..b199bb6 --- /dev/null +++ b/examples/divides.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o divides.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = 24 / 8 + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/divz.csd b/examples/divz.csd new file mode 100644 index 0000000..4a418f1 --- /dev/null +++ b/examples/divz.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o divz.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Define the numbers to be divided. + ka init 200 + ; Linearly change the value of kb from 200 to 0. + kb line 0, p3, 200 + ; If a "divide by zero" error occurs, substitute -1. + ksubst init -1 + + ; Safely divide the numbers. + kresults divz ka, kb, ksubst + + ; Print out the results. + printks "%f / %f = %f\\n", 0.1, ka, kb, kresults +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/downsamp.csd b/examples/downsamp.csd new file mode 100644 index 0000000..dcb3194 --- /dev/null +++ b/examples/downsamp.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o downsamp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create a noise signal at a-rate. + anoise noise 20000, 0.2 + + ; Downsample the noise signal to k-rate. + knoise downsamp anoise + + ; Use the noise signal at k-rate. + a1 oscil 30000, knoise, 1 + out anoise +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/dripwater.csd b/examples/dripwater.csd new file mode 100644 index 0000000..1ac944a --- /dev/null +++ b/examples/dripwater.csd @@ -0,0 +1,32 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o dripwater.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 01 ;example of a water drip +a1 line 5, p3, 5 ;preset an amplitude boost +a2 dripwater p4, 0.01, 0, .9 ;dripwater needs a little amplitude help at these values +a3 product a1, a2 ;increase amplitude + out a3 + endin + + +</CsInstruments> +<CsScore> + +i1 0 1 20000 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/dssi4cs.csd b/examples/dssi4cs.csd new file mode 100644 index 0000000..52c4208 --- /dev/null +++ b/examples/dssi4cs.csd @@ -0,0 +1,68 @@ +<CsoundSynthesizer> + +<CsOptions> +;use appropriate realtime options +</CsOptions> + +<CsInstruments> +ksmps = 256 +nchnls = 2 + +dssilist + +gihandle dssiinit "amp.so", 0, 1 +;gihandle dssiinit "cmt.so", 30 , 2 +;gihandle2 dssiinit "cmt.so", 8 , 1 +;gihandle dssiinit "delayorama_1402", 0 +gihandle2 dssiinit "cmt.so", 49 , 1 +;gihandle dssiinit "freq_tracker_1418.so", 0 , 1, 1 +;gihandle dssiinit "g2reverb.so", 0, 1 +;gihandle2 dssiinit "declip_1195.so", 0, 1 +;gihandle2 dssiinit "revdelay_1605.so", 0, 1 +;gihandle2 dssiinit "tap_chorusflanger.so", 0, 1 +;gihandle2 dssiinit "plate_1423.so", 0, 1 +gihandle3 dssiinit "gate_1410.so", 0, 1 +;gihandle3 dssiinit "hexter.so", 0, 1 + +instr 1 +print p4 +dssiactivate gihandle, p4 +dssiactivate gihandle2, p4 +dssiactivate gihandle3, p4 +endin + + +instr 2 +ain1 inch 1 +ain2 inch 2 +;aout1,aout2 dssiaudio gihandle, ain1, ain2 +aout1 dssiaudio gihandle, ain1 +outs aout1,aout1 +endin + +instr 3 +kval linen 1, p3 /3, p3, p3/ 3 +dssictls gihandle, p4, kval, 1 +endin + +instr 4 +ain1 inch 1 +aout1 dssiaudio gihandle2, ain1 +outs aout1,aout1 +endin + +</CsInstruments> + +<CsScore> + +i 1 1 1 1 + +i 2 2 15 ;plugin 1 + +i 3 3 12 0 ;Control port 0 + +i 4 8 2 ;plugin 2 +e +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/dumpk.csd b/examples/dumpk.csd new file mode 100644 index 0000000..4db0dfd --- /dev/null +++ b/examples/dumpk.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o dumpk.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 20 +nchnls = 1 + +; By Andres Cabrera 2008 + +instr 1 +; Write fibonacci numbers to file "fibonacci.txt" +; as ascii long integers (mode 7), using the orchestra's +; control rate (iprd = 0) + +knumber init 0 +koldnumber init 1 +ktrans init 1 +ktrans = knumber +knumber = knumber + koldnumber +koldnumber = ktrans +dumpk knumber, "fibonacci.txt", 7, 0 +printk2 knumber +endin + + +</CsInstruments> +<CsScore> + +;Write to the file for 1 second. Since control rate is 20, 20 values will be written + i 1 0 1 + + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/eee.aiff b/examples/eee.aiff Binary files differnew file mode 100644 index 0000000..acb1970 --- /dev/null +++ b/examples/eee.aiff diff --git a/examples/endin.csd b/examples/endin.csd new file mode 100644 index 0000000..d72a97a --- /dev/null +++ b/examples/endin.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o endin.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + iamp = 10000 + icps = 440 + iphs = 0 + + a1 oscils iamp, icps, iphs + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/envlpx.csd b/examples/envlpx.csd new file mode 100644 index 0000000..345d7f9 --- /dev/null +++ b/examples/envlpx.csd @@ -0,0 +1,100 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o envlpx.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a simple instrument. +instr 1 + ; Set the amplitude. + kamp init 20000 + ; Get the frequency from the fourth p-field. + kcps = cpspch(p4) + + a1 vco kamp, kcps, 1 + out a1 +endin + +; Instrument #2 - instrument with an amplitude envelope. +instr 2 + kamp = 20000 + irise = 0.05 + idur = p3 - .01 + idec = 0.5 + ifn = 2 + iatss = 1 + iatdec = 0.01 + + ; Create an amplitude envelope. + kenv envlpx kamp, irise, idur, idec, ifn, iatss, iatdec + + ; Get the frequency from the fourth p-field. + kcps = cpspch(p4) + + a1 vco kenv, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 +; Table #2, a rising envelope. +f 2 0 129 -7 0 128 1 + +; Set the tempo to 120 beats per minute. +t 0 120 + +; Make sure the score plays for 33 seconds. +f 0 33 + +; Play a melody with Instrument #1. +; p4 = frequency in pitch-class notation. +i 1 0 1 8.04 +i 1 1 1 8.04 +i 1 2 1 8.05 +i 1 3 1 8.07 +i 1 4 1 8.07 +i 1 5 1 8.05 +i 1 6 1 8.04 +i 1 7 1 8.02 +i 1 8 1 8.00 +i 1 9 1 8.00 +i 1 10 1 8.02 +i 1 11 1 8.04 +i 1 12 2 8.04 +i 1 14 2 8.02 + +; Repeat the melody with Instrument #2. +; p4 = frequency in pitch-class notation. +i 2 16 1 8.04 +i 2 17 1 8.04 +i 2 18 1 8.05 +i 2 19 1 8.07 +i 2 20 1 8.07 +i 2 21 1 8.05 +i 2 22 1 8.04 +i 2 23 1 8.02 +i 2 24 1 8.00 +i 2 25 1 8.00 +i 2 26 1 8.02 +i 2 27 1 8.04 +i 2 28 2 8.04 +i 2 30 2 8.02 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/equals.csd b/examples/equals.csd new file mode 100644 index 0000000..b2502b6 --- /dev/null +++ b/examples/equals.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o equal.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Get the 4th p-field from the score. + k1 = p4 + + ; Is it equal to 3? (1 = true, 0 = false) + k2 = (p4 == 3 ? 1 : 0) + + ; Print the values of k1 and k2. + printks "k1 = %f, k2 = %f\\n", 1, k1, k2 +endin + + +</CsInstruments> +<CsScore> + +; Call Instrument #1 with a p4 = 2. +i 1 0 0.5 2 +; Call Instrument #1 with a p4 = 3. +i 1 1 0.5 3 +; Call Instrument #1 with a p4 = 4. +i 1 2 0.5 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/event.csd b/examples/event.csd new file mode 100644 index 0000000..18fcd15 --- /dev/null +++ b/examples/event.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o event.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - an oscillator with a high note. +instr 1 + ; Create a trigger and set its initial value to 1. + ktrigger init 1 + + ; If the trigger is equal to 0, continue playing. + ; If not, schedule another event. + if (ktrigger == 0) goto contin + ; kscoreop="i", an i-statement. + ; kinsnum=2, play Instrument #2. + ; kwhen=1, start at 1 second. + ; kdur=0.5, play for a half-second. + event "i", 2, 1, 0.5 + + ; Make sure the event isn't triggered again. + ktrigger = 0 + +contin: + a1 oscils 10000, 440, 1 + out a1 +endin + +; Instrument #2 - an oscillator with a low note. +instr 2 + a1 oscils 10000, 220, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Make sure the score plays for two seconds. +f 0 2 + +; Play Instrument #1 for a half-second. +i 1 0 0.5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/event_named.csd b/examples/event_named.csd new file mode 100644 index 0000000..2329c64 --- /dev/null +++ b/examples/event_named.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o event_named.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - an oscillator with a high note. +instr 1 + ; Create a trigger and set its initial value to 1. + ktrigger init 1 + + ; If the trigger is equal to 0, continue playing. + ; If not, schedule another event. + if (ktrigger == 0) goto contin + ; kscoreop="i", an i-statement. + ; kinsnum="low_note", instrument named "low_note". + ; kwhen=1, start at 1 second. + ; kdur=0.5, play for a half-second. + event "i", "low_note", 1, 0.5 + + ; Make sure the event isn't triggered again. + ktrigger = 0 + +contin: + a1 oscils 10000, 440, 1 + out a1 +endin + +; Instrument "low_note" - an oscillator with a low note. +instr low_note + a1 oscils 10000, 220, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Make sure the score plays for two seconds. +f 0 2 + +; Play Instrument #1 for a half-second. +i 1 0 0.5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/exp.csd b/examples/exp.csd new file mode 100644 index 0000000..13d3655 --- /dev/null +++ b/examples/exp.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o exp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = exp(8) + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/expcurve.csd b/examples/expcurve.csd new file mode 100644 index 0000000..c15fb41 --- /dev/null +++ b/examples/expcurve.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in Silent +-odac -idac -d ;;;realtime output</CsOptions> +<CsInstruments> + +sr = 48000 +ksmps = 100 +nchnls = 2 + +/*--- ---*/ + + instr 1 ; logcurve test + +kmod phasor 1/200 + +kout expcurve kmod, 2 + + printk2 kmod + printk2 kout + + endin + +/*--- ---*/ +</CsInstruments> +<CsScore> + +i1 0 8888 + +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/expon.csd b/examples/expon.csd new file mode 100644 index 0000000..c512d24 --- /dev/null +++ b/examples/expon.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o expon.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Define kcps as a frequency value that exponentially declines + ; from 880 to 220. It declines over the period set by p3. + kcps expon 880, p3, 220 + + a1 oscil 20000, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/exprand.csd b/examples/exprand.csd new file mode 100644 index 0000000..c53ec87 --- /dev/null +++ b/examples/exprand.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o exprand.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random between 0 and 1. + ; krange = 1 + + i1 exprand 1 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/expseg.csd b/examples/expseg.csd new file mode 100644 index 0000000..1d1a67d --- /dev/null +++ b/examples/expseg.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o expseg.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; p4 = frequency in pitch-class notation. + kcps = cpspch(p4) + + ; Create an amplitude envelope. + kenv expseg 0.01, p3*0.25, 1, p3*0.75, 0.01 + kamp = kenv * 30000 + + a1 oscil kamp, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for a half-second, p4=8.00 +i 1 0 0.5 8.00 +; Play Instrument #1 for a half-second, p4=8.01 +i 1 1 0.5 8.01 +; Play Instrument #1 for a half-second, p4=8.02 +i 1 2 0.5 8.02 +; Play Instrument #1 for a half-second, p4=8.03 +i 1 3 0.5 8.03 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/expsega.csd b/examples/expsega.csd new file mode 100644 index 0000000..14df27e --- /dev/null +++ b/examples/expsega.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o expsega.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Define a short percussive amplitude envelope that + ; goes from 0.01 to 20,000 and back. + aenv expsega 0.01, 0.1, 20000, 0.1, 0.01 + + a1 oscil aenv, 440, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #1 for one second. +i 1 1 1 +; Play Instrument #1 for one second. +i 1 2 1 +; Play Instrument #1 for one second. +i 1 3 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/expsegr.csd b/examples/expsegr.csd new file mode 100644 index 0000000..287861b --- /dev/null +++ b/examples/expsegr.csd @@ -0,0 +1,53 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o expsegr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; p4 = frequency in pitch-class notation. + kcps = cpspch(p4) + + ; Use an amplitude envelope with second-long release. + kenv expsegr 0.01, p3/2, 1, p3/2, 0.01, 1, 1 + kamp = kenv * 30000 + + a1 oscil kamp, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Make sure the score lasts for four seconds. +f 0 4 + +; p4 = frequency (in pitch-class notation). +; Play Instrument #1 for a half-second, p4=8.00 +i 1 0 0.5 8.00 +; Play Instrument #1 for a half-second, p4=8.01 +i 1 1 0.5 8.01 +; Play Instrument #1 for a half-second, p4=8.02 +i 1 2 0.5 8.02 +; Play Instrument #1 for a half-second, p4=8.03 +i 1 3 0.5 8.03 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fdl.txt b/examples/fdl.txt new file mode 100644 index 0000000..d1e3b79 --- /dev/null +++ b/examples/fdl.txt @@ -0,0 +1,397 @@ + GNU Free Documentation License + Version 1.2, November 2002 + + + Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + +0. PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document "free" in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + + +1. APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The "Document", below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as "you". You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A "Modified Version" of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A "Secondary Section" is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall subject +(or to related matters) and contains nothing that could fall directly +within that overall subject. (Thus, if the Document is in part a +textbook of mathematics, a Secondary Section may not explain any +mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The "Invariant Sections" are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The "Cover Texts" are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A "Transparent" copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not "Transparent" is called "Opaque". + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML, PostScript or PDF designed for human modification. Examples of +transparent image formats include PNG, XCF and JPG. Opaque formats +include proprietary formats that can be read and edited only by +proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML, PostScript or PDF produced by some word +processors for output purposes only. + +The "Title Page" means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +A section "Entitled XYZ" means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as "Acknowledgements", +"Dedications", "Endorsements", or "History".) To "Preserve the Title" +of such a section when you modify the Document means that it remains a +section "Entitled XYZ" according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + + +2. VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + + +3. COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + + +4. MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has fewer than five), + unless they release you from this requirement. +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. +D. Preserve all the copyright notices of the Document. +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. +H. Include an unaltered copy of this License. +I. Preserve the section Entitled "History", Preserve its Title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section Entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the section all + the substance and tone of each of the contributor acknowledgements + and/or dedications given therein. +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. +M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. +N. Do not retitle any existing section to be Entitled "Endorsements" + or to conflict in title with any Invariant Section. +O. Preserve any Warranty Disclaimers. + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + + +5. COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled "History" +in the various original documents, forming one section Entitled +"History"; likewise combine any sections Entitled "Acknowledgements", +and any sections Entitled "Dedications". You must delete all sections +Entitled "Endorsements". + + +6. COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + + +7. AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an "aggregate" if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + + +8. TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled "Acknowledgements", +"Dedications", or "History", the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + + +9. TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + + +10. FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. + + +ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + + Copyright (c) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. diff --git a/examples/fibonacci.txt b/examples/fibonacci.txt new file mode 100644 index 0000000..9e86438 --- /dev/null +++ b/examples/fibonacci.txt @@ -0,0 +1,20 @@ +1 +1 +2 +3 +5 +8 +13 +21 +34 +55 +89 +144 +233 +377 +610 +987 +1597 +2584 +4181 +6765 diff --git a/examples/filelen.csd b/examples/filelen.csd new file mode 100644 index 0000000..b185dd3 --- /dev/null +++ b/examples/filelen.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o filelen.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the length of the audio file + ; "mary.wav" in seconds. + ilen filelen "mary.wav" + print ilen +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 1 second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/filenchnls.csd b/examples/filenchnls.csd new file mode 100644 index 0000000..5b7ff30 --- /dev/null +++ b/examples/filenchnls.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o filenchnls.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the number of channels in the + ; audio file "mary.wav". + ichnls filenchnls "mary.wav" + print ichnls +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 1 second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/filepeak.csd b/examples/filepeak.csd new file mode 100644 index 0000000..5b74d43 --- /dev/null +++ b/examples/filepeak.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o filepeak.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the peak absolute value of the + ; audio file "mary.wav". + ipeak filepeak "mary.wav" + print ipeak +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 1 second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/filesr.csd b/examples/filesr.csd new file mode 100644 index 0000000..dbafb7e --- /dev/null +++ b/examples/filesr.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o filesr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the sampling rate of the + ; audio file "mary.wav". + isr filesr "mary.wav" + print isr +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 1 second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/flanger.csd b/examples/flanger.csd new file mode 100644 index 0000000..cf63f4d --- /dev/null +++ b/examples/flanger.csd @@ -0,0 +1,44 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o flanger.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use the "beat.wav" audio file. + asig soundin "beats.wav" + + ; Vary the delay amount from 0 to 0.01 seconds. + adel line 0, p3, 0.01 + kfeedback = 0.7 + + ; Apply flange to the input signal. + aflang flanger asig, adel, kfeedback + + ; It can get loud, so clip its amplitude to 30,000. + a1 clip aflang, 1, 30000 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/flashtxt.csd b/examples/flashtxt.csd new file mode 100644 index 0000000..df7c8f0 --- /dev/null +++ b/examples/flashtxt.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o flashtxt.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +instr 1 + flashtxt 1, "Instr 1 live" + ao oscil 4000, 440, 1 + out ao +endin + + +</CsInstruments> +<CsScore> + +; Table 1: an ordinary sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fluid-2.orc b/examples/fluid-2.orc new file mode 100644 index 0000000..42f22ff --- /dev/null +++ b/examples/fluid-2.orc @@ -0,0 +1,67 @@ +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 +0dbfs = 32767 + +; LOAD SOUNDFONTS +gienginenum1 fluidEngine +gienginenum2 fluidEngine +isfnum1 fluidLoad "Piano Steinway Grand Model C (21,738KB).sf2", gienginenum1, 1 +; Bright Steinway, program 1, channel 1 + fluidProgramSelect gienginenum1, 1, isfnum1, 0, 1 +; Concert Steinway with reverb, program 2, channel 3 + fluidProgramSelect gienginenum1, 3, isfnum1, 0, 2 +isfnum2 fluidLoad "63.3mg The Sound Site Album Bank V1.0.SF2", gienginenum2, 1 +; General MIDI, program 50, channel 2 + fluidProgramSelect gienginenum2, 2, isfnum2, 0, 50 + +; SEND NOTES TO STEINWAY SOUNDFONT + +instr 1 ; FluidSynth Steinway Rev + ; INITIALIZATION + mididefault 60, p3 ; Default duration of 60 -- overridden by score. + midinoteonkey p4, p5 ; Channels MIDI input to pfields. + ; Use channel assigned in fluidload. + ichannel = 1 + ikey = p4 + ivelocity = p5 + fluidNote gienginenum1, ichannel, ikey, ivelocity +endin + +instr 2 ; GM soundfont + ; INITIALIZATION + mididefault 60, p3 ; Default duration of 60 -- overridden by score. + midinoteonkey p4, p5 ; Channels MIDI input to pfields. + ; Use channel assigned in fluidload. + ichannel = 2 + ikey = p4 + ivelocity = p5 + fluidNote gienginenum2, ichannel, ikey, ivelocity +endin + +instr 3 ; FluidSynth Steinway Rev + ; INITIALIZATION + mididefault 60, p3 ; Default duration of 60 -- overridden by score. + midinoteonkey p4, p5 ; Channels MIDI input to pfields. + ; Use channel assigned in fluidload. + ichannel = 3 + ikey = p4 + ivelocity = p5 + fluidNote gienginenum1, ichannel, ikey, ivelocity +endin + +; COLLECT AUDIO FROM ALL SOUNDFONTS + +instr 100 ; Fluidsynth output + ; INITIALIZATION + ; Normalize so iamplitude for p5 of 80 == ampdb(80). + iamplitude1 = ampdb(p5) * (10000.0 / 0.1) + iamplitude2 = ampdb(p6) * (10000.0 / 0.1) + +; AUDIO +aleft1, aright1 fluidOut gienginenum1 +aleft2, aright2 fluidOut gienginenum2 + outs (aleft1 * iamplitude1) + (aleft2 * iamplitude2), \ + (aright1 * iamplitude1) + (aright2 * iamplitude2) +endin diff --git a/examples/fluid.orc b/examples/fluid.orc new file mode 100644 index 0000000..04983eb --- /dev/null +++ b/examples/fluid.orc @@ -0,0 +1,23 @@ +sr = 44100 +ksmps = 100 +nchnls = 2 + +giengine fluidEngine +isfnum fluidLoad "07AcousticGuitar.sf2", giengine, 1 + fluidProgramSelect giengine, 1, isfnum, 0, 0 + +instr 1 + mididefault 60, p3 + midinoteonkey p4, p5 + + ikey init p4 + ivel init p5 + + fluidNote giengine, 1, ikey, ivel +endin + +instr 99 + imvol init 70000 + asigl, asigr fluidOut giengine + outs asigl * imvol, asigr * imvol +endin
\ No newline at end of file diff --git a/examples/fluidAllOut.orc b/examples/fluidAllOut.orc new file mode 100644 index 0000000..f359ac6 --- /dev/null +++ b/examples/fluidAllOut.orc @@ -0,0 +1,67 @@ +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 +0dbfs = 32767 + +; LOAD SOUNDFONTS +gienginenum1 fluidEngine +gienginenum2 fluidEngine +isfnum1 fluidLoad "Piano Steinway Grand Model C (21,738KB).sf2", gienginenum1, 1 +; Bright Steinway, program 1, channel 1 + fluidProgramSelect gienginenum1, 1, isfnum1, 0, 1 +; Concert Steinway with reverb, program 2, channel 3 + fluidProgramSelect gienginenum1, 3, isfnum1, 0, 2 +isfnum2 fluidLoad "63.3mg The Sound Site Album Bank V1.0.SF2", gienginenum2, 1 +; General MIDI, program 50, channel 2 + fluidProgramSelect gienginenum2, 2, isfnum2, 0, 50 + +; SEND NOTES TO STEINWAY SOUNDFONT + +instr 1 ; FluidSynth Steinway Rev + ; INITIALIZATION + mididefault 60, p3 ; Default duration of 60 -- overridden by score. + midinoteonkey p4, p5 ; Channels MIDI input to pfields. + ; Use channel assigned in fluidload. + ichannel = 1 + ikey = p4 + ivelocity = p5 + istatus = 144 + fluidControl gienginenum1, istatus, ichannel, ikey, ivelocity +endin + +instr 2 ; GM soundfont + ; INITIALIZATION + mididefault 60, p3 ; Default duration of 60 -- overridden by score. + midinoteonkey p4, p5 ; Channels MIDI input to pfields. + ; Use channel assigned in fluidload. + ichannel = 2 + ikey = p4 + ivelocity = p5 + istatus = 144 + fluidNote gienginenum2, ichannel, ikey, ivelocity +endin + +instr 3 ; FluidSynth Steinway Rev + ; INITIALIZATION + mididefault 60, p3 ; Default duration of 60 -- overridden by score. + midinoteonkey p4, p5 ; Channels MIDI input to pfields. + ; Use channel assigned in fluidload. + ichannel = 3 + ikey = p4 + ivelocity = p5 + istatus = 144 + fluidNote gienginenum1, ichannel, ikey, ivelocity +endin + + +; COLLECT AUDIO FROM ALL SOUNDFONTS + +instr 100 ; Fluidsynth output + ; INITIALIZATION + ; Normalize so iamplitude for p5 of 80 == ampdb(80). + iamplitude = ampdb(p5) * (10000.0 / 0.1) + ; AUDIO + aleft, aright fluidAllOut + outs aleft * iamplitude, aright * iamplitude +endin diff --git a/examples/fluidcomplex.csd b/examples/fluidcomplex.csd new file mode 100644 index 0000000..0222476 --- /dev/null +++ b/examples/fluidcomplex.csd @@ -0,0 +1,73 @@ +<CsoundSynthesizer> +<CsOptions> +-d -m229 -o dac -T -F midifile.mid +</CsOptions> +<CsInstruments> +sr = 44100 +ksmps = 128 +nchnls = 2 +0dbfs = 1 + +; Example by Istvan Varga + +; disable triggering of instruments by MIDI events + +ichn = 1 +lp1: + massign ichn, 0 + loop_le ichn, 1, 16, lp1 + pgmassign 0, 0 + +; initialize FluidSynth + +gifld fluidEngine +gisf2 fluidLoad "07AcousticGuitar.sf2", gifld, 1 + +; k-rate version of fluidProgramSelect + +opcode fluidProgramSelect_k, 0, kkkkk + keng, kchn, ksf2, kbnk, kpre xin + igoto skipInit + doInit: + fluidProgramSelect i(keng), i(kchn), i(ksf2), i(kbnk), i(kpre) + reinit doInit + rireturn + skipInit: +endop + +instr 1 + ; initialize channels + kchn init 1 + if (kchn == 1) then +lp2: + fluidControl gifld, 192, kchn - 1, 0, 0 + fluidControl gifld, 176, kchn - 1, 7, 100 + fluidControl gifld, 176, kchn - 1, 10, 64 + loop_le kchn, 1, 16, lp2 + endif + + ; send any MIDI events received to FluidSynth +nxt: + kst, kch, kd1, kd2 midiin + if (kst != 0) then + if (kst != 192) then + fluidControl gifld, kst, kch - 1, kd1, kd2 + else + fluidProgramSelect_k gifld, kch - 1, gisf2, 0, kd1 + endif + kgoto nxt + endif + + ; get audio output from FluidSynth + aL, aR fluidOut gifld + outs aL, aR +endin + +</CsInstruments> +<CsScore> + +i 1 0 3600 +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fmb3.csd b/examples/fmb3.csd new file mode 100644 index 0000000..8117073 --- /dev/null +++ b/examples/fmb3.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fmb3.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 15000 + kfreq = 440 + kc1 = 5 + kc2 = 5 + kvdepth = 0.005 + kvrate = 6 + ifn1 = 1 + ifn2 = 1 + ifn3 = 1 + ifn4 = 1 + ivfn = 1 + + a1 fmb3 kamp, kfreq, kc1, kc2, kvdepth, kvrate, \ + ifn1, ifn2, ifn3, ifn4, ivfn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fmbell.csd b/examples/fmbell.csd new file mode 100644 index 0000000..85216b4 --- /dev/null +++ b/examples/fmbell.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fmbell.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 10000 + kfreq = 880 + kc1 = 5 + kc2 = 5 + kvdepth = 0.005 + kvrate = 6 + ifn1 = 1 + ifn2 = 1 + ifn3 = 1 + ifn4 = 1 + ivfn = 1 + + a1 fmbell kamp, kfreq, kc1, kc2, kvdepth, kvrate, ifn1, ifn2, ifn3, ifn4, ivfn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fmmetal.csd b/examples/fmmetal.csd new file mode 100644 index 0000000..76bc5ad --- /dev/null +++ b/examples/fmmetal.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fmmetal.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 10000 + kfreq = 440 + kc1 = 6 + kc2 = 5 + kvdepth = 0 + kvrate = 0 + ifn1 = 1 + ifn2 = 2 + ifn3 = 2 + ifn4 = 1 + ivfn = 1 + + a1 fmmetal kamp, kfreq, kc1, kc2, kvdepth, kvrate, ifn1, ifn2, ifn3, ifn4, ivfn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a normal sine wave. +f 1 0 32768 10 1 +; Table #2, the "twopeaks.aiff" audio file. +f 2 0 256 1 "twopeaks.aiff" 0 0 0 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fmpercfl.csd b/examples/fmpercfl.csd new file mode 100644 index 0000000..9a0b62c --- /dev/null +++ b/examples/fmpercfl.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fmpercfl.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kfreq = 220 + kc1 = 5 + kc2 = 5 + kvdepth = 0.005 + kvrate = 6 + ifn1 = 1 + ifn2 = 1 + ifn3 = 1 + ifn4 = 1 + ivfn = 1 + + a1 fmpercfl kamp, kfreq, kc1, kc2, kvdepth, kvrate, ifn1, ifn2, ifn3, ifn4, ivfn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fmrhode.csd b/examples/fmrhode.csd new file mode 100644 index 0000000..1b2cfe2 --- /dev/null +++ b/examples/fmrhode.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fmrhode.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kfreq = 220 + kc1 = 6 + kc2 = 0 + kvdepth = 0.01 + kvrate = 3 + ifn1 = 1 + ifn2 = 1 + ifn3 = 1 + ifn4 = 2 + ivfn = 1 + + a1 fmrhode kamp, kfreq, kc1, kc2, kvdepth, kvrate, ifn1, ifn2, ifn3, ifn4, ivfn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 32768 10 1 +; Table #2, the "fwavblnk.aiff" audio file. +f 2 0 256 1 "fwavblnk.aiff" 0 0 0 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fmvoice.csd b/examples/fmvoice.csd new file mode 100644 index 0000000..357844e --- /dev/null +++ b/examples/fmvoice.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fmvoice.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kfreq = 110 + ; Use the fourth p-field for the vowel. + kvowel = p4 + ktilt = 0 + kvibamt = 0.005 + kvibrate = 6 + ifn1 = 1 + ifn2 = 1 + ifn3 = 1 + ifn4 = 1 + ivibfn = 1 + + a1 fmvoice kamp, kfreq, kvowel, ktilt, kvibamt, kvibrate, ifn1, ifn2, ifn3, ifn4, ivibfn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; p4 = vowel (a value from 0 to 64) +; Play Instrument #1 for one second, vowel=1. +i 1 0 1 1 +; Play Instrument #1 for one second, vowel=2. +i 1 1 1 2 +; Play Instrument #1 for one second, vowel=3. +i 1 2 1 3 +; Play Instrument #1 for one second, vowel=4. +i 1 3 1 4 +; Play Instrument #1 for one second, vowel=5. +i 1 4 1 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fmwurlie.csd b/examples/fmwurlie.csd new file mode 100644 index 0000000..96df346 --- /dev/null +++ b/examples/fmwurlie.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fmwurlie.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kfreq = 440 + kc1 = 6 + kc2 = 1 + kvdepth = 0.005 + kvrate = 6 + ifn1 = 1 + ifn2 = 1 + ifn3 = 1 + ifn4 = 2 + ivfn = 1 + + a1 fmwurlie kamp, kfreq, kc1, kc2, kvdepth, kvrate, ifn1, ifn2, ifn3, ifn4, ivfn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 32768 10 1 +; Table #2, the "fwavblnk.aiff" audio file. +f 2 0 256 1 "fwavblnk.aiff" 0 0 0 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fof.csd b/examples/fof.csd new file mode 100644 index 0000000..b9413cc --- /dev/null +++ b/examples/fof.csd @@ -0,0 +1,90 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fof.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Combine five formants together to create + ; an alto-"a" sound. + + ; Values common to all of the formants. + kfund init 261.659 + koct init 0 + kris init 0.003 + kdur init 0.02 + kdec init 0.007 + iolaps = 14850 + ifna = 1 + ifnb = 2 + itotdur = p3 + + ; First formant. + k1amp = ampdb(0) + k1form init 800 + k1band init 80 + + ; Second formant. + k2amp = ampdb(-4) + k2form init 1150 + k2band init 90 + + ; Third formant. + k3amp = ampdb(-20) + k3form init 2800 + k3band init 120 + + ; Fourth formant. + k4amp = ampdb(-36) + k4form init 3500 + k4band init 130 + + ; Fifth formant. + k5amp = ampdb(-60) + k5form init 4950 + k5band init 140 + + a1 fof k1amp, kfund, k1form, koct, k1band, kris, \ + kdur, kdec, iolaps, ifna, ifnb, itotdur + a2 fof k2amp, kfund, k2form, koct, k2band, kris, \ + kdur, kdec, iolaps, ifna, ifnb, itotdur + a3 fof k3amp, kfund, k3form, koct, k3band, kris, \ + kdur, kdec, iolaps, ifna, ifnb, itotdur + a4 fof k4amp, kfund, k4form, koct, k4band, kris, \ + kdur, kdec, iolaps, ifna, ifnb, itotdur + a5 fof k5amp, kfund, k5form, koct, k5band, kris, \ + kdur, kdec, iolaps, ifna, ifnb, itotdur + + ; Combine all of the formants together. + out (a1+a2+a3+a4+a5) * 16384 +endin + + +</CsInstruments> +<CsScore> + + +; Table #1, a sine wave. +f 1 0 4096 10 1 +; Table #2. +f 2 0 1024 19 0.5 0.5 270 0.5 + +; Play Instrument #1 for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fof2-2.csd b/examples/fof2-2.csd new file mode 100644 index 0000000..63ea41a --- /dev/null +++ b/examples/fof2-2.csd @@ -0,0 +1,178 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fof2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 128 +nchnls = 2 + +; Example by Chuckk Hubbard 2007 + + instr 1 ;table-lookup vocal synthesis + +iolaps = 120 +ifna = 1 ;f1 - sine wave +ifnb = 2 ;f2 - linear rise shape +itotdur = p3 +iamp = p4 * 0dbfs +ifreq1 = p5 ;starting frequency +ifreq2 = p6 ;ending frequency + +kamp linseg 0, .003, iamp, itotdur-.007, iamp, .003, 0, .001, 0 +kfund expseg ifreq1, itotdur, ifreq2 +koct init 0 +kris init .003 +kdur init .02 +kdec init .007 +kphs init 0 +kgliss init 0 + +iforma = p7 ;starting spectrum +iformb = p8 ;ending spectrum + +iform1a tab_i 0, iforma ;read values of 5 formants for 1st spectrum +iform2a tab_i 1, iforma +iform3a tab_i 2, iforma +iform4a tab_i 3, iforma +iform5a tab_i 4, iforma +idb1a tab_i 5, iforma ;read decibel levels for same 5 formants +idb2a tab_i 6, iforma +idb3a tab_i 7, iforma +idb4a tab_i 8, iforma +idb5a tab_i 9, iforma +iband1a tab_i 10, iforma ;read bandwidths for same 5 formants +iband2a tab_i 11, iforma +iband3a tab_i 12, iforma +iband4a tab_i 13, iforma +iband5a tab_i 14, iforma +iamp1a = ampdb(idb1a) ;convert db to linear multipliers +iamp2a = ampdb(idb2a) +iamp3a = ampdb(idb3a) +iamp4a = ampdb(idb4a) +iamp5a = ampdb(idb5a) + +iform1b tab_i 0, iformb ;values of 5 formants for 2nd spectrum +iform2b tab_i 1, iformb +iform3b tab_i 2, iformb +iform4b tab_i 3, iformb +iform5b tab_i 4, iformb +idb1b tab_i 5, iformb ;decibel levels for 2nd set of formants +idb2b tab_i 6, iformb +idb3b tab_i 7, iformb +idb4b tab_i 8, iformb +idb5b tab_i 9, iformb +iband1b tab_i 10, iformb ;bandwidths for 2nd set of formants +iband2b tab_i 11, iformb +iband3b tab_i 12, iformb +iband4b tab_i 13, iformb +iband5b tab_i 14, iformb +iamp1b = ampdb(idb1b) ;convert db to linear multipliers +iamp2b = ampdb(idb2b) +iamp3b = ampdb(idb3b) +iamp4b = ampdb(idb4b) +iamp5b = ampdb(idb5b) + +kform1 line iform1a, itotdur, iform1b ;transition between formants +kform2 line iform2a, itotdur, iform2b +kform3 line iform3a, itotdur, iform3b +kform4 line iform4a, itotdur, iform4b +kform5 line iform5a, itotdur, iform5b +kband1 line iband1a, itotdur, iband1b ;transition of bandwidths +kband2 line iband2a, itotdur, iband2b +kband3 line iband3a, itotdur, iband3b +kband4 line iband4a, itotdur, iband4b +kband5 line iband5a, itotdur, iband5b +kamp1 line iamp1a, itotdur, iamp1b ;transition of amplitudes of formants +kamp2 line iamp2a, itotdur, iamp2b +kamp3 line iamp3a, itotdur, iamp3b +kamp4 line iamp4a, itotdur, iamp4b +kamp5 line iamp5a, itotdur, iamp5b + +;5 formants for each spectrum +a1 fof2 kamp1, kfund, kform1, koct, kband1, kris, kdur, kdec, iolaps, ifna, ifnb, itotdur, kphs, kgliss +a2 fof2 kamp2, kfund, kform2, koct, kband2, kris, kdur, kdec, iolaps, ifna, ifnb, itotdur, kphs, kgliss +a3 fof2 kamp3, kfund, kform3, koct, kband3, kris, kdur, kdec, iolaps, ifna, ifnb, itotdur, kphs, kgliss +a4 fof2 kamp4, kfund, kform4, koct, kband4, kris, kdur, kdec, iolaps, ifna, ifnb, itotdur, kphs, kgliss +a5 fof2 kamp5, kfund, kform5, koct, kband5, kris, kdur, kdec, iolaps, ifna, ifnb, itotdur, kphs, kgliss + +aout = (a1+a2+a3+a4+a5) * kamp/5 ;sum and scale + +aenv linen 1, 0.05, p3, 0.05 ;to avoid clicking + + outs aout*aenv, aout*aenv + endin + +</CsInstruments> +<CsScore> +f1 0 8192 10 1 +f2 0 4096 7 0 4096 1 + +;**************************************************************** +; tables of formant values adapted from MiscFormants.html +; 100's: soprano 200's: alto 300's: countertenor 400's: tenor 500's: bass +; -01: "a" sound -02: "e" sound -03: "i" sound -04: "o" sound -05: "u" sound +; p-5 through p-9: frequencies of 5 formants +; p-10 through p-14: decibel levels of 5 formants +; p-15 through p-19: bandwidths of 5 formants + +; formant frequencies decibel levels bandwidths +;soprano +f101 0 16 -2 800 1150 2900 3900 4950 0.001 -6 -32 -20 -50 80 90 120 130 140 +f102 0 16 -2 350 2000 2800 3600 4950 0.001 -20 -15 -40 -56 60 100 120 150 200 +f103 0 16 -2 270 2140 2950 3900 4950 0.001 -12 -26 -26 -44 60 90 100 120 120 +f104 0 16 -2 450 800 2830 3800 4950 0.001 -11 -22 -22 -50 40 80 100 120 120 +f105 0 16 -2 325 700 2700 3800 4950 0.001 -16 -35 -40 -60 50 60 170 180 200 +;alto +f201 0 16 -2 800 1150 2800 3500 4950 0.001 -4 -20 -36 -60 80 90 120 130 140 +f202 0 16 -2 400 1600 2700 3300 4950 0.001 -24 -30 -35 -60 60 80 120 150 200 +f203 0 16 -2 350 1700 2700 3700 4950 0.001 -20 -30 -36 -60 50 100 120 150 200 +f204 0 16 -2 450 800 2830 3500 4950 0.001 -9 -16 -28 -55 70 80 100 130 135 +f205 0 16 -2 325 700 2530 3500 4950 0.001 -12 -30 -40 -64 50 60 170 180 200 +;countertenor +f301 0 16 -2 660 1120 2750 3000 3350 0.001 -6 -23 -24 -38 80 90 120 130 140 +f302 0 16 -2 440 1800 2700 3000 3300 0.001 -14 -18 -20 -20 70 80 100 120 120 +f303 0 16 -2 270 1850 2900 3350 3590 0.001 -24 -24 -36 -36 40 90 100 120 120 +f304 0 16 -2 430 820 2700 3000 3300 0.001 -10 -26 -22 -34 40 80 100 120 120 +f305 0 16 -2 370 630 2750 3000 3400 0.001 -20 -23 -30 -34 40 60 100 120 120 +;tenor +f401 0 16 -2 650 1080 2650 2900 3250 0.001 -6 -7 -8 -22 80 90 120 130 140 +f402 0 16 -2 400 1700 2600 3200 3580 0.001 -14 -12 -14 -20 70 80 100 120 120 +f403 0 16 -2 290 1870 2800 3250 3540 0.001 -15 -18 -20 -30 40 90 100 120 120 +f404 0 16 -2 400 800 2600 2800 3000 0.001 -10 -12 -12 -26 70 80 100 130 135 +f405 0 16 -2 350 600 2700 2900 3300 0.001 -20 -17 -14 -26 40 60 100 120 120 +;bass +f501 0 16 -2 600 1040 2250 2450 2750 0.001 -7 -9 -9 -20 60 70 110 120 130 +f502 0 16 -2 400 1620 2400 2800 3100 0.001 -12 -9 -12 -18 40 80 100 120 120 +f503 0 16 -2 250 1750 2600 3050 3340 0.001 -30 -16 -22 -28 60 90 100 120 120 +f504 0 16 -2 400 750 2400 2600 2900 0.001 -11 -21 -20 -40 40 80 100 120 120 +f505 0 16 -2 350 600 2400 2675 2950 0.001 -20 -32 -28 -36 40 80 100 120 120 +;**************************************************************** + +; start dur amp start freq end freq start formant end formant +i1 0 1 .8 440 412.5 201 203 +i1 + . .8 412.5 550 201 204 +i1 + . .8 495 330 202 205 + +i1 + . .8 110 103.125 501 503 +i1 + . .8 103.125 137.5 501 504 +i1 + . .8 123.75 82.5 502 505 + +i1 7 . .4 440 412.5 201 203 +i1 8 . .4 412.5 550 201 204 +i1 9 . .4 495 330 202 205 +i1 7 . .4 110 103.125 501 503 +i1 8 . .4 103.125 137.5 501 504 +i1 9 . .4 123.75 82.5 502 505 +i1 + . .4 440 412.5 101 103 +i1 + . .4 412.5 550 101 104 +i1 + . .4 495 330 102 105 +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fof2.csd b/examples/fof2.csd new file mode 100644 index 0000000..efca383 --- /dev/null +++ b/examples/fof2.csd @@ -0,0 +1,67 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fof2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 128 +nchnls = 2 + +;By Andres Cabrera 2007 + + instr 1 ;table-lookup vocal synthesis + +kris init p12 +kdur init p13 +kdec init p14 + +iolaps init p15 + +ifna init 1 ; Sine wave +ifnb init 2 ; Straight line rise shape + +itotdur init p3 + +kphs init 0 ; No phase modulation (constant kphs) + + +kfund line p4, p3, p5 +kform line p6, p3, p7 +koct line p8, p3, p9 +kband line p10, p3, p11 +kgliss line p16, p3, p17 + +kenv linen 5000, 0.03, p3, 0.03 ;to avoid clicking + + +aout fof2 kenv, kfund, kform, koct, kband, kris, kdur, kdec, iolaps, \ + ifna, ifnb, itotdur, kphs, kgliss + + + outs aout, aout + endin + +</CsInstruments> +<CsScore> +f1 0 8192 10 1 +f2 0 4096 7 0 4096 1 + +; kfund1 kfund2 kform1 kform2 koct1 koct2 kband1 kband2 kris kdur kdec iolaps kgliss1 kgliss2 +i1 0 4 220 220 510 510 0 0 30 30 0.01 0.03 0.01 20 1 1 +i1 + . 220 220 510 910 0 0 30 30 0.01 0.03 0.01 20 1 1 +i1 + . 220 220 510 510 0 0 100 30 0.01 0.03 0.01 20 1 1 +i1 + . 220 220 510 510 0 1 30 30 0.01 0.03 0.01 20 1 1 +i1 + . 220 220 510 510 0 0 30 30 0.01 0.03 0.01 20 1 2 +i1 + . 220 220 510 510 0 0 30 30 0.01 0.03 0.01 20 0.5 1 +i1 + . 220 220 510 510 0 0 30 30 0.01 0.05 0.01 100 1 1 +i1 + . 220 440 510 510 0 0 30 30 0.01 0.05 0.01 100 1 1 + +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fold.csd b/examples/fold.csd new file mode 100644 index 0000000..aa21186 --- /dev/null +++ b/examples/fold.csd @@ -0,0 +1,39 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fold.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use an ordinary sine wave. + asig oscils 30000, 100, 1 + + ; Vary the fold-over amount from 1 to 200. + kincr line 1, p3, 200 + a1 fold asig, kincr + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for four seconds. +i 1 0 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/follow.csd b/examples/follow.csd new file mode 100644 index 0000000..907d43f --- /dev/null +++ b/examples/follow.csd @@ -0,0 +1,52 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o follow.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - play a WAV file. +instr 1 + a1 soundin "beats.wav" + out a1 +endin + +; Instrument #2 - have another waveform follow the WAV file. +instr 2 + ; Follow the WAV file. + as soundin "beats.wav" + af follow as, 0.01 + + ; Use a sine waveform. + as oscil 4000, 440, 1 + ; Have it use the amplitude of the followed WAV file. + a1 balance as, af + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Just generate a nice, ordinary sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/follow2.csd b/examples/follow2.csd new file mode 100644 index 0000000..5f11a7d --- /dev/null +++ b/examples/follow2.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o follow2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - play a WAV file. +instr 1 + a1 soundin "beats.wav" + out a1 +endin + +; Instrument #2 - have another waveform follow the WAV file. +instr 2 + ; Follow the WAV file. + as soundin "beats.wav" + af follow2 as, 0.01, 0.1 + + ; Use a noise waveform. + ar rand 44100 + ; Have it use the amplitude of the followed WAV file. + a1 balance ar, af + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/foscil.csd b/examples/foscil.csd new file mode 100644 index 0000000..614a5b4 --- /dev/null +++ b/examples/foscil.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o foscil.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a basic FM waveform. +instr 1 + kamp = 10000 + kcps = 440 + kcar = 600 + kmod = 210 + kndx = 2 + ifn = 1 + + a1 foscil kamp, kcps, kcar, kmod, kndx, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/foscili.csd b/examples/foscili.csd new file mode 100644 index 0000000..2e0771a --- /dev/null +++ b/examples/foscili.csd @@ -0,0 +1,61 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o foscili.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a basic FM waveform. +instr 1 + kamp = 10000 + kcps = 440 + kcar = 600 + kmod = 210 + kndx = 2 + ifn = 1 + + a1 foscil kamp, kcps, kcar, kmod, kndx, ifn + out a1 +endin + +; Instrument #2 - the basic FM waveform with extra interpolation. +instr 2 + kamp = 10000 + kcps = 440 + kcar = 600 + kmod = 210 + kndx = 2 + ifn = 1 + + a1 foscili kamp, kcps, kcar, kmod, kndx, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave table with a small amount of data. +f 1 0 4096 10 1 + +; Play Instrument #1, the basic FM instrument, for +; two seconds. This should sound relatively rough. +i 1 0 2 + +; Play Instrument #2, the interpolated FM instrument, for +; two seconds. This should sound relatively smooth. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fout.csd b/examples/fout.csd new file mode 100644 index 0000000..89526af --- /dev/null +++ b/examples/fout.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fout.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + iamp = 10000 + icps = 440 + iphs = 0 + + ; Create an audio signal. + asig oscils iamp, icps, iphs + + ; Write the audio signal to a headerless audio file + ; called "fout.raw". + fout "fout.raw", 1, asig +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fout_ftable.csd b/examples/fout_ftable.csd new file mode 100644 index 0000000..8e1f5c8 --- /dev/null +++ b/examples/fout_ftable.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fout_ftable.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +; By: Jonathan Murphy 2007 + + gilen = 131072 + gicps = sr/gilen + gitab ftgen 1, 0, gilen, 10, 1 + + instr 1 + + /******** write file to table ********/ + + ain diskin "beats.wav", 1, 0, 1 + aphs phasor gicps + andx = aphs * gilen + tablew ain, andx, gitab + + /******** write table to file ********/ + + aosc table aphs, gitab, 1 + out aosc + fout "beats_copy.wav", 6, aosc + + endin + +</CsInstruments> +<CsScore> +i1 0 2 +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/fout_poly.csd b/examples/fout_poly.csd new file mode 100644 index 0000000..6c73a60 --- /dev/null +++ b/examples/fout_poly.csd @@ -0,0 +1,78 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fout_poly.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Initialize the global audio signal. +gaudio init 0 + +; Instrument #1 - Play an audio file. +instr 1 + ; Generate an audio signal using + ; the audio file "beats.wav". + asig soundin "beats.wav" + + ; Add this audio signal to the global one. + vincr gaudio, asig +endin + +; Instrument #2 - Create a basic tone. +instr 2 + iamp = 5000 + icps = 440 + iphs = 0 + + ; Create an audio signal. + asig oscils iamp, icps, iphs + + ; Add this audio signal to the global one. + vincr gaudio, asig +endin + +; Instrument #99 - Save the global signal to a file. +instr 99 + ; Write the global audio signal to a headerless + ; audio file called "fout_poly.raw". + fout "fout_poly.raw", 1, gaudio + + ; Clear the global audio signal, preparing it + ; for the next round. + clear gaudio +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 + +; Play Instrument #2 every quarter-second. +i 2 0.00 0.1 +i 2 0.25 0.1 +i 2 0.50 0.1 +i 2 0.75 0.1 +i 2 1.00 0.1 +i 2 1.25 0.1 +i 2 1.50 0.1 +i 2 1.75 0.1 + +; Make sure the global instrument, #99, is running +; during the entire performance (2 seconds). +i 99 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fox.wav b/examples/fox.wav Binary files differnew file mode 100644 index 0000000..f5eed30 --- /dev/null +++ b/examples/fox.wav diff --git a/examples/fprintks-2.csd b/examples/fprintks-2.csd new file mode 100644 index 0000000..33260e1 --- /dev/null +++ b/examples/fprintks-2.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +; -odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +-n -Fmidichn_advanced.mid +;Don't write audio ouput to disk and use the file midichn_advanced.mid as MIDI input +</CsOptions> +<CsInstruments> + + sr = 48000 + ksmps = 16 + nchnls = 2 + + ;Example by Jonathan Murphy 2007 + + ; assign all midi events to instr 1000 + massign 0, 1000 + pgmassign 0, 1000 + + instr 1000 + + ktim timeinsts + + kst, kch, kd1, kd2 midiin +if (kst != 0) then +; p4 = MIDI event type p5 = channel p6= data1 p7= data2 + fprintks "MIDI2cs.sco", "i1\\t%f\\t%f\\t%d\\t%d\\t%d\\t%d\\n", ktim, 1/kr, kst, kch, kd1, kd2 +endif + + endin + + +</CsInstruments> +<CsScore> +i1000 0 10000 +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/fprintks.csd b/examples/fprintks.csd new file mode 100644 index 0000000..0f58004 --- /dev/null +++ b/examples/fprintks.csd @@ -0,0 +1,42 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fprintks.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Matt Ingalls, edited by Kevin Conder. */ +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a score generator example. +instr 1 + ; K-rate stuff. + kstart init 0 + kdur linrand 10 + kpitch linrand 8 + + ; Printing to to a file called "my.sco". + fprintks "my.sco", "i1\\t%2.2f\\t%2.2f\\t%2.2f\\n", kstart, kdur, 4+kpitch + + knext linrand 1 + kstart = kstart + knext +endin + + +</CsInstruments> +<CsScore> + +/* Written by Matt Ingalls, edited by Kevin Conder. */ +; Play Instrument #1. +i 1 0 0.001 + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fprints.csd b/examples/fprints.csd new file mode 100644 index 0000000..94d28f2 --- /dev/null +++ b/examples/fprints.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o fprints.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Matt Ingalls, edited by Kevin Conder. */ +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a score generator example. +instr 1 + ; Print to the file "my.sco". + fprints "my.sco", "%!Generated score by ma++\\n \\n" +endin + + +</CsInstruments> +<CsScore> + +/* Written by Matt Ingalls, edited by Kevin Conder. */ +; Play Instrument #1. +i 1 0 0.001 + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/frac.csd b/examples/frac.csd new file mode 100644 index 0000000..37e9bed --- /dev/null +++ b/examples/frac.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o frac.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = 16 / 5 + i2 = frac(i1) + + print i2 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/freeverb.csd b/examples/freeverb.csd new file mode 100644 index 0000000..53091a2 --- /dev/null +++ b/examples/freeverb.csd @@ -0,0 +1,32 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o freeverb.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +sr = 44100 +ksmps = 32 +nchnls = 2 +0dbfs = 1 + + instr 1 +a1 vco2 0.75, 440, 10 +kfrq port 100, 0.008, 20000 +a1 butterlp a1, kfrq +a2 linseg 0, 0.003, 1, 0.01, 0.7, 0.005, 0, 1, 0 +a1 = a1 * a2 + denorm a1 +aL, aR freeverb a1, a1, 0.9, 0.35, sr, 0 + outs a1 + aL, a1 + aR + endin + +</CsInstruments> +<CsScore> +i 1 0 5 +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ftchnls.csd b/examples/ftchnls.csd new file mode 100644 index 0000000..99733de --- /dev/null +++ b/examples/ftchnls.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ftchnls.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the number of channels in Table #1. + ichnls = ftchnls(1) + print ichnls +endin + + +</CsInstruments> +<CsScore> + +; Table #1: Use an audio file, Csound will determine its size. +f 1 0 0 1 "mary.wav" 0 0 0 + +; Play Instrument #1 for 1 second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ftconv.csd b/examples/ftconv.csd new file mode 100644 index 0000000..3d6e228 --- /dev/null +++ b/examples/ftconv.csd @@ -0,0 +1,90 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ftconv.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +sr = 48000 +ksmps = 32 +nchnls = 2 +0dbfs = 1 + +garvb init 0 +gaW init 0 +gaX init 0 +gaY init 0 + +itmp ftgen 1, 0, 64, -2, 2, 40, -1, -1, -1, 123, \ + 1, 13.000, 0.05, 0.85, 20000.0, 0.0, 0.50, 2, \ + 1, 2.000, 0.05, 0.85, 20000.0, 0.0, 0.25, 2, \ + 1, 16.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2, \ + 1, 9.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2, \ + 1, 12.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2, \ + 1, 8.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2 + +itmp ftgen 2, 0, 262144, -2, 0 + spat3dt 2, -0.2, 1, 0, 1, 1, 2, 0.005 + +itmp ftgen 3, 0, 262144, -52, 3, 2, 0, 4, 2, 1, 4, 2, 2, 4 + + instr 1 + +a1 vco2 1, 440, 10 +kfrq port 100, 0.008, 20000 +a1 butterlp a1, kfrq +a2 linseg 0, 0.003, 1, 0.01, 0.7, 0.005, 0, 1, 0 +a1 = a1 * a2 * 2 + denorm a1 + vincr garvb, a1 +aw, ax, ay, az spat3di a1, p4, p5, p6, 1, 1, 2 + vincr gaW, aw + vincr gaX, ax + vincr gaY, ay + + endin + + instr 2 + + denorm garvb +; skip as many samples as possible without truncating the IR +arW, arX, arY ftconv garvb, 3, 2048, 2048, (65536 - 2048) +aW = gaW + arW +aX = gaX + arX +aY = gaY + arY +garvb = 0 +gaW = 0 +gaX = 0 +gaY = 0 + +aWre, aWim hilbert aW +aXre, aXim hilbert aX +aYre, aYim hilbert aY +aWXr = 0.0928*aXre + 0.4699*aWre +aWXiYr = 0.2550*aXim - 0.1710*aWim + 0.3277*aYre +aL = aWXr + aWXiYr +aR = aWXr - aWXiYr + + outs aL, aR + + endin + +</CsInstruments> +<CsScore> + +i 1 0 0.5 0.0 2.0 -0.8 +i 1 1 0.5 1.4 1.4 -0.6 +i 1 2 0.5 2.0 0.0 -0.4 +i 1 3 0.5 1.4 -1.4 -0.2 +i 1 4 0.5 0.0 -2.0 0.0 +i 1 5 0.5 -1.4 -1.4 0.2 +i 1 6 0.5 -2.0 0.0 0.4 +i 1 7 0.5 -1.4 1.4 0.6 +i 1 8 0.5 0.0 2.0 0.8 +i 2 0 10 +e + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/ftgen-2.csd b/examples/ftgen-2.csd new file mode 100644 index 0000000..9ce6f6e --- /dev/null +++ b/examples/ftgen-2.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ftgen-2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + sr = 48000 + ksmps = 16 + nchnls = 2 + +;Example by Jonathan Murphy 2007 + + 0dbfs = 1 + + instr 1 + + Sfile = "beats.wav" + + ilen filelen Sfile ; Find length + isr filesr Sfile ; Find sample rate + + isamps = ilen * isr ; Total number of samples + isize init 1 + +loop: + isize = isize * 2 +; Loop until isize is greater than number of samples +if (isize < isamps) igoto loop + + itab ftgen 0, 0, isize, 1, Sfile, 0, 0, 0 + print isize + print isamps + + turnoff + endin + +</CsInstruments> +<CsScore> +i1 0 10 +e +</CsScore> +</CsoundSynthesizer> + diff --git a/examples/ftgen.csd b/examples/ftgen.csd new file mode 100644 index 0000000..710c254 --- /dev/null +++ b/examples/ftgen.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ftgen.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Table #1, a sine wave using the GEN10 routine. +gitemp ftgen 1, 0, 16384, 10, 1 + +; Instrument #1 - a basic oscillator. +instr 1 + kamp = 10000 + kcps = 440 + ; Use Table #1. + ifn = 1 + + a1 oscil kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ftlen.csd b/examples/ftlen.csd new file mode 100644 index 0000000..5844458 --- /dev/null +++ b/examples/ftlen.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ftlen.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the size of Table #1. + ; The size will be the number of points excluding the guard point. + ilen = ftlen(1) + print ilen +endin + + +</CsInstruments> +<CsScore> + +; Table #1: Use an audio file, Csound will determine its size. +f 1 0 0 1 "mary.wav" 0 0 0 + +; Play Instrument #1 for 1 second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ftlptim.csd b/examples/ftlptim.csd new file mode 100644 index 0000000..16448de --- /dev/null +++ b/examples/ftlptim.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ftlptim.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the loop-segment start time in Table #1. + itim = ftlptim(1) + print itim +endin + + +</CsInstruments> +<CsScore> + +; Table #1: Use an audio file, Csound will determine its size. +f 1 0 0 1 "mary.wav" 0 0 0 + +; Play Instrument #1 for 1 second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ftmorf.csd b/examples/ftmorf.csd new file mode 100644 index 0000000..1b41b1c --- /dev/null +++ b/examples/ftmorf.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ftmorf.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 1 +kndx line 0, p3, 7 + ftmorf kndx, 1, 2 +asig oscili 30000, 440, 2 + out asig +endin + + +</CsInstruments> +<CsScore> + +f1 0 8 -2 3 4 5 6 7 8 9 10 +f2 0 1024 10 1 /*contents of f2 dont matter */ +f3 0 1024 10 1 +f4 0 1024 10 0 1 +f5 0 1024 10 0 0 1 +f6 0 1024 10 0 0 0 1 +f7 0 1024 10 0 0 0 0 1 +f8 0 1024 10 0 0 0 0 0 1 +f9 0 1024 10 0 0 0 0 0 0 1 +f10 0 1024 10 1 1 1 1 1 1 1 + +i1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ftsave.csd b/examples/ftsave.csd new file mode 100644 index 0000000..b874cfa --- /dev/null +++ b/examples/ftsave.csd @@ -0,0 +1,63 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ftsave.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Table #1, make a sine wave using the GEN10 routine. +gitmp1 ftgen 1, 0, 32768, 10, 1 +; Table #2, create an empty table. +gitmp2 ftgen 2, 0, 32768, 7, 0, 32768, 0 + +; Instrument #1 - a basic oscillator. +instr 1 + kamp = 20000 + kcps = 440 + ; Use Table #1. + ifn = 1 + + a1 oscil kamp, kcps, ifn + out a1 +endin + + +; Instrument #2 - Load Table #1 into Table #2. +instr 2 + ; Save Table #1 to a file called "table1.ftsave". + ftsave "table1.ftsave", 0, 1 + + ; Load the "table1.ftsave" file into Table #2. + ftload "table1.ftsave", 0, 2 + + kamp = 20000 + kcps = 440 + ; Use Table #2, it should contain Table #1's sine wave now. + ifn = 2 + + a1 oscil kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 1 second. +i 1 0 1 +; Play Instrument #2 for 1 second. +i 2 2 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ftsr.csd b/examples/ftsr.csd new file mode 100644 index 0000000..914a16f --- /dev/null +++ b/examples/ftsr.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ftsr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the sampling rate of Table #1. + isr = ftsr(1) + print isr +endin + + +</CsInstruments> +<CsScore> + +; Table #1: Use an audio file. +f 1 0 262144 1 "mary.wav" 0 0 0 + +; Play Instrument #1 for 1 second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/fwavblnk.aiff b/examples/fwavblnk.aiff Binary files differnew file mode 100644 index 0000000..afa0726 --- /dev/null +++ b/examples/fwavblnk.aiff diff --git a/examples/gainslider.csd b/examples/gainslider.csd new file mode 100644 index 0000000..bee856e --- /dev/null +++ b/examples/gainslider.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in Silent +-odac -idac -d ;;;realtime output +</CsOptions> +<CsInstruments> + +sr = 48000 +ksmps = 100 +nchnls = 2 + +/*--- ---*/ + + instr 1 ; gainslider test + +; uncomment for realtime midi +;kmod ctrl7 1, 1, 0, 127 + +; uncomment for non realtime +km0d phasor 1/10 +kmod scale km0d, 127, 0 + +kout gainslider kmod + + printk2 kmod + printk2 kout + +aout diskin "soundfile.aiff", 1, 0, 1 + +aout = aout*kout + + outs aout, aout + + endin + +/*--- ---*/ +</CsInstruments> +<CsScore> + +i1 0 8888 + +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gauss.csd b/examples/gauss.csd new file mode 100644 index 0000000..66bba97 --- /dev/null +++ b/examples/gauss.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gauss.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number between -1 and 1. + ; krange = 1 + + i1 gauss 1 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gbuzz.csd b/examples/gbuzz.csd new file mode 100644 index 0000000..86c5aae --- /dev/null +++ b/examples/gbuzz.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gbuzz.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 20000 + kcps = 440 + knh = 3 + klh = 2 + kmul = 0.7 + ifn = 1 + + a1 gbuzz kamp, kcps, knh, klh, kmul, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a simple cosine waveform. +f 1 0 16384 11 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen01.csd b/examples/gen01.csd new file mode 100644 index 0000000..9a2c0b4 --- /dev/null +++ b/examples/gen01.csd @@ -0,0 +1,42 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen01.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kcps = 1 + ifn = 1 + ibas = 1 + + ; Play the audio sample stored in Table #1. + a1 loscil kamp, kcps, ifn, ibas + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: read an audio file (using GEN01). +f 1 0 131072 1 "beats.wav" 0 4 0 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen01computed.csd b/examples/gen01computed.csd new file mode 100644 index 0000000..42377db --- /dev/null +++ b/examples/gen01computed.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen01computed.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kcps = 1 + ifn = 1 + ibas = 1 + + ; Play the audio sample stored in Table #1. + a1 loscil kamp, kcps, ifn, ibas + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: an audio file (using GEN01). +; Since our table size is 0, Csound will compute it. +f 1 0 0 1 "beats.wav" 0 0 0 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen02.csd b/examples/gen02.csd new file mode 100644 index 0000000..eec5385 --- /dev/null +++ b/examples/gen02.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen02.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create an index over the length of our entire note. + kcps init 1/p3 + kndx phasor kcps + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kamp tablei kndx, ifn, ixmode + + ; Create a sine wave, use the Table #1 values to control + ; the amplitude. This creates a sound with a long attack. + a1 oscil kamp*30000, 440, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: an envelope with a long attack (using GEN02). +f 1 0 16 2 0 1 2 3 4 5 6 7 8 9 10 11 0 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen03.csd b/examples/gen03.csd new file mode 100644 index 0000000..b7d8613 --- /dev/null +++ b/examples/gen03.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen03.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create an index over the length of our entire note. + kcps init 1/p3 + kndx phasor kcps + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kamp table kndx, ifn, ixmode + + ; Create a sine wave, use the Table #1 values to control + ; the amplitude. + a1 oscil kamp*30000, 440, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a polynomial function (using GEN03). +f 1 0 1025 3 -1 1 5 4 3 2 2 1 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen05.csd b/examples/gen05.csd new file mode 100644 index 0000000..effef65 --- /dev/null +++ b/examples/gen05.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen05.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create an index over the length of our entire note. + kcps init 1/p3 + kndx phasor kcps + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kamp table kndx, ifn, ixmode + + ; Create a sine wave, use the Table #1 values to control + ; the amplitude. This creates a nice percussive sound. + a1 oscil kamp*30000, 440, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a percussive envelope (using GEN05). +f 1 0 64 5 1 2 120 60 1 1 0.001 1 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen06.csd b/examples/gen06.csd new file mode 100644 index 0000000..af802ae --- /dev/null +++ b/examples/gen06.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen06.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create an index over the length of our entire note. + kcps init 1/p3 + kndx phasor kcps + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kval table kndx, ifn, ixmode + + ; Generate a sine waveform, use our Table #1 value to + ; vary its frequency by 100 Hz from its base frequency. + ibasefreq = 440 + kfreq = kval * 100 + a1 oscil 20000, ibasefreq + kfreq, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a curve (using GEN06). +f 1 0 65 6 0 16 0.5 16 1 16 0 16 -1 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen07.csd b/examples/gen07.csd new file mode 100644 index 0000000..ef0c3ef --- /dev/null +++ b/examples/gen07.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen07.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kcps = 440 + ifn = 1 + + ; Play the sine wave stored in Table #1. + a1 oscil kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a sawtooth wave (using GEN07). +f 1 0 256 7 0 128 1 0 -1 128 0 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen08.csd b/examples/gen08.csd new file mode 100644 index 0000000..3da161d --- /dev/null +++ b/examples/gen08.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen08.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create an index over the length of our entire note. + kcps init 1/p3 + kndx phasor kcps + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kval table kndx, ifn, ixmode + + ; Generate a sine waveform, use our Table #1 value to + ; vary its frequency by 100 Hz from its base frequency. + ibasefreq = 440 + kfreq = kval * 100 + a1 oscil 20000, ibasefreq + kfreq, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a curve with a smooth hump (using GEN08). +f 1 0 65 8 0 16 0 16 1 16 0 16 0 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen09.csd b/examples/gen09.csd new file mode 100644 index 0000000..c2fb8e7 --- /dev/null +++ b/examples/gen09.csd @@ -0,0 +1,42 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen09.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kcps = 440 + ifn = 1 + + ; Play the waveform stored in Table #1. + a1 oscil kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a cosine wave (using GEN09). +; This is a sine wave with an initial phase of 90 degrees. +f 1 0 16384 9 1 1 90 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen09square.csd b/examples/gen09square.csd new file mode 100644 index 0000000..0f3d09b --- /dev/null +++ b/examples/gen09square.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen09square.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kcps = 440 + ifn = 1 + + ; Play the waveform stored in Table #1. + a1 oscil kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: an approximation of a square wave (using GEN09). +f 1 0 16384 9 1 3 0 3 1 0 9 0.3333 180 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen10.csd b/examples/gen10.csd new file mode 100644 index 0000000..1f14880 --- /dev/null +++ b/examples/gen10.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen10.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kcps = 440 + ifn = 1 + + ; Play the sine wave stored in Table #1. + a1 oscil kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a simple sine wave (using GEN10). +f 1 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen11.csd b/examples/gen11.csd new file mode 100644 index 0000000..35f2750 --- /dev/null +++ b/examples/gen11.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen11.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kcps = 440 + ifn = 1 + + ; Play the cosine wave stored in Table #1. + a1 oscil kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a simple cosine wave (using GEN11). +f 1 0 16384 11 1 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen12.csd b/examples/gen12.csd new file mode 100644 index 0000000..56c9939 --- /dev/null +++ b/examples/gen12.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen12.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create an index over the length of our entire note. + kcps init 1/p3 + kndx phasor kcps + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kamp tablei kndx, ifn, ixmode + + ; Create a sine wave, use the Table #1 values to control + ; the amplitude. This creates a sound with a long attack. + a1 oscil kamp*30000, 440, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a modified Bessel function (using GEN12). +f 1 0 2049 12 20 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen13.csd b/examples/gen13.csd new file mode 100644 index 0000000..c9593d3 --- /dev/null +++ b/examples/gen13.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen13.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create an index over the length of our entire note. + kcps init 1/p3 + kndx phasor kcps + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kval table kndx, ifn, ixmode + + ; Generate a sine waveform, use our Table #1 value to + ; vary its frequency by 100 Hz from its base frequency. + ibasefreq = 440 + kfreq = kval * 100 + a1 oscil 20000, ibasefreq + kfreq, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a polynomial function (using GEN13). +f 1 0 1025 13 1 1 0 5 0 3 0 1 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen14.csd b/examples/gen14.csd new file mode 100644 index 0000000..eaf8970 --- /dev/null +++ b/examples/gen14.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen14.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create an index over the length of our entire note. + kcps init 1/p3 + kndx phasor kcps + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kval table kndx, ifn, ixmode + + ; Generate a sine waveform, use our Table #1 value to + ; vary its frequency by 100 Hz from its base frequency. + ibasefreq = 440 + kfreq = kval * 100 + a1 oscil 20000, ibasefreq + kfreq, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a polynomial function (using GEN14). +f 1 0 1025 14 1 1 0 5 0 3 0 1 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen16.csd b/examples/gen16.csd new file mode 100644 index 0000000..a08f6ac --- /dev/null +++ b/examples/gen16.csd @@ -0,0 +1,54 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen16.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 128 +nchnls = 1 + +instr 1 + kcps init 1/p3 + kndx phasor kcps + + ifn = p4 + ixmode = 1 + kval table kndx, ifn, ixmode + + ibasefreq = 440 + kfreq = kval * ibasefreq + a1 oscil 20000, ibasefreq + kfreq, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + + +f 1 0 16384 10 1 + +f 2 0 1024 16 1 1024 1 0 +f 3 0 1024 16 1 1024 2 0 +f 4 0 1024 16 1 1024 10 0 +f 5 0 1024 16 1 1024 -1 0 +f 6 0 1024 16 1 1024 -2 0 +f 7 0 1024 16 1 1024 -10 0 + +i 1 0 2 2 +i 1 + . 3 +i 1 + . 4 +i 1 + . 5 +i 1 + . 6 +i 1 + . 7 + +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gen19.csd b/examples/gen19.csd new file mode 100644 index 0000000..726bc3a --- /dev/null +++ b/examples/gen19.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gen19.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create an index over the length of our entire note. + kcps init 1/p3 + kndx phasor kcps + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kval table kndx, ifn, ixmode + + ; Generate a sine waveform, use our Table #1 value to + ; vary its frequency by 100 Hz from its base frequency. + ibasefreq = 440 + kfreq = kval * 100 + a1 oscil 20000, ibasefreq + kfreq, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a bell curve (using GEN19). +f 1 0 16384 -19 1 1 260 1 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for 3 seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/gogobel.csd b/examples/gogobel.csd new file mode 100644 index 0000000..39ac87a --- /dev/null +++ b/examples/gogobel.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o gogobel.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; kamp = 31129.60 + ; kfreq = 440 + ; ihrd = 0.5 + ; ipos = 0.561 + ; imp = 1 + ; kvibf = 6.0 + ; kvamp = 0.3 + ; ivfn = 2 + + a1 gogobel 31129.60, 440, 0.5, 0.561, 1, 6.0, 0.3, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, the "marmstk1.wav" audio file. +f 1 0 256 1 "marmstk1.wav" 0 0 0 +; Table #2, a sine wave for the vibrato. +f 2 0 128 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/goto.csd b/examples/goto.csd new file mode 100644 index 0000000..1f69f24 --- /dev/null +++ b/examples/goto.csd @@ -0,0 +1,42 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o goto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + a1 oscil 10000, 440, 1 + goto playit + + ; The goto will go to the playit label. + ; It will skip any code in between like this comment. + +playit: + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a simple sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/grain.csd b/examples/grain.csd new file mode 100644 index 0000000..60f9146 --- /dev/null +++ b/examples/grain.csd @@ -0,0 +1,44 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o grain.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +instr 1 + insnd = 10 + ibasfrq = 44100 / ftlen(insnd) ; Use original sample rate of insnd file + + kamp expseg 220, p3/2, 600, p3/2, 220 + kpitch line ibasfrq, p3, ibasfrq * .8 + kdens line 600, p3, 200 + kaoff line 0, p3, 5000 + kpoff line 0, p3, ibasfrq * .5 + kgdur line .4, p3, .1 + imaxgdur = .5 + + ar grain kamp, kpitch, kdens, kaoff, kpoff, kgdur, insnd, 5, imaxgdur, 0.0 + out ar +endin + + +</CsInstruments> +<CsScore> + +f5 0 512 20 2 ; Hanning window +f10 0 262144 1 "mary.wav" 0 0 0 +i1 0 6 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/grain2.csd b/examples/grain2.csd new file mode 100644 index 0000000..5eb8db1 --- /dev/null +++ b/examples/grain2.csd @@ -0,0 +1,105 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o grain2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 48000 +kr = 750 +ksmps = 64 +nchnls = 2 + +/* square wave */ +i_ ftgen 1, 0, 4096, 7, 1, 2048, 1, 0, -1, 2048, -1 +/* window */ +i_ ftgen 2, 0, 16384, 7, 0, 4096, 1, 4096, 0.3333, 8192, 0 +/* sine wave */ +i_ ftgen 3, 0, 1024, 10, 1 +/* room parameters */ +i_ ftgen 7, 0, 64, -2, 4, 50, -1, -1, -1, 11, \ + 1, 26.833, 0.05, 0.85, 10000, 0.8, 0.5, 2, \ + 1, 1.753, 0.05, 0.85, 5000, 0.8, 0.5, 2, \ + 1, 39.451, 0.05, 0.85, 7000, 0.8, 0.5, 2, \ + 1, 33.503, 0.05, 0.85, 7000, 0.8, 0.5, 2, \ + 1, 36.151, 0.05, 0.85, 7000, 0.8, 0.5, 2, \ + 1, 29.633, 0.05, 0.85, 7000, 0.8, 0.5, 2 + +ga01 init 0 + +/* generate bandlimited square waves */ + +i0 = 0 +loop1: +imaxh = sr / (2 * 440.0 * exp (log(2.0) * (i0 - 69) / 12)) +i_ ftgen i0 + 256, 0, 4096, -30, 1, 1, imaxh +i0 = i0 + 1 + if (i0 < 127.5) igoto loop1 + + instr 1 + +p3 = p3 + 0.2 + +/* note velocity */ +iamp = 0.0039 + p5 * p5 / 16192 +/* vibrato */ +kcps oscili 1, 8, 3 +kenv linseg 0, 0.05, 0, 0.1, 1, 1, 1 +/* frequency */ +kcps = (kcps * kenv * 0.01 + 1) * 440 * exp(log(2) * (p4 - 69) / 12) +/* grain ftable */ +kfn = int(256 + 69 + 0.5 + 12 * log(kcps / 440) / log(2)) +/* grain duration */ +kgdur port 100, 0.1, 20 +kgdur = kgdur / kcps + +a1 grain2 kcps, kcps * 0.02, kgdur, 50, kfn, 2, -0.5, 22, 2 +a1 butterlp a1, 3000 +a2 grain2 kcps, kcps * 0.02, 4 / kcps, 50, kfn, 2, -0.5, 23, 2 +a2 butterbp a2, 12000, 8000 +a2 butterbp a2, 12000, 8000 +aenv1 linseg 0, 0.01, 1, 1, 1 +aenv2 linseg 3, 0.05, 1, 1, 1 +aenv3 linseg 1, p3 - 0.2, 1, 0.07, 0, 1, 0 + +a1 = aenv1 * aenv3 * (a1 + a2 * 0.7 * aenv2) + +ga01 = ga01 + a1 * 10000 * iamp + + endin + +/* output instr */ + + instr 81 + +i1 = 0.000001 +aLl, aLh, aRl, aRh spat3di ga01 + i1*i1*i1*i1, 3.0, 4.0, 0.0, 0.5, 7, 4 +ga01 = 0 +aLl butterlp aLl, 800.0 +aRl butterlp aRl, 800.0 + + outs aLl + aLh, aRl + aRh + + endin + + +</CsInstruments> +<CsScore> + +t 0 60 + +i 1 0.0 1.3 60 127 +i 1 2.0 1.3 67 127 +i 1 4.0 1.3 64 112 +i 1 4.0 1.3 72 112 + +i 81 0 6.4 + +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/grain3.csd b/examples/grain3.csd new file mode 100644 index 0000000..3c8a3f2 --- /dev/null +++ b/examples/grain3.csd @@ -0,0 +1,120 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o grain3.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 48000 +kr = 1000 +ksmps = 48 +nchnls = 1 + +/* Bartlett window */ +itmp ftgen 1, 0, 16384, 20, 3, 1 +/* sawtooth wave */ +itmp ftgen 2, 0, 16384, 7, 1, 16384, -1 +/* sine */ +itmp ftgen 4, 0, 1024, 10, 1 +/* window for "soft sync" with 1/32 overlap */ +itmp ftgen 5, 0, 16384, 7, 0, 256, 1, 7936, 1, 256, 0, 7936, 0 +/* generate bandlimited sawtooth waves */ +itmp ftgen 3, 0, 4096, -30, 2, 1, 2048 +icnt = 0 +loop01: +; 100 tables for 8 octaves from 30 Hz +ifrq = 30 * exp(log(2) * 8 * icnt / 100) +itmp ftgen icnt + 100, 0, 4096, -30, 3, 1, sr / (2 * ifrq) +icnt = icnt + 1 + if (icnt < 99.5) igoto loop01 +/* convert frequency to table number */ +#define FRQ2FNUM(xout'xcps'xbsfn) # + +$xout = int(($xbsfn) + 0.5 + (100 / 8) * log(($xcps) / 30) / log(2)) +$xout limit $xout, $xbsfn, $xbsfn + 99 + +# + +/* instr 1: pulse width modulated grains */ + + instr 1 + +kfrq = 523.25 ; frequency +$FRQ2FNUM(kfnum'kfrq'100) ; table number +kfmd = kfrq * 0.02 ; random variation in frequency +kgdur = 0.2 ; grain duration +kdens = 200 ; density +iseed = 1 ; random seed + +kphs oscili 0.45, 1, 4 ; phase + +a1 grain3 kfrq, 0, kfmd, 0.5, kgdur, kdens, 100, \ + kfnum, 1, -0.5, 0, iseed, 2 +a2 grain3 kfrq, 0.5 + kphs, kfmd, 0.5, kgdur, kdens, 100, \ + kfnum, 1, -0.5, 0, iseed, 2 + +; de-click +aenv linseg 0, 0.01, 1, p3 - 0.05, 1, 0.04, 0, 1, 0 + + out aenv * 2250 * (a1 - a2) + + endin + +/* instr 2: phase variation */ + + instr 2 + +kfrq = 220 ; frequency +$FRQ2FNUM(kfnum'kfrq'100) ; table number +kgdur = 0.2 ; grain duration +kdens = 200 ; density +iseed = 2 ; random seed + +kprdst expon 0.5, p3, 0.02 ; distribution + +a1 grain3 kfrq, 0.5, 0, 0.5, kgdur, kdens, 100, \ + kfnum, 1, 0, -kprdst, iseed, 64 + +; de-click +aenv linseg 0, 0.01, 1, p3 - 0.05, 1, 0.04, 0, 1, 0 + + out aenv * 1500 * a1 + + endin + +/* instr 3: "soft sync" */ + + instr 3 + +kdens = 130.8 ; base frequency +kgdur = 2 / kdens ; grain duration + +kfrq expon 880, p3, 220 ; oscillator frequency +$FRQ2FNUM(kfnum'kfrq'100) ; table number + +a1 grain3 kfrq, 0, 0, 0, kgdur, kdens, 3, kfnum, 5, 0, 0, 0, 2 +a2 grain3 kfrq, 0.667, 0, 0, kgdur, kdens, 3, kfnum, 5, 0, 0, 0, 2 + +; de-click +aenv linseg 0, 0.01, 1, p3 - 0.05, 1, 0.04, 0, 1, 0 + + out aenv * 10000 * (a1 - a2) + + endin + + +</CsInstruments> +<CsScore> + +t 0 60 +i 1 0 3 +i 2 4 3 +i 3 8 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/granule.csd b/examples/granule.csd new file mode 100644 index 0000000..625c2bc --- /dev/null +++ b/examples/granule.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o granule.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 +instr 1 +; +k1 linseg 0,0.5,1,(p3-p2-1),1,0.5,0 +a1 granule p4*k1,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,\ + p16,p17,p18,p19,p20,p21,p22,p23,p24 +a2 granule p4*k1,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,\ + p16,p17,p18,p19, p20+0.17,p21,p22,p23,p24 +outs a1,a2 +endin + + +</CsInstruments> +<CsScore> + +; f statement read sound file sine.aiff in the SFDIR +; directory into f-table 1 +f1 0 262144 1 "mary.wav" 0 0 0 +i1 0 10 2000 64 0.5 0 0 1 4 0 0.005 5 0.01 50 0.02 50 30 30 0.39 \ + 1 1.42 0.29 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/greaterequal.csd b/examples/greaterequal.csd new file mode 100644 index 0000000..e14bb31 --- /dev/null +++ b/examples/greaterequal.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o greaterequal.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Get the 4th p-field from the score. + k1 = p4 + + ; Is it greater than or equal to 3? (1 = true, 0 = false) + k2 = (p4 >= 3 ? 1 : 0) + + ; Print the values of k1 and k2. + printks "k1 = %f, k2 = %f\\n", 1, k1, k2 +endin + + +</CsInstruments> +<CsScore> + +; Call Instrument #1 with a p4 = 2. +i 1 0 0.5 2 +; Call Instrument #1 with a p4 = 3. +i 1 1 0.5 3 +; Call Instrument #1 with a p4 = 4. +i 1 2 0.5 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/greaterthan.csd b/examples/greaterthan.csd new file mode 100644 index 0000000..a16a2f4 --- /dev/null +++ b/examples/greaterthan.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o greaterthan.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Get the 4th p-field from the score. + k1 = p4 + + ; Is it greater than 3? (1 = true, 0 = false) + k2 = (p4 > 3 ? 1 : 0) + + ; Print the values of k1 and k2. + printks "k1 = %f, k2 = %f\\n", 1, k1, k2 +endin + + +</CsInstruments> +<CsScore> + +; Call Instrument #1 with a p4 = 2. +i 1 0 0.5 2 +; Call Instrument #1 with a p4 = 3. +i 1 1 0.5 3 +; Call Instrument #1 with a p4 = 4. +i 1 2 0.5 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/guiro.csd b/examples/guiro.csd new file mode 100644 index 0000000..021a0fa --- /dev/null +++ b/examples/guiro.csd @@ -0,0 +1,30 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o guiro.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + + instr 01 ;example of a guiro +a1 guiro p4, 0.01 + out a1 + endin + + +</CsInstruments> +<CsScore> + +i1 0 1 20000 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/harmon.csd b/examples/harmon.csd new file mode 100644 index 0000000..18a511f --- /dev/null +++ b/examples/harmon.csd @@ -0,0 +1,57 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o harmon.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; The frequency of the base note. + inote = 440 + + ; Generate the base note. + avco vco 20000, inote, 1 + + kestfrq = inote + kmaxvar = 0.4 + + ; Calculate frequencies 3 semitones above and + ; below the base note. + kgenfreq1 = inote * semitone(3) + kgenfreq2 = inote * semitone(-3) + + imode = 1 + iminfrq = inote - 200 + iprd = 0.1 + + ; Generate the harmony notes. + a1 harmon avco, kestfrq, kmaxvar, kgenfreq1, kgenfreq2, \ + imode, iminfrq, iprd + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/hilbert.csd b/examples/hilbert.csd new file mode 100644 index 0000000..f362852 --- /dev/null +++ b/examples/hilbert.csd @@ -0,0 +1,75 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o hilbert.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 1 + idur = p3 + ; Initial amount of frequency shift. + ; It can be positive or negative. + ibegshift = p4 + ; Final amount of frequency shift. + ; It can be positive or negative. + iendshift = p5 + + ; A simple envelope for determining the + ; amount of frequency shift. + kfreq linseg ibegshift, idur, iendshift + + ; Use the sound of your choice. + ain soundin "mary.wav" + + ; Phase quadrature output derived from input signal. + areal, aimag hilbert ain + + ; Quadrature oscillator. + asin oscili 1, kfreq, 1 + acos oscili 1, kfreq, 1, .25 + + ; Use a trigonometric identity. + ; See the references for further details. + amod1 = areal * acos + amod2 = aimag * asin + + ; Both sum and difference frequencies can be + ; output at once. + ; aupshift corresponds to the sum frequencies. + aupshift = (amod1 - amod2) * 0.7 + ; adownshift corresponds to the difference frequencies. + adownshift = (amod1 + amod2) * 0.7 + + ; Notice that the adding of the two together is + ; identical to the output of ring modulation. + + out aupshift +endin + + +</CsInstruments> +<CsScore> + +; Sine table for quadrature oscillator. +f 1 0 16384 10 1 + +; Starting with no shift, ending with all +; frequencies shifted up by 200 Hz. +i 1 0 2 0 200 + +; Starting with no shift, ending with all +; frequencies shifted down by 200 Hz. +i 1 2 2 0 -200 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/hilbert_barberpole.csd b/examples/hilbert_barberpole.csd new file mode 100644 index 0000000..fa77094 --- /dev/null +++ b/examples/hilbert_barberpole.csd @@ -0,0 +1,75 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o hilbert_barberpole.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +; kr must equal sr for the barberpole effect to work. +kr = 44100 +ksmps = 1 +nchnls = 2 + +; Instrument #1 +instr 1 + idur = p3 + ibegshift = p4 + iendshift = p5 + + ; sawtooth wave, not bandlimited + asaw phasor 100 + ; add offset to center phasor amplitude between -.5 and .5 + asaw = asaw - .5 + ; sawtooth wave, with amplitude of 10000 + ain = asaw * 20000 + + ; The envelope of the frequency shift. + kfreq linseg ibegshift, idur, iendshift + + ; Phase quadrature output derived from input signal. + areal, aimag hilbert ain + + ; The quadrature oscillator. + asin oscili 1, kfreq, 1 + acos oscili 1, kfreq, 1, .25 + + ; Based on trignometric identities. + amod1 = areal * acos + amod2 = aimag * asin + + ; Calculate the up-shift and down-shift. + aupshift = (amod1 + amod2) * 0.7 + adownshift = (amod1 - amod2) * 0.7 + + ; Mix in the original signal to achieve the barberpole effect. + amix1 = aupshift + ain + amix2 = aupshift + ain + + ; Make sure the output doesn't get louder than the original signal. + aout1 balance amix1, ain + aout2 balance amix2, ain + + outs aout1, aout2 +endin + + +</CsInstruments> +<CsScore> + +; Table 1: A sine wave for the quadrature oscillator. +f 1 0 16384 10 1 + +; The score. +; p4 = frequency shifter, starting frequency. +; p5 = frequency shifter, ending frequency. +i 1 0 6 -10 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/hrtfer.csd b/examples/hrtfer.csd new file mode 100644 index 0000000..6a5059a --- /dev/null +++ b/examples/hrtfer.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o hrtfer.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +instr 1 + kaz linseg 0, p3, -360 ; move the sound in circle + kel linseg -40, p3, 45 ; around the listener, changing + ; elevation as its turning + asrc soundin "beats.wav" + aleft,aright hrtfer asrc, kaz, kel, "HRTFcompact" + aleftscale = aleft * 200 + arightscale = aright * 200 + + outs aleftscale, arightscale +endin + + +</CsInstruments> +<CsScore> + +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/hrtfmove.csd b/examples/hrtfmove.csd new file mode 100644 index 0000000..dbfc1cb --- /dev/null +++ b/examples/hrtfmove.csd @@ -0,0 +1,60 @@ +<CsoundSynthesizer> +<CsOptions> +; Select flags here +; realtime audio out +; -o dac +; For Non-realtime ouput leave only the line below: + -o hrtf.wav +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +gasrc init 0 + +instr 1 ;a plucked string + + kamp = p4 + kcps = cpspch(p5) + icps = cpspch(p5) + + a1 pluck kamp, kcps, icps, 0, 1 + + gasrc = a1 + +endin + +instr 10 ;uses output from instr1 as source + + kaz linseg 0, p3, 720 ;2 full rotations + + aleft,aright hrtfmove gasrc, kaz,0, "hrtf-44100-left.dat","hrtf-44100-right.dat" + + outs aleft, aright + +endin + +</CsInstruments> +<CsScore> + +; Play Instrument 1: a simple arpeggio +i1 0 .2 15000 8.00 +i1 + .2 15000 8.04 +i1 + .2 15000 8.07 +i1 + .2 15000 8.11 +i1 + .2 15000 9.02 +i1 + 1.5 15000 8.11 +i1 + 1.5 15000 8.07 +i1 + 1.5 15000 8.04 +i1 + 1.5 15000 8.00 +i1 + 1.5 15000 7.09 +i1 + 1.5 15000 8.00 + +; Play Instrument 10 for 10 seconds. +i10 0 10 + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/hrtfmove2.csd b/examples/hrtfmove2.csd new file mode 100644 index 0000000..c63f6bb --- /dev/null +++ b/examples/hrtfmove2.csd @@ -0,0 +1,60 @@ +<CsoundSynthesizer> +<CsOptions> +; Select flags here +; realtime audio out +; -o dac +; For Non-realtime ouput leave only the line below: + -o hrtf.wav +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +gasrc init 0 + +instr 1 ;a plucked string + + kamp = p4 + kcps = cpspch(p5) + icps = cpspch(p5) + + a1 pluck kamp, kcps, icps, 0, 1 + + gasrc = a1 + +endin + +instr 10 ;uses output from instr1 as source + + kaz linseg 0, p3, 720 ;2 full rotations + + aleft,aright hrtfmove2 gasrc, kaz,0, "hrtf-44100-left.dat","hrtf-44100-right.dat" + + outs aleft, aright + +endin + +</CsInstruments> +<CsScore> + +; Play Instrument 1: a simple arpeggio +i1 0 .2 15000 8.00 +i1 + .2 15000 8.04 +i1 + .2 15000 8.07 +i1 + .2 15000 8.11 +i1 + .2 15000 9.02 +i1 + 1.5 15000 8.11 +i1 + 1.5 15000 8.07 +i1 + 1.5 15000 8.04 +i1 + 1.5 15000 8.00 +i1 + 1.5 15000 7.09 +i1 + 1.5 15000 8.00 + +; Play Instrument 10 for 10 seconds. +i10 0 10 + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/hrtfstat.csd b/examples/hrtfstat.csd new file mode 100644 index 0000000..ba98f98 --- /dev/null +++ b/examples/hrtfstat.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> + <CsOptions> + ; Select flags here + ; realtime audio out + ; -o dac + ; For Non-realtime ouput leave only the line below: + -o hrtf.wav + </CsOptions> + <CsInstruments> + + sr = 44100 + kr = 4410 + ksmps = 10 + nchnls = 2 + + gasrc init 0 + + instr 1 ;a plucked string + + kamp = p4 + kcps = cpspch(p5) + icps = cpspch(p5) + + a1 pluck kamp, kcps, icps, 0, 1 + + gasrc = a1 + + endin + + instr 10 ;uses output from instr1 as source + + aleft,aright hrtfstat gasrc, 90,0, "hrtf-44100-left.dat","hrtf-44100-right.dat" + + outs aleft, aright + + endin + + </CsInstruments> + <CsScore> + + ; Play Instrument 1: a plucked string + i1 0 2 20000 8.00 + + ; Play Instrument 10 for 2 seconds. + i10 0 2 + + </CsScore> +</CsoundSynthesizer> diff --git a/examples/hsboscil.csd b/examples/hsboscil.csd new file mode 100644 index 0000000..fc72c94 --- /dev/null +++ b/examples/hsboscil.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o hsboscil.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; synth waveform +giwave ftgen 1, 0, 1024, 10, 1, 1, 1, 1 +; blending window +giblend ftgen 2, 0, 1024, -19, 1, 0.5, 270, 0.5 + +; Instrument #1 - produces Risset's glissando. +instr 1 + kamp = 10000 + kbrite = 0.5 + ibasfreq = 200 + ioctcnt = 5 + + ; Change ktone linearly from 0 to 1, + ; over the period defined by p3. + ktone line 0, p3, 1 + + a1 hsboscil kamp, ktone, kbrite, ibasfreq, giwave, giblend, ioctcnt + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for ten seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/hsboscil_midi.csd b/examples/hsboscil_midi.csd new file mode 100644 index 0000000..7be64eb --- /dev/null +++ b/examples/hsboscil_midi.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o hsboscil_midi.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; synth waveform +giwave ftgen 1, 0, 1024, 10, 1, 1, 1, 1 +; blending window +giblend ftgen 2, 0, 1024, -19, 1, 0.5, 270, 0.5 + +; Instrument #1 - use hsboscil in a MIDI instrument. +instr 1 + ibase = cpsoct(6) + ioctcnt = 5 + + ; all octaves sound alike. + itona octmidi + ; velocity is mapped to brightness + ibrite ampmidi 3 + + ; Map an exponential envelope for the amplitude. + kenv expon 20000, 1, 100 + + asig hsboscil kenv, itona, ibrite, ibase, giwave, giblend, ioctcnt + out asig +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for ten minutes +i 1 0 600 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/hvs1.csd b/examples/hvs1.csd new file mode 100644 index 0000000..5921402 --- /dev/null +++ b/examples/hvs1.csd @@ -0,0 +1,63 @@ +<CsoundSynthesizer>
+<CsOptions>
+; Select audio/midi flags here according to platform
+; Audio out Audio in No messages
+-odac -iadc -d ;;;RT audio I/O
+</CsOptions>
+<CsInstruments>
+
+sr=44100
+ksmps=100
+nchnls=2
+
+; Example by Gabriel Maldonado and Andres Cabrera
+
+0dbfs = 1
+
+ginumLinesX init 16
+ginumParms init 3
+
+
+giOutTab ftgen 5,0,8, -2, 0
+giPosTab ftgen 6,0,32, -2, 3,2,1,0,4,5,6,7,8,9,10, 11, 15, 14, 13, 12
+giSnapTab ftgen 8,0,64, -2, 1,1,1, 2,0,0, 3,2,0, 2,2,2, 5,2,1, 2,3,4, 6,1,7, 0,0,0, \
+ 1,3,5, 3,4,4, 1,5,8, 1,1,5, 4,3,2, 3,4,5, 7,6,5, 7,8,9
+tb0_init giOutTab
+
+ FLpanel "hsv1",500,100,10,10,0
+gk1,ih1 FLslider "X", 0,1, 0,5, -1, 400,30, 50,20
+ FLpanel_end
+ FLrun
+
+ instr 1
+; kx, inumParms, inumPointsX, iOutTab, iPosTab, iSnapTab [, iConfigTab]
+ hvs1 gk1, ginumParms, ginumLinesX, giOutTab, giPosTab, giSnapTab ;, iConfigTab
+
+k0 init 0
+k1 init 1
+k2 init 2
+
+printk2 tb0(k0)
+printk2 tb0(k1), 10
+printk2 tb0(k2), 20
+
+aosc1 oscil tb0(k0)/20, tb0(k1)*100 + 200, 1
+aosc2 oscil tb0(k1)/20, tb0(k2)*100 + 200, 1
+aosc3 oscil tb0(k2)/20, tb0(k0)*100 + 200, 1
+aosc4 oscil tb0(k1)/20, tb0(k0)*100 + 200, 1
+aosc5 oscil tb0(k2)/20, tb0(k1)*100 + 200, 1
+aosc6 oscil tb0(k0)/20, tb0(k2)*100 + 200, 1
+
+outs aosc1 + aosc2 + aosc3, aosc4 + aosc5 + aosc6
+ endin
+
+
+</CsInstruments>
+<CsScore>
+
+f1 0 1024 10 1
+f0 3600
+i1 0 3600
+
+</CsScore>
+</CsoundSynthesizer>
diff --git a/examples/ifthen.csd b/examples/ifthen.csd new file mode 100644 index 0000000..6da0636 --- /dev/null +++ b/examples/ifthen.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ifthen.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Get the note value from the fourth p-field. + knote = p4 + + ; Does the user want a low note? + if (knote == 0) then + kcps = 220 + ; Does the user want a middle note? + elseif (knote == 1) then + kcps = 440 + ; Does the user want a high note? + elseif (knote == 2) then + kcps = 880 + endif + + ; Create the note. + kamp init 25000 + ifn = 1 + a1 oscili kamp, kcps, ifn + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; p4: 0=low note, 1=middle note, 2=high note. +; Play Instrument #1 for one second, low note. +i 1 0 1 0 +; Play Instrument #1 for one second, middle note. +i 1 1 1 1 +; Play Instrument #1 for one second, high note. +i 1 2 1 2 +e + + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/igoto.csd b/examples/igoto.csd new file mode 100644 index 0000000..266bf96 --- /dev/null +++ b/examples/igoto.csd @@ -0,0 +1,60 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o igoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Get the value of the 4th p-field from the score. + iparam = p4 + + ; If iparam is 1 then play the high note. + ; If not then play the low note. + if (iparam == 1) igoto highnote + igoto lownote + +highnote: + ifreq = 880 + goto playit + +lownote: + ifreq = 440 + goto playit + +playit: + ; Print the values of iparam and ifreq. + print iparam + print ifreq + + a1 oscil 10000, ifreq, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a simple sine wave. +f 1 0 32768 10 1 + +; p4: 1 = high note, anything else = low note +; Play Instrument #1 for one second, a low note. +i 1 0 1 0 +; Play a Instrument #1 for one second, a high note. +i 1 1 1 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ihold.csd b/examples/ihold.csd new file mode 100644 index 0000000..9c67f1a --- /dev/null +++ b/examples/ihold.csd @@ -0,0 +1,52 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ihold.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; A simple oscillator with its note held indefinitely. + a1 oscil 10000, 440, 1 + ihold + + ; If p4 equals 0, turn the note off. + if (p4 == 0) kgoto offnow + kgoto playit + +offnow: + ; Turn the note off now. + turnoff + +playit: + ; Play the note. + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: an ordinary sine wave. +f 1 0 32768 10 1 + +; p4 = turn the note off (if it is equal to 0). +; Start playing Instrument #1. +i 1 0 1 1 +; Turn Instrument #1 off after 3 seconds. +i 1 3 1 0 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/imageopcodes.csd b/examples/imageopcodes.csd new file mode 100644 index 0000000..7e4e4e6 --- /dev/null +++ b/examples/imageopcodes.csd @@ -0,0 +1,55 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +;-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +-o imageopcodes.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> +sr=48000 +ksmps=1 +nchnls=2 + +; this test .csd copies image.png into a new file 'imageout.png' + +giimage1 imageload "image.png" +giimagew, giimageh imagesize giimage1 +giimage2 imagecreate giimagew,giimageh + + instr 1 + +kndx = 0 +kx_ linseg 0, p3, 1 + +myloop: +ky_ = kndx/(giimageh) +kr_ kg_ kb_ imagegetpixel giimage1, kx_, ky_ +imagesetpixel giimage2, kx_, ky_, kr_, kg_, kb_ +loop_lt kndx, 0.5, (giimageh), myloop + endin + + instr 2 + +imagesave giimage2, "imageout.png" + endin + + instr 3 +imagefree giimage1 +imagefree giimage2 + endin + +</CsInstruments> + +<CsScore> + +i1 1 1 +i2 2 1 +i3 3 1 +e + +</CsScore> + +</CsoundSynthesizer> + diff --git a/examples/impuls20.aiff b/examples/impuls20.aiff Binary files differnew file mode 100644 index 0000000..f8a528b --- /dev/null +++ b/examples/impuls20.aiff diff --git a/examples/include.csd b/examples/include.csd new file mode 100644 index 0000000..6649db8 --- /dev/null +++ b/examples/include.csd @@ -0,0 +1,39 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o include.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a basic oscillator. +instr 1 + kamp = 10000 + kcps = 440 + ifn = 1 + + a1 oscil kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Include the file for Table #1. +#include "table1.inc" + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/insremot.csd b/examples/insremot.csd new file mode 100644 index 0000000..67cf0b4 --- /dev/null +++ b/examples/insremot.csd @@ -0,0 +1,29 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o insremot.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> +nchnls = 1 + +insremot "192.168.1.100", "192.168.1.101", 1 + +instr 1 + aq barmodel 1, 1, p4, 0.001, 0.23, 5, p5, p6, p7 + out aq +endin + +</CsInstruments> + +<CsScore> +f0 360 + +e +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/insremotM.csd b/examples/insremotM.csd new file mode 100644 index 0000000..1f93fad --- /dev/null +++ b/examples/insremotM.csd @@ -0,0 +1,31 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o insremotM.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> +nchnls = 1 + +insremot "192.168.1.100", "192.168.1.101", 1 + +instr 1 + aq barmodel 1, 1, p4, 0.001, 0.23, 5, p5, p6, p7 + out aq +endin + +</CsInstruments> + +<CsScore> +i1 0 0.5 3 0.2 500 0.05 +i1 0.5 0.5 -3 0.3 1000 0.05 +i1 1.0 0.5 -3 0.4 1000 0.1 +i1 1.5 4.0 -3 0.5 800 0.05 +e +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/instr.csd b/examples/instr.csd new file mode 100644 index 0000000..ff80cdb --- /dev/null +++ b/examples/instr.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o instr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + iamp = 10000 + icps = 440 + iphs = 0 + + a1 oscils iamp, icps, iphs + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/int.csd b/examples/int.csd new file mode 100644 index 0000000..e80a6bb --- /dev/null +++ b/examples/int.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o int.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = 16 / 5 + i2 = int(i1) + + print i2 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/integ.csd b/examples/integ.csd new file mode 100644 index 0000000..6872919 --- /dev/null +++ b/examples/integ.csd @@ -0,0 +1,57 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o integ.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 -- a differentiated signal. +instr 1 + ; Generate a band-limited pulse train. + asrc buzz 20000, 440, 20, 1 + + ; Differentiate the signal. + adiff diff asrc + + out adiff +endin + +; Instrument #2 -- a re-integrated signal. +instr 2 + ; Generate a band-limited pulse train. + asrc buzz 20000, 440, 20, 1 + + ; Differentiate the signal. + adiff diff asrc + + ; Re-integrate the previously differentiated signal. + a1 integ adiff + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 1 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/interp.csd b/examples/interp.csd new file mode 100644 index 0000000..506ec9f --- /dev/null +++ b/examples/interp.csd @@ -0,0 +1,55 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o interp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 8000 +kr = 8 +ksmps = 1000 +nchnls = 1 + +; Instrument #1 - a simple instrument. +instr 1 + ; Create an amplitude envelope. + kamp linseg 0, p3/2, 20000, p3/2, 0 + + ; The amplitude envelope will sound rough because it + ; jumps every ksmps period, 1000. + a1 oscil kamp, 440, 1 + out a1 +endin + +; Instrument #2 - a smoother sounding instrument. +instr 2 + ; Create an amplitude envelope. + kamp linseg 0, p3/2, 25000, p3/2, 0 + aamp interp kamp + + ; The amplitude envelope will sound smoother due to + ; linear interpolation at the higher a-rate, 8000. + a1 oscil aamp, 440, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 256 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/jacktransport.csd b/examples/jacktransport.csd new file mode 100644 index 0000000..d19adca --- /dev/null +++ b/examples/jacktransport.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> + +<CsOptions> +-+rtaudio=JACK -b 64 --sched -o dac:system:playback_ +</CsOptions> + +<CsInstruments> +sr = 44100 +ksmps = 16 +nchnls = 2 + + + instr 1 +jacktransport p4, p5 + endin + + instr 2 +jacktransport p4 + endin + + +</CsInstruments> +<CsScore> + +i2 0 5 1; play +i2 5 1 0; stop +i1 6 5 1 2 ; move at 2 seconds and start playing back +i1 11 1 0 0 ; stop and rewind + +e + +</CsScore> + </CsoundSynthesizer> diff --git a/examples/jitter.csd b/examples/jitter.csd new file mode 100644 index 0000000..4f1b187 --- /dev/null +++ b/examples/jitter.csd @@ -0,0 +1,53 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o jitter.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +; Instrument #1 -- plain instrument. +instr 1 + aplain vco 20000, 220, 2, 0.83 + + outs aplain, aplain +endin + +; Instrument #2 -- instrument with jitter. +instr 2 + ; Create a signal modulated the jitter opcode. + kamp init 2 + kcpsmin init 4 + kcpsmax init 6 + kj jitter kamp, kcpsmin, kcpsmax + + aplain vco 20000, 220, 2, 0.83 + ajitter vco 20000, 220+kj, 2, 0.83 + + outs aplain, ajitter +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 3 seconds. +i 1 0 3 +; Play Instrument #2 for 3 seconds. +i 2 3 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/jitter2.csd b/examples/jitter2.csd new file mode 100644 index 0000000..fc1a5d0 --- /dev/null +++ b/examples/jitter2.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o jitter2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +; Instrument #1 -- plain instrument. +instr 1 + aplain vco 20000, 220, 2, 0.83 + + outs aplain, aplain +endin + +; Instrument #2 -- instrument with jitter. +instr 2 + ; Create a signal modulated with the jitter2 opcode. + ktotamp init 2 + kamp1 init 0.66 + kcps1 init 3 + kamp2 init 0.66 + kcps2 init 3 + kamp3 init 0.66 + kcps3 init 3 + kj jitter2 ktotamp, kamp1, kcps1, kamp2, kcps2, \ + kamp3, kcps3 + + aplain vco 20000, 220, 2, 0.83 + ajitter vco 20000, 220+kj, 2, 0.83 + + outs aplain, ajitter +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 3 seconds. +i 1 0 3 +; Play Instrument #2 for 3 seconds. +i 2 3 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/kgoto.csd b/examples/kgoto.csd new file mode 100644 index 0000000..a9dc12a --- /dev/null +++ b/examples/kgoto.csd @@ -0,0 +1,57 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o kgoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Change kval linearly from 0 to 2 over + ; the period set by the third p-field. + kval line 0, p3, 2 + + ; If kval is greater than or equal to 1 then play the high note. + ; If not then play the low note. + if (kval >= 1) kgoto highnote + kgoto lownote + +highnote: + kfreq = 880 + goto playit + +lownote: + kfreq = 440 + goto playit + +playit: + ; Print the values of kval and kfreq. + printks "kval = %f, kfreq = %f\\n", 1, kval, kfreq + + a1 oscil 10000, kfreq, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: a simple sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/kickroll.het b/examples/kickroll.het Binary files differnew file mode 100644 index 0000000..6a9531b --- /dev/null +++ b/examples/kickroll.het diff --git a/examples/kickroll.wav b/examples/kickroll.wav Binary files differnew file mode 100755 index 0000000..3352cd8 --- /dev/null +++ b/examples/kickroll.wav diff --git a/examples/leftbrace.csd b/examples/leftbrace.csd new file mode 100644 index 0000000..9bff945 --- /dev/null +++ b/examples/leftbrace.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o abs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +nchnls = 2 + +gaReverbSend init 0 + +; a simple sine wave partial +instr 1 + idur = p3 + iamp = p4 + ifreq = p5 + aenv linseg 0.0, 0.1*idur, iamp, 0.6*idur, iamp, 0.3*idur, 0.0 + aosc oscili aenv, ifreq, 1 + vincr gaReverbSend, aosc +endin + +; global reverb instrument +instr 2 + al, ar reverbsc gaReverbSend, gaReverbSend, 0.85, 12000 + outs gaReverbSend+al, gaReverbSend+ar + clear gaReverbSend +endin + +</CsInstruments> +<CsScore> +f1 0 4096 10 1 + +{ 4 CNT + { 8 PARTIAL + ; start time duration amplitude frequency + + i1 [0.5 * $CNT.] [1 + ($CNT * 0.2)] [500 + (~ * 200)] [800 + (200 * $CNT.) + ($PARTIAL. * 20)] + } +} + +i2 0 6 +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/lessequal.csd b/examples/lessequal.csd new file mode 100644 index 0000000..bc16838 --- /dev/null +++ b/examples/lessequal.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o lessequal.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Get the 4th p-field from the score. + k1 = p4 + + ; Is it less than or equal to 3? (1 = true, 0 = false) + k2 = (p4 <= 3 ? 1 : 0) + + ; Print the values of k1 and k2. + printks "k1 = %f, k2 = %f\\n", 1, k1, k2 +endin + + +</CsInstruments> +<CsScore> + +; Call Instrument #1 with a p4 = 2. +i 1 0 0.5 2 +; Call Instrument #1 with a p4 = 3. +i 1 1 0.5 3 +; Call Instrument #1 with a p4 = 4. +i 1 2 0.5 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/lessthan.csd b/examples/lessthan.csd new file mode 100644 index 0000000..9d21b8f --- /dev/null +++ b/examples/lessthan.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o lessthan.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Get the 4th p-field from the score. + k1 = p4 + + ; Is it less than 3? (1 = true, 0 = false) + k2 = (p4 < 3 ? 1 : 0) + + ; Print the values of k1 and k2. + printks "k1 = %f, k2 = %f\\n", 1, k1, k2 +endin + + +</CsInstruments> +<CsScore> + +; Call Instrument #1 with a p4 = 2. +i 1 0 0.5 2 +; Call Instrument #1 with a p4 = 3. +i 1 1 0.5 3 +; Call Instrument #1 with a p4 = 4. +i 1 2 0.5 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/lfo.csd b/examples/lfo.csd new file mode 100644 index 0000000..8c1feaa --- /dev/null +++ b/examples/lfo.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o lfo.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 10 + kcps = 5 + itype = 4 + + k1 lfo kamp, kcps, itype + ar oscil p4, p5+k1, 1 + out ar +endin + + +</CsInstruments> +<CsScore> + +; Table #1: an ordinary sine wave. +f 1 0 32768 10 1 + +; p4 = amplitude of the output signal. +; p5 = frequency (in cycles per second) of the output signal. +; Play Instrument #1 for two seconds. +i 1 0 2 10000 220 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/line.csd b/examples/line.csd new file mode 100644 index 0000000..5d81d9d --- /dev/null +++ b/examples/line.csd @@ -0,0 +1,55 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o line.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Define kcps as a frequency value that linearly declines + ; from 880 to 220. It declines over the period set by p3. + kcps line 880, p3, 220 + + a1 oscil 20000, kcps, 1 + out a1 +endin + +instr 2 + kcps line 880, 1, 660 ; kcps won't stop at 660 if p3 > 1 + a1 oscil 20000, kcps, 1 + out a1 +endin + +instr 3 + kcps line 880, 1, 660, 1, 660 ; kcps will stay at 660 after 1 sec. + a1 oscil 20000, kcps, 1 + out a1 +endin + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 + +i 2 3 2 + +i 3 6 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/linrand.csd b/examples/linrand.csd new file mode 100644 index 0000000..25b7bd3 --- /dev/null +++ b/examples/linrand.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o linrand.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number between 0 and 1. + ; krange = 1 + + i1 linrand 1 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/linseg.csd b/examples/linseg.csd new file mode 100644 index 0000000..692d18c --- /dev/null +++ b/examples/linseg.csd @@ -0,0 +1,76 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o linseg.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; p4 = frequency in pitch-class notation. + kcps = cpspch(p4) + + ; Create an amplitude envelope. + kenv linseg 0, p3*0.25, 1, p3*0.75, 0 + kamp = kenv * 30000 + + a1 oscil kamp, kcps, 1 + out a1 +endin + + +instr 2 + ; p4 = frequency in pitch-class notation. + kcps = cpspch(p4) + + ; Create an amplitude envelope. + kenv linseg 0, 0.25, 1, 0.75, 0 ; kenv will go into negative if p3 > 1 + kamp = kenv * 30000 + + a1 oscil kamp, kcps, 1 + out a1 +endin + +instr 3 + ; p4 = frequency in pitch-class notation. + kcps = cpspch(p4) + + ; Create an amplitude envelope. + kenv linseg 0, 0.25, 1, 0.75, 0, 1, 0 ; kenv will stay at 0 indefinetely at the end + kamp = kenv * 30000 + + a1 oscil kamp, kcps, 1 + out a1 +endin +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for a half-second, p4=8.00 +i 1 0 0.5 8.00 +; Play Instrument #1 for a half-second, p4=8.01 +i 1 1 0.5 8.01 +; Play Instrument #1 for a half-second, p4=8.02 +i 1 2 0.5 8.02 +; Play Instrument #1 for a half-second, p4=8.03 +i 1 3 0.5 8.03 + +i 2 4 1.5 8.00 ; Notice the problem with linseg + +i 3 6 1.5 8.00 ; this is the solution (instr 3) +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/linsegr.csd b/examples/linsegr.csd new file mode 100644 index 0000000..69e96d9 --- /dev/null +++ b/examples/linsegr.csd @@ -0,0 +1,53 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o linsegr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; p4 = frequency in pitch-class notation. + kcps = cpspch(p4) + + ; Use an amplitude envelope with second-long release. + kenv linsegr 1, p3, 0.25, 1, 0 + kamp = kenv * 30000 + + a1 oscil kamp, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Make sure the score lasts for four seconds. +f 0 4 + +; p4 = frequency (in pitch-class notation). +; Play Instrument #1 for a half-second, p4=8.00 +i 1 0 0.5 8.00 +; Play Instrument #1 for a half-second, p4=8.01 +i 1 1 0.5 8.01 +; Play Instrument #1 for a half-second, p4=8.02 +i 1 2 0.5 8.02 +; Play Instrument #1 for a half-second, p4=8.03 +i 1 3 0.5 8.03 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/log.csd b/examples/log.csd new file mode 100644 index 0000000..6c1ffab --- /dev/null +++ b/examples/log.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o log.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = log(8) + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/log10.csd b/examples/log10.csd new file mode 100644 index 0000000..89fc92d --- /dev/null +++ b/examples/log10.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o log10.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = log10(8) + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/logbtwo.csd b/examples/logbtwo.csd new file mode 100644 index 0000000..0608b13 --- /dev/null +++ b/examples/logbtwo.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o logbtwo.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = logbtwo(3) + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/logcurve.csd b/examples/logcurve.csd new file mode 100644 index 0000000..b5d3173 --- /dev/null +++ b/examples/logcurve.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in Silent +-odac -idac -d ;;;realtime output</CsOptions> +<CsInstruments> + +sr = 48000 +ksmps = 100 +nchnls = 2 + +/*--- ---*/ + + instr 1 ; logcurve test + +kmod phasor 1/200 + +kout logcurve kmod, 2 + + printk2 kmod + printk2 kout + + endin + +/*--- ---*/ +</CsInstruments> +<CsScore> + +i1 0 8888 + +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/loopseg.csd b/examples/loopseg.csd new file mode 100644 index 0000000..18d3e74 --- /dev/null +++ b/examples/loopseg.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o loopseg.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 +instr 1 + kfreq line 1, p3, 20 + + klp loopseg kfreq, 0, 0, 0, 0.5, 30000, 1, 0 + + a1 oscil klp, 440, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for five seconds. +i 1 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/lorenz.csd b/examples/lorenz.csd new file mode 100644 index 0000000..0d1b18f --- /dev/null +++ b/examples/lorenz.csd @@ -0,0 +1,68 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o lorenz.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 2 + +; Instrument #1 - a lorenz system in 3D space. +instr 1 + ; Create a basic tone. + kamp init 25000 + kcps init 220 + ifn = 1 + asnd oscil kamp, kcps, ifn + + ; Figure out its X, Y, Z coordinates. + ksv init 10 + krv init 28 + kbv init 2.667 + kh init 0.0003 + ix = 0.6 + iy = 0.6 + iz = 0.6 + iskip = 1 + ax1, ay1, az1 lorenz ksv, krv, kbv, kh, ix, iy, iz, iskip + + ; Place the basic tone within 3D space. + kx downsamp ax1 + ky downsamp ay1 + kz downsamp az1 + idist = 1 + ift = 0 + imode = 1 + imdel = 1.018853416 + iovr = 2 + aw2, ax2, ay2, az2 spat3d asnd, kx, ky, kz, idist, \ + ift, imode, imdel, iovr + + ; Convert the 3D sound to stereo. + aleft = aw2 + ay2 + aright = aw2 - ay2 + + outs aleft, aright +endin + + +</CsInstruments> +<CsScore> + +; Table #1 a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 5 seconds. +i 1 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/loscil.csd b/examples/loscil.csd new file mode 100644 index 0000000..e639657 --- /dev/null +++ b/examples/loscil.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o loscil.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + ; If you don't know the frequency of your audio file, + ; set both the kcps and ibas parameters equal to 1. + kcps = 1 + ifn = 1 + ibas = 1 + + a1 loscil kamp, kcps, ifn, ibas + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: an audio file. +; Its table size is deferred, +; and format taken from the soundfile header. +f 1 0 0 1 "beats.wav" 0 0 0 + +; Play Instrument #1 for 6 seconds. +; This will loop the audio file several times. +i 1 0 6 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/loscil3.csd b/examples/loscil3.csd new file mode 100644 index 0000000..9fa68bd --- /dev/null +++ b/examples/loscil3.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o loscil3.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + ; If you don't know the frequency of your audio file, + ; set both the kcps and ibas parameters equal to 1. + kcps = 1 + ifn = 1 + ibas = 1 + + a1 loscil3 kamp, kcps, ifn, ibas + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: an audio file. +; Its table size is deferred, +; and format taken from the soundfile header. +f 1 0 0 1 "beats.wav" 0 0 0 + +; Play Instrument #1 for 6 seconds. +; This will loop the drum pattern several times. +i 1 0 6 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/lowpass2.csd b/examples/lowpass2.csd new file mode 100644 index 0000000..343a4dc --- /dev/null +++ b/examples/lowpass2.csd @@ -0,0 +1,52 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o lowpass2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Sean Costello */ +; Orchestra file for resonant filter sweep of a sawtooth-like waveform. + sr = 44100 + kr = 2205 + ksmps = 20 + nchnls = 1 + + instr 1 + + idur = p3 + ifreq = p4 + iamp = p5 * .5 + iharms = (sr*.4) / ifreq + +; Sawtooth-like waveform + asig gbuzz 1, ifreq, iharms, 1, .9, 1 + +; Envelope to control filter cutoff + kfreq linseg 1, idur * 0.5, 5000, idur * 0.5, 1 + + afilt lowpass2 asig, kfreq, 30 + +; Simple amplitude envelope + kenv linseg 0, .1, iamp, idur -.2, iamp, .1, 0 + out asig * kenv + + endin + + +</CsInstruments> +<CsScore> + +/* Written by Sean Costello */ +f1 0 8192 9 1 1 .25 + +i1 0 5 100 1000 +i1 5 5 200 1000 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/lowres.csd b/examples/lowres.csd new file mode 100644 index 0000000..02f88fe --- /dev/null +++ b/examples/lowres.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o lowres.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a nice sawtooth waveform. + asig vco 5000, 440, 1 + + ; Vary the cutoff frequency from 30 to 300 Hz. + kcutoff line 30, p3, 300 + kresonance = 10 + + ; Apply the filter. + a1 lowres asig, kcutoff, kresonance + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave for the vco opcode. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/lowresx.csd b/examples/lowresx.csd new file mode 100644 index 0000000..2decb5e --- /dev/null +++ b/examples/lowresx.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o lowresx.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - play the sawtooth waveform through a +; stack of filters. +instr 1 + ; Use a nice sawtooth waveform. + asig vco 5000, 440, 1 + + ; Vary the cutoff frequency from 30 to 300 Hz. + kcutoff line 30, p3, 300 + kresonance = 3 + inumlayer = 2 + + alr lowresx asig, kcutoff, kresonance, inumlayer + + ; It gets loud, so clip the output amplitude to 30,000. + a1 clip alr, 1, 30000 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave for the vco opcode. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/lpf18.csd b/examples/lpf18.csd new file mode 100644 index 0000000..6416473 --- /dev/null +++ b/examples/lpf18.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o lpf18.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a sine waveform. + ; Note that its amplitude (kamp) ranges from 0 to 1. + kamp init 1 + kcps init 440 + knh init 3 + ifn = 1 + asine buzz kamp, kcps, knh, ifn + + ; Filter the sine waveform. + ; Vary the cutoff frequency (kfco) from 300 to 3,000 Hz. + kfco line 300, p3, 3000 + kres init 0.8 + kdist init 0.3 + aout lpf18 asine, kfco, kres, kdist + + out aout * 30000 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for four seconds. +i 1 0 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/lphasor.csd b/examples/lphasor.csd new file mode 100644 index 0000000..c28b962 --- /dev/null +++ b/examples/lphasor.csd @@ -0,0 +1,44 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o lphashor.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> +; Example by Jonathan Murphy Dec 2006 + + sr = 44100 + ksmps = 10 + nchnls = 1 + + instr 1 + + ifn = 1 ; table number + ilen = nsamp(ifn) ; return actual number of samples in table + itrns = 1 ; no transposition + ilps = 0 ; loop starts at index 0 + ilpe = ilen ; ends at value returned by nsamp above + imode = 3 ; loop forwards & backwards + istrt = 10000 ; commence playback at index 10000 samples + ; lphasor provides index into f1 + alphs lphasor itrns, ilps, ilpe, imode, istrt + atab tablei alphs, ifn + ; amplify signal + atab = atab * 10000 + + out atab + + endin + +</CsInstruments> + +<CsScore> +f 1 0 262144 1 "beats.wav" 0 4 1 +i1 0 60 +e +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/lpshold.csd b/examples/lpshold.csd new file mode 100644 index 0000000..bfd650f --- /dev/null +++ b/examples/lpshold.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o lpshold.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 +instr 1 + kfreq line 1, p3, 20 + + klp lpshold kfreq, 0, 0, 0, p3*0.25, 20000, p3*0.75, 0 + + a1 oscil klp, 440, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for five seconds. +i 1 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/madsr.csd b/examples/madsr.csd new file mode 100644 index 0000000..4e58021 --- /dev/null +++ b/examples/madsr.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o madsr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Iain McCurdy */ +; Initialize the global variables. +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Attack time. + iattack = 0.5 + ; Decay time. + idecay = 0 + ; Sustain level. + isustain = 1 + ; Release time. + irelease = 0.5 + aenv madsr iattack, idecay, isustain, irelease + + a1 oscili 10000, 440, 1 + out a1*aenv +endin + + +</CsInstruments> +<CsScore> + +/* Written by Iain McCurdy */ +; Table #1, a sine wave. +f 1 0 1024 10 1 + +; Leave the score running for 6 seconds. +f 0 6 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/makecsd.py b/examples/makecsd.py new file mode 100644 index 0000000..49b3e5c --- /dev/null +++ b/examples/makecsd.py @@ -0,0 +1,38 @@ +import glob +import os, re +files = glob.glob('*.orc') +files.sort() +files.remove('ambisonic.orc') +files.remove('fluid.orc') +files.remove('fluidAllOut.orc') + +for file in files: + #print file + handleorc = open(file, 'r') + handlesco = open(file[:file.index('.orc')]+'.sco') + #print file[:file.index('.sco')]+'.csd' + newtext = '''<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in Silent MIDI in +-odac -idac -d -M0 ;;;realtime output +; For Non-realtime ouput leave only the line below: +; -o ''' + file[:file.index('.orc')] + '''.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +''' + commentorc = re.compile('/.*[0-9a-z]*\.orc.*/[\N\R]*') + commentsco = re.compile('/.*[0-9a-z]*\.sco.*/[\N\R]*') + orc = handleorc.read() + orc = commentorc.sub('',orc) + sco = handlesco.read() + sco = commentsco.sub('',sco) + + newtext += orc + '\n</CsInstruments>\n<CsScore>\n' + sco + '\n</CsScore>\n</CsoundSynthesizer>\n' + #print newtext + dest = open(file[:file.index('.orc')]+'.csd','w') + dest.write(newtext) + dest.close() + handleorc.close() + handlesco.close() + diff --git a/examples/mandol.csd b/examples/mandol.csd new file mode 100644 index 0000000..3bd1bfd --- /dev/null +++ b/examples/mandol.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o mandol.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; kamp = 30000 + ; kfreq = 880 + ; kpluck = 0.4 + ; kdetune = 0.99 + ; kgain = 0.99 + ; ksize = 2 + ; ifn = 1 + ; ifreq = 220 + + a1 mandol 30000, 880, 0.4, 0.99, 0.99, 2, 1, 220 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: the "mandpluk.aiff" audio file +f 1 0 8192 1 "mandpluk.aiff" 0 0 0 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/mandpluk.aiff b/examples/mandpluk.aiff Binary files differnew file mode 100644 index 0000000..e387438 --- /dev/null +++ b/examples/mandpluk.aiff diff --git a/examples/marimba.csd b/examples/marimba.csd new file mode 100644 index 0000000..ed7fb1b --- /dev/null +++ b/examples/marimba.csd @@ -0,0 +1,65 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o marimba.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +ksmps = 128 +nchnls = 2 + +; Instrument #1. +instr 1 + ifreq = cpspch(p4) + ihrd = 0.1 + ipos = 0.561 + imp = 1 + kvibf = 6.0 + kvamp = 0.05 + ivibfn = 2 + idec = 0.6 + + a1 marimba 20000, ifreq, ihrd, ipos, imp, kvibf, kvamp, ivibfn, idec, 20, 10 + + outs a1, a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, the "marmstk1.wav" audio file. +f 1 0 256 1 "marmstk1.wav" 0 0 0 +; Table #2, a sine wave for the vibrato. +f 2 0 128 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 8.09 +i 1 + 0.5 8.00 +i 1 + 0.5 7.00 +i 1 + 0.25 8.02 +i 1 + 0.25 8.01 +i 1 + 0.25 7.09 +i 1 + 0.25 8.02 +i 1 + 0.25 8.01 +i 1 + 0.25 7.09 +i 1 + 0.3333 8.09 +i 1 + 0.3333 8.02 +i 1 + 0.3334 8.01 +i 1 + 0.25 8.00 +i 1 + 0.3333 8.09 +i 1 + 0.3333 8.02 +i 1 + 0.25 8.01 +i 1 + 0.3333 7.00 +i 1 + 0.3334 6.00 + +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/marmstk1.wav b/examples/marmstk1.wav Binary files differnew file mode 100644 index 0000000..f4ab328 --- /dev/null +++ b/examples/marmstk1.wav diff --git a/examples/mary.wav b/examples/mary.wav Binary files differnew file mode 100644 index 0000000..a1b284d --- /dev/null +++ b/examples/mary.wav diff --git a/examples/maxalloc.csd b/examples/maxalloc.csd new file mode 100644 index 0000000..dc41489 --- /dev/null +++ b/examples/maxalloc.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o maxalloc.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Limit Instrument #1 to three instances. +maxalloc 1, 3 + +; Instrument #1 +instr 1 + ; Generate a waveform, get the cycles per second from the 4th p-field. + a1 oscil 6500, p4, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Just generate a nice, ordinary sine wave. +f 1 0 32768 10 1 + +; Play five instances of Instrument #1 for one second. +; Note that 4th p-field contains cycles per second. +i 1 0 1 220 +i 1 0 1 440 +i 1 0 1 880 +i 1 0 1 1320 +i 1 0 1 1760 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/mdelay.csd b/examples/mdelay.csd new file mode 100644 index 0000000..b793838 --- /dev/null +++ b/examples/mdelay.csd @@ -0,0 +1,63 @@ +<CsoundSynthesizer>
+<CsOptions>
+; Select audio/midi flags here according to platform
+; Audio out Audio in No messages
+-odac -iadc -d -M0 -Q1;;;RT audio I/O with MIDI in
+</CsOptions>
+<CsInstruments>
+
+sr = 44100
+kr = 4410
+ksmps = 10
+nchnls = 2
+
+; Example by Giorgio Zucco 2007
+
+instr 1 ;Triggered by MIDI notes on channel 1
+
+ kstatus init 0
+ ifund notnum
+ ivel veloc
+
+ noteondur 1, ifund, ivel, 1
+
+ kstatus = kstatus + 1
+
+ idel1 = .2
+ idel2 = .4
+ idel3 = .6
+ idel4 = .8
+
+ ;make four delay lines
+
+ mdelay kstatus,1,ifund+2, ivel,idel1
+ mdelay kstatus,1,ifund+4, ivel,idel2
+ mdelay kstatus,1,ifund+6, ivel,idel3
+ mdelay kstatus,1,ifund+8, ivel,idel4
+
+endin
+
+</CsInstruments>
+<CsScore>
+; Dummy ftable
+f 0 60
+</CsScore>
+</CsoundSynthesizer>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/metro.csd b/examples/metro.csd new file mode 100644 index 0000000..e0e2663 --- /dev/null +++ b/examples/metro.csd @@ -0,0 +1,23 @@ +<CsoundSynthesizer> +<CsOptions> +-odac -B441 -b441 +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 100 +ksmps = 441 +nchnls = 2 + + instr 1 +ktrig metro 0.2 +printk2 ktrig + endin + +</CsInstruments> +<CsScore> +i 1 0 20 + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/midichannelaftertouch.csd b/examples/midichannelaftertouch.csd new file mode 100644 index 0000000..e462da7 --- /dev/null +++ b/examples/midichannelaftertouch.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o midichannelaftertouch.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kaft init 0 + midichannelaftertouch kaft + + ; Display the aftertouch value when it changes. + printk2 kaft +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for ten seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/midichn.csd b/examples/midichn.csd new file mode 100644 index 0000000..0a8b558 --- /dev/null +++ b/examples/midichn.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o midichn.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 midichn + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 12 seconds. +i 1 0 12 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/midichn_advanced.csd b/examples/midichn_advanced.csd new file mode 100644 index 0000000..d743671 --- /dev/null +++ b/examples/midichn_advanced.csd @@ -0,0 +1,63 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o midichn_advanced.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 10 +nchnls = 1 + + massign 1, 1 ; all channels use instr 1 + massign 2, 1 + massign 3, 1 + massign 4, 1 + massign 5, 1 + massign 6, 1 + massign 7, 1 + massign 8, 1 + massign 9, 1 + massign 10, 1 + massign 11, 1 + massign 12, 1 + massign 13, 1 + massign 14, 1 + massign 15, 1 + massign 16, 1 + +gicnt = 0 ; note counter + + instr 1 + +gicnt = gicnt + 1 ; update note counter +kcnt init gicnt ; copy to local variable +ichn midichn ; get channel number +istime times ; note-on time + + if (ichn > 0.5) goto l2 ; MIDI note + printks "note %.0f (time = %.2f) was activated from the score\\n", \ + 3600, kcnt, istime + goto l1 +l2: + printks "note %.0f (time = %.2f) was activated from channel %.0f\\n", \ + 3600, kcnt, istime, ichn +l1: + endin + + +</CsInstruments> +<CsScore> + +t 0 60 +f 0 6 2 -2 0 +i 1 1 0.5 +i 1 4 0.5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/midichn_advanced.mid b/examples/midichn_advanced.mid Binary files differnew file mode 100644 index 0000000..00a4c30 --- /dev/null +++ b/examples/midichn_advanced.mid diff --git a/examples/midiin.csd b/examples/midiin.csd new file mode 100644 index 0000000..3da017a --- /dev/null +++ b/examples/midiin.csd @@ -0,0 +1,66 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d -M0 -+rtmidi=virtual ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o midiin.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> + +sr = 44100 +ksmps = 10 +nchnls = 1 + +; Example by schwaahed 2006 + + massign 0, 130 ; make sure that all channels + pgmassign 0, 130 ; and programs are assigned to test instr + + + instr 130 + +knotelength init 0 +knoteontime init 0 + +kstatus, kchan, kdata1, kdata2 midiin + +if (kstatus == 128) then +knoteofftime times +knotelength = knoteofftime - knoteontime +printks "kstatus= %d, kchan = %d, \\tnote# = %d, velocity = %d \\tNote OFF\\t%f %f\\n", 0, kstatus, kchan, kdata1,kdata2, knoteofftime, knotelength + +elseif (kstatus == 144) then +knoteontime times +printks "kstatus= %d, kchan = %d, \\tnote# = %d, velocity = %d \\tNote ON\\t%f\\n", 0, kstatus, kchan, kdata1, kdata2, knoteontime + + +elseif (kstatus == 160) then +printks "kstatus= %d, kchan = %d, \\tkdata1 = %d, kdata2 = %d \\tPolyphonic Aftertouch\\n", 0, kstatus, kchan, kdata1, kdata2 + +elseif (kstatus == 176) then +printks "kstatus= %d, kchan = %d, \\t CC = %d, value = %d \\tControl Change\\n", 0, kstatus, kchan, kdata1, kdata2 + +elseif (kstatus == 192) then +printks "kstatus= %d, kchan = %d, \\tkdata1 = %d, kdata2 = %d \\tProgram Change\\n", 0, kstatus, kchan, kdata1, kdata2 + +elseif (kstatus == 208) then +printks "kstatus= %d, kchan = %d, \\tkdata1 = %d, kdata2 = %d \\tChannel Aftertouch\\n", 0, kstatus, kchan, kdata1, kdata2 + +elseif (kstatus == 224) then +printks "kstatus= %d, kchan = %d, \\t ( data1 , kdata2 ) = ( %d, %d )\\tPitch Bend\\n", 0, kstatus, kchan, kdata1, kdata2 + +endif + + endin + +</CsInstruments> + +<CsScore> +i130 0 3600 +e +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/midinoteoff.csd b/examples/midinoteoff.csd new file mode 100644 index 0000000..f904ddd --- /dev/null +++ b/examples/midinoteoff.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o midinoteoff.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kkey init 0 + kvelocity init 0 + + midinoteoff kkey, kvelocity + + ; Display the key value when it changes. + printk2 kkey +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for ten seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/midinoteoncps.csd b/examples/midinoteoncps.csd new file mode 100644 index 0000000..e5d11c2 --- /dev/null +++ b/examples/midinoteoncps.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o midinoteoncps.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kcps init 0 + kvelocity init 0 + + midinoteoncps kcps, kvelocity + + ; Display the cycles-per-second value when it changes. + printk2 kcps +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for ten seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/midinoteonkey.csd b/examples/midinoteonkey.csd new file mode 100644 index 0000000..66110a7 --- /dev/null +++ b/examples/midinoteonkey.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o midinoteonkey.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kkey init 0 + kvelocity init 0 + + midinoteonkey kkey, kvelocity + + ; Display the key value when it changes. + printk2 kkey +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for ten seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/midinoteonoct.csd b/examples/midinoteonoct.csd new file mode 100644 index 0000000..e00a929 --- /dev/null +++ b/examples/midinoteonoct.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o midinoteonoct.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + koct init 0 + kvelocity init 0 + + midinoteonoct koct, kvelocity + + ; Display the octave-point-decimal value when it changes. + printk2 koct +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for ten seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/midinoteonpch.csd b/examples/midinoteonpch.csd new file mode 100644 index 0000000..ce02f60 --- /dev/null +++ b/examples/midinoteonpch.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o midinoteonpch.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kpch init 0 + kvelocity init 0 + + midinoteonpch kpch, kvelocity + + ; Display the pitch-class value when it changes. + printk2 kpch +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for ten seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/midion_scale.csd b/examples/midion_scale.csd new file mode 100644 index 0000000..cd09bcf --- /dev/null +++ b/examples/midion_scale.csd @@ -0,0 +1,52 @@ +<CsoundSynthesizer>
+<CsOptions>
+; Select audio/midi flags here according to platform
+; Audio out Audio in No messages
+-odac -iadc -d -M0 -Q1 ;;;RT audio I/O with MIDI in
+</CsOptions>
+<CsInstruments>
+
+sr = 44100
+kr = 4410
+ksmps = 10
+nchnls = 2
+
+; Example by Giorgio Zucco 2007
+
+instr 1 ; Triggered by MIDI notes on channel 1
+
+ ivel veloc
+
+ krate = 8
+ iscale = 100 ;f
+
+ ; Random sequence from table f100
+ krnd randh int(14),krate,-1
+ knote table abs(krnd),iscale
+ ; Generates random notes from the scale on ftable 100
+ ; on channel 1 of csound's MIDI output
+ midion 1,knote,ivel
+
+endin
+
+</CsInstruments>
+<CsScore>
+f100 0 32 -2 40 50 60 70 80 44 54 65 74 84 39 49 69 69
+
+; Dummy ftable
+f0 60
+</CsScore>
+</CsoundSynthesizer>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/midion_simple.csd b/examples/midion_simple.csd new file mode 100644 index 0000000..6556aaa --- /dev/null +++ b/examples/midion_simple.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer>
+<CsOptions>
+; Select audio/midi flags here according to platform
+; Audio out Audio in No messages
+-odac -iadc -d -M0 -Q1 ;;;RT audio I/O with MIDI in
+</CsOptions>
+<CsInstruments>
+
+sr = 44100
+kr = 4410
+ksmps = 10
+nchnls = 2
+
+; Example by Giorgio Zucco 2007
+
+
+instr 1 ;Triggered by MIDI notes on channel 1
+
+ ifund notnum
+ ivel veloc
+
+ knote1 init ifund
+ knote2 init ifund + 3
+ knote3 init ifund + 5
+
+ ;minor chord on MIDI out channel 1
+ ;Needs something plugged to csound's MIDI output
+ midion 1, knote1,ivel
+ midion 1, knote2,ivel
+ midion 1, knote3,ivel
+
+endin
+
+
+</CsInstruments>
+<CsScore>
+; Dummy ftable
+f0 60
+</CsScore>
+</CsoundSynthesizer>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/midipitchbend.csd b/examples/midipitchbend.csd new file mode 100644 index 0000000..dbe6934 --- /dev/null +++ b/examples/midipitchbend.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o midipitchbend.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kpb init 0 + + midipitchbend kpb + + ; Display the pitch-bend value when it changes. + printk2 kpb +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for ten seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/midremot.csd b/examples/midremot.csd new file mode 100644 index 0000000..67e774d --- /dev/null +++ b/examples/midremot.csd @@ -0,0 +1,115 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o midremot.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> +sr = 44100 +kr = 441 +ksmps = 100 +nchnls = 2 + +massign 1,1 +massign 2,2 +massign 3,3 +massign 4,4 +massign 5,5 + +ga1 init 0 +ga2 init 0 + +gi1 sfload "19Trumpet.sf2" + +gi2 sfload "01hpschd.sf2" + +gi3 sfload "07AcousticGuitar.sf2" + +gi4 sfload "22Bassoon.sf2" + +gitab ftgen 1,0,1024,10,1 + +midremot "192.168.1.100", "192.168.1.101", 1 +midremot "192.168.1.100", "192.168.1.102", 2 +midremot "192.168.1.100", "192.168.1.103", 3 + +midglobal "192.168.1.100", 5 + + + instr 1 + sfpassign 0, gi1 +ifreq cpsmidi +iamp ampmidi 10 +inum notnum +ivel veloc +kamp linsegr 1,1,1,.1,0 +kfreq init 1 +a1,a2 sfplay ivel,inum,kamp*iamp,kfreq,0,0 + outs a1,a2 +vincr ga1, a1*.5 +vincr ga2, a2*.5 + endin + + instr 2 + sfpassign 0, gi2 +ifreq cpsmidi +iamp ampmidi 15 +inum notnum +ivel veloc +kamp linsegr 1,1,1,.1,0 +kfreq init 1 +a1,a2 sfplay ivel,inum,kamp*iamp,kfreq,0,0 + outs a1,a2 +vincr ga1, a1*.4 +vincr ga2, a2*.4 + endin + + instr 3 + sfpassign 0, gi3 +ifreq cpsmidi +iamp ampmidi 10 +inum notnum +ivel veloc +kamp linsegr 1,1,1,.1,0 +kfreq init 1 +a1,a2 sfplay ivel,inum,kamp*iamp,kfreq,0,0 + outs a1,a2 +vincr ga1, a1*.5 +vincr ga2, a2*.5 + endin + + instr 4 + sfpassign 0, gi4 +ifreq cpsmidi +iamp ampmidi 15 +inum notnum +ivel veloc +kamp linsegr 1,1,1,.1,0 +kfreq init 1 +a1,a2 sfplay ivel,inum,kamp*iamp,kfreq,0,0 + outs a1,a2 +vincr ga1, a1*.5 +vincr ga2, a2*.5 + endin + +instr 5 + kamp midic7 1,0,1 + denorm ga1 + denorm ga2 +aL, aR reverbsc ga1, ga2, .9, 16000, sr, 0.5 + outs aL, aR + ga1 = 0 + ga2 = 0 +endin + +</CsInstruments> +<CsScore> +; Score +f0 160 +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/mode.csd b/examples/mode.csd new file mode 100644 index 0000000..de53ed5 --- /dev/null +++ b/examples/mode.csd @@ -0,0 +1,87 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o moogvcf.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +instr 1; 2 modes excitator + +idur init p3 +ifreq11 init p4 +ifreq12 init p5 +iQ11 init p6 +iQ12 init p7 +iamp init ampdb(p8) +ifreq21 init p9 +ifreq22 init p10 +iQ21 init p11 +iQ22 init p12 + +; to simulate the shock between the excitator and the resonator +ashock mpulse 3,0 + +aexc1 mode ashock,ifreq11,iQ11 +aexc1 = aexc1*iamp +aexc2 mode ashock,ifreq12,iQ12 +aexc2 = aexc2*iamp + + +aexc = (aexc1+aexc2)/2 + +;"Contact" condition : when aexc reaches 0, the excitator looses +;contact with the resonator, and stops "pushing it" +aexc limit aexc,0,3*iamp + +; 2modes resonator + +ares1 mode aexc,ifreq21,iQ21 +ares2 mode aexc,ifreq22,iQ22 + +ares = (ares1+ares2)/2 + +display aexc+ares,p3 +outs aexc+ares,aexc+ares + +endin + + +</CsInstruments> +<CsScore> + +;wooden excitator against glass resonator +i1 0 8 1000 3000 12 8 70 440 888 500 420 + +;felt against glass +i1 4 8 80 188 8 3 70 440 888 500 420 + +;wood against wood +i1 8 8 1000 3000 12 8 70 440 630 60 53 + +;felt against wood +i1 12 8 80 180 8 3 70 440 630 60 53 + + +i1 16 8 1000 3000 12 8 70 440 888 2000 1630 +i1 23 8 80 180 8 3 70 440 888 2000 1630 + + +;With a metallic excitator + +i1 33 8 1000 1800 1000 720 70 440 882 500 500 +i1 37 8 1000 1800 1000 850 70 440 630 60 53 + +i1 42 8 1000 1800 2000 1720 70 440 442 500 500 + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/modulus.csd b/examples/modulus.csd new file mode 100644 index 0000000..c4e59de --- /dev/null +++ b/examples/modulus.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o modulus.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = 5 % 3 + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/moog.csd b/examples/moog.csd new file mode 100644 index 0000000..7446524 --- /dev/null +++ b/examples/moog.csd @@ -0,0 +1,53 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o moog.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + kfreq = 220 + kfiltq = 0.81 + kfiltrate = 0 + kvibf = 1.4 + kvamp = 2.22 + iafn = 1 + iwfn = 2 + ivfn = 3 + + am moog kamp, kfreq, kfiltq, kfiltrate, kvibf, kvamp, iafn, iwfn, ivfn + + ; It tends to get loud, so clip moog's amplitude at 30,000. + a1 clip am, 2, 30000 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: the "mandpluk.aiff" audio file +f 1 0 8192 1 "mandpluk.aiff" 0 0 0 +; Table #2: the "impuls20.aiff" audio file +f 2 0 256 1 "impuls20.aiff" 0 0 0 +; Table #3: a sine wave +f 3 0 256 10 1 + +; Play Instrument #1 for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/moogvcf.csd b/examples/moogvcf.csd new file mode 100644 index 0000000..e1de278 --- /dev/null +++ b/examples/moogvcf.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o moogvcf.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a nice sawtooth waveform. + asig vco 32000, 220, 1 + + ; Vary the filter-cutoff frequency from .2 to 2 KHz. + kfco line 200, p3, 2000 + + ; Set the resonance amount to one. + krez init 1 + + ; Scale the amplitude to 32768. + iscale = 32768 + + a1 moogvcf asig, kfco, krez, iscale + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave for the vco opcode. +f 1 0 16384 10 1 + +; Play Instrument #1 for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/moogvcf2.csd b/examples/moogvcf2.csd new file mode 100644 index 0000000..6ba92f2 --- /dev/null +++ b/examples/moogvcf2.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o moogvcf.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a nice sawtooth waveform. + asig vco 32000, 220, 1 + + ; Vary the filter-cutoff frequency from .2 to 2 KHz. + kfco line 200, p3, 2000 + + ; Set the resonance amount to one. + krez init 1 + + a1 moogvcf2 asig, kfco, krez + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave for the vco opcode. +f 1 0 16384 10 1 + +; Play Instrument #1 for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/moscil.csd b/examples/moscil.csd new file mode 100644 index 0000000..77e968a --- /dev/null +++ b/examples/moscil.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer>
+<CsOptions>
+; Select audio/midi flags here according to platform
+; Audio out Audio in No messages
+-odac -iadc -d -M0 -Q1;;;RT audio I/O with MIDI in
+</CsOptions>
+<CsInstruments>
+
+sr = 44100
+kr = 4410
+ksmps = 10
+nchnls = 2
+
+; Example by Giorgio Zucco 2007
+
+
+instr 1 ;Triggered by MIDI notes on channel 1
+
+ inote notnum
+ ivel veloc
+
+ kpitch = 40
+ kfreq = 2
+
+ kdur = .04
+ kpause = .1
+
+ k1 lfo kpitch, kfreq,5
+
+ ;plays a stream of notes of kdur duration on MIDI channel 1
+ moscil 1, inote + k1, ivel, kdur, kpause
+
+endin
+
+</CsInstruments>
+<CsScore>
+; Dummy ftable
+f0 60
+</CsScore>
+</CsoundSynthesizer>
+
+
+
+
+
+
+
+
+
diff --git a/examples/mpulse.csd b/examples/mpulse.csd new file mode 100644 index 0000000..50a1241 --- /dev/null +++ b/examples/mpulse.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o mpulse.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +gkfreq init 0.1 + +instr 1 + kamp = 10000 + + a1 mpulse kamp, gkfreq + out a1 +endin + +instr 2 +; Assign the value of p4 to gkfreq +gkfreq init p4 +endin +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 10 +i 2 2 1 0.05 +i 2 4 1 0.01 +i 2 6 1 0.005 +i 2 8 1 0.001 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/multiplies.csd b/examples/multiplies.csd new file mode 100644 index 0000000..fbe1c6d --- /dev/null +++ b/examples/multiplies.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o multiplies.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = 24 * 8 + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/mute.csd b/examples/mute.csd new file mode 100644 index 0000000..79c370a --- /dev/null +++ b/examples/mute.csd @@ -0,0 +1,44 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o mute.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Mute Instrument #2. +mute 2 + +; Instrument #1. +instr 1 + a1 oscils 10000, 440, 0 + out a1 +endin + +; Instrument #2. +instr 2 + a1 oscils 10000, 880, 0 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/nestedap.csd b/examples/nestedap.csd new file mode 100644 index 0000000..c373e27 --- /dev/null +++ b/examples/nestedap.csd @@ -0,0 +1,68 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o nestedap.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +instr 5 + insnd = p4 + gasig diskin insnd, 1 +endin + +instr 10 + imax = 1 + idel1 = p4/1000 + igain1 = p5 + idel2 = p6/1000 + igain2 = p7 + idel3 = p8/1000 + igain3 = p9 + idel4 = p10/1000 + igain4 = p11 + idel5 = p12/1000 + igain5 = p13 + idel6 = p14/1000 + igain6 = p15 + + afdbk init 0 + + aout1 nestedap gasig+afdbk*.4, 3, imax, idel1, igain1, idel2, igain2, idel3, igain3 + + aout2 nestedap aout1, 2, imax, idel4, igain4, idel5, igain5 + + aout nestedap aout2, 1, imax, idel6, igain6 + + afdbk butterlp aout, 1000 + + outs gasig+(aout+aout1)/2, gasig-(aout+aout1)/2 + +gasig = 0 +endin + + +</CsInstruments> +<CsScore> + +f1 0 8192 10 1 + +; Diskin +; Sta Dur Soundin +i5 0 3 "beats.wav" + +; Reverb +; St Dur Del1 Gn1 Del2 Gn2 Del3 Gn3 Del4 Gn4 Del5 Gn5 Del6 Gn6 +i10 0 4 97 .11 23 .07 43 .09 72 .2 53 .2 119 .3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/noise-2.csd b/examples/noise-2.csd new file mode 100644 index 0000000..e58f378 --- /dev/null +++ b/examples/noise-2.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac ; -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o noise.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +FLpanel "noise", 200, 50, -1 , -1 + gkbeta, gislider1 FLslider "kbeta", -1, 1, 0, 5, -1, 180, 20, 10, 10 +FLpanelEnd +FLrun + +instr 1 + iamp = 0dbfs / 4 ; Peaks 12 dB below 0dbfs + print iamp + + a1 noise iamp, gkbeta + printk2 gkbeta + outs a1,a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one minute. +i 1 0 60 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/noise.csd b/examples/noise.csd new file mode 100644 index 0000000..741e46a --- /dev/null +++ b/examples/noise.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o noise.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 30000 + + ; Change the beta value linearly from 0 to 1. + kbeta line 0, p3, 1 + + a1 noise kamp, kbeta + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/noteondur.csd b/examples/noteondur.csd new file mode 100644 index 0000000..d333ba8 --- /dev/null +++ b/examples/noteondur.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer>
+<CsOptions>
+; Select audio/midi flags here according to platform
+; Audio out Audio in No messages
+-odac -iadc -d -M0 -Q1;;;RT audio I/O with MIDI in
+</CsOptions>
+<CsInstruments>
+
+sr = 44100
+kr = 4410
+ksmps = 10
+nchnls = 2
+
+; Example by Giorgio Zucco 2007
+
+instr 1 ;Turned on by MIDI notes on channel 1
+
+ ifund notnum
+ ivel veloc
+ idur = 1
+
+ ;chord with single key
+ noteondur 1, ifund, ivel, idur
+ noteondur 1, ifund+3, ivel, idur
+ noteondur 1, ifund+7, ivel, idur
+ noteondur 1, ifund+9, ivel, idur
+
+endin
+
+</CsInstruments>
+<CsScore>
+; Play Instrument #1 for 60 seconds.
+
+i1 0 60
+
+</CsScore>
+</CsoundSynthesizer>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/noteondur2.csd b/examples/noteondur2.csd new file mode 100644 index 0000000..358c501 --- /dev/null +++ b/examples/noteondur2.csd @@ -0,0 +1,57 @@ +<CsoundSynthesizer>
+<CsOptions>
+; Select audio/midi flags here according to platform
+; Audio out Audio in No messages
+-odac -iadc -d -M0 -Q1;;;RT audio I/O with MIDI in
+</CsOptions>
+<CsInstruments>
+
+sr = 44100
+kr = 4410
+ksmps = 10
+nchnls = 2
+
+; Example by Giorgio Zucco 2007
+
+instr 1
+
+ ifund notnum
+ ivel veloc
+ idur = 1
+
+ ;chord with single key
+ noteondur2 1, ifund, ivel, idur
+ noteondur2 1, ifund+3, ivel, idur
+ noteondur2 1, ifund+7, ivel, idur
+ noteondur2 1, ifund+9, ivel, idur
+
+endin
+
+
+
+</CsInstruments>
+<CsScore>
+; Dummy ftable
+f 0 60
+</CsScore>
+</CsoundSynthesizer>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/notequal.csd b/examples/notequal.csd new file mode 100644 index 0000000..d104723 --- /dev/null +++ b/examples/notequal.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o notequal.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Get the 4th p-field from the score. + k1 = p4 + + ; Is it not equal to 3? (1 = true, 0 = false) + k2 = (p4 != 3 ? 1 : 0) + + ; Print the values of k1 and k2. + printks "k1 = %f, k2 = %f\\n", 1, k1, k2 +endin + + +</CsInstruments> +<CsScore> + +; Call Instrument #1 with a p4 = 2. +i 1 0 0.5 2 +; Call Instrument #1 with a p4 = 3. +i 1 1 0.5 3 +; Call Instrument #1 with a p4 = 4. +i 1 2 0.5 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/notnum.csd b/examples/notnum.csd new file mode 100644 index 0000000..7cb874b --- /dev/null +++ b/examples/notnum.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o notnum.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 notnum + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 12 seconds. +i 1 0 12 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/notnum_complex.csd b/examples/notnum_complex.csd new file mode 100644 index 0000000..7e7c614 --- /dev/null +++ b/examples/notnum_complex.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 10 +nchnls = 2 + +; Set MIDI channel 1 to play instr 1. + massign 1, 1 + + instr 1 + +; Returns MIDI note number - an integer in range (0-127) +iNum notnum + +; Convert MIDI note number to Hz +iHz = (440.0*exp(log(2.0)*((iNum)-69.0)/12.0)) + +; Generate audio by indexing a table; fixed amplitude. +aosc oscil 10000, iHz, 1 + +; Since there is no enveloping, there will be clicks. + outs aosc, aosc + + endin + +</CsInstruments> +<CsScore> + +; Generate a Sine-wave to be indexed at audio rate +; by the oscil opcode. +f1 0 16384 10 1 + +; Keep the score "open" for 1 hour so that MIDI +; notes can allocate new note events, arbitrarily. +f0 3600 + +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/nreverb.csd b/examples/nreverb.csd new file mode 100644 index 0000000..86779da --- /dev/null +++ b/examples/nreverb.csd @@ -0,0 +1,39 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o nreverb.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 1 + a1 oscil 10000, 440, 1 + a2 nreverb a1, 2.5, .3 + out a1 + a2 * .2 +endin + + +</CsInstruments> +<CsScore> + +; Table 1: an ordinary sine wave. +f 1 0 32768 10 1 + +i 1 0.0 0.5 +i 1 1.0 0.5 +i 1 2.0 0.5 +i 1 3.0 0.5 +i 1 4.0 0.5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/nreverb_ftable.csd b/examples/nreverb_ftable.csd new file mode 100644 index 0000000..eda060a --- /dev/null +++ b/examples/nreverb_ftable.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o nreverb_ftable.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 1 + a1 soundin "beats.wav" + a2 nreverb a1, 1.5, .75, 0, 8, 71, 4, 72 + out a1 + a2 * .4 +endin + + +</CsInstruments> +<CsScore> + +; freeverb time constants, as direct (negative) sample, with arbitrary gains +f71 0 16 -2 -1116 -1188 -1277 -1356 -1422 -1491 -1557 -1617 0.8 0.79 0.78 0.77 0.76 0.75 0.74 0.73 + +f72 0 16 -2 -556 -441 -341 -225 0.7 0.72 0.74 0.76 + +i1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/nsamp.csd b/examples/nsamp.csd new file mode 100644 index 0000000..17a616d --- /dev/null +++ b/examples/nsamp.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o nsamp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the size (in samples) of Table #1. + isz = nsamp(1) + print isz +endin + + +</CsInstruments> +<CsScore> + +; Table #1: Use an audio file. +f 1 0 262144 1 "mary.wav" 0 0 0 + +; Play Instrument #1 for 1 second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/octave.csd b/examples/octave.csd new file mode 100644 index 0000000..c679377 --- /dev/null +++ b/examples/octave.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o octave.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; The root note is A above middle-C (440 Hz) + iroot = 440 + + ; Raise the root note by two octaves. + ioctaves = 2 + + ; Calculate the new note. + ifactor = octave(ioctaves) + inew = iroot * ifactor + + ; Print out of all of the values. + print iroot + print ifactor + print inew +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/octcps.csd b/examples/octcps.csd new file mode 100644 index 0000000..3417f04 --- /dev/null +++ b/examples/octcps.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o octcps.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Convert a cycles-per-second value into an + ; octave value. + icps = 440 + ioct = octcps(icps) + + print ioct +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/octmidi.csd b/examples/octmidi.csd new file mode 100644 index 0000000..efe18df --- /dev/null +++ b/examples/octmidi.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o octmidi.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; This example expects MIDI note inputs on channel 1 + i1 octmidi + + print i1 +endin + + +</CsInstruments> +<CsScore> + +;Dummy f-table to give time for real-time MIDI events +f 0 8000 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/octmidib.csd b/examples/octmidib.csd new file mode 100644 index 0000000..14347d7 --- /dev/null +++ b/examples/octmidib.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o octmidib.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; This example expects MIDI note inputs on channel 1 + i1 octmidib + + print i1 +endin + + +</CsInstruments> +<CsScore> + +;Dummy f-table to give time for real-time MIDI events +f 0 8000 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/octpch.csd b/examples/octpch.csd new file mode 100644 index 0000000..2aa0b48 --- /dev/null +++ b/examples/octpch.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o octpch.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Convert a pitch-class value into an + ; octave-point-decimal value. + ipch = 8.09 + ioct = octpch(ipch) + + print ioct +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ooo.aiff b/examples/ooo.aiff Binary files differnew file mode 100644 index 0000000..65cc898 --- /dev/null +++ b/examples/ooo.aiff diff --git a/examples/opa.csd b/examples/opa.csd new file mode 100644 index 0000000..bf0ab82 --- /dev/null +++ b/examples/opa.csd @@ -0,0 +1,42 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o a.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create a sine wave at k-rate. + kwave oscil 20000, 440, 1 + + ; Convert the k-rate sine wave to the audio-rate. + awave = a(kwave) + + ; Output the audio-rate version of sine wave. + out awave +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/opcode1.xml b/examples/opcode1.xml new file mode 100644 index 0000000..aba77c7 --- /dev/null +++ b/examples/opcode1.xml @@ -0,0 +1,65 @@ + +<refentry id="opcode1"> + <refmeta> + <refentrytitle>opcode1</refentrytitle> + </refmeta> + + <refnamediv> + <refname>opcode1</refname> + <refpurpose> + This is an example DocBook XML file for an opcode. + <indexterm id="IndexOpcode1"><primary>opcode1</primary></indexterm> + </refpurpose> + </refnamediv> + + <refsect1> + <title>Description</title> + <para> + This is an example DocBook XML file for an opcode. + </para> + </refsect1> + + <refsect1> + <title>Syntax</title> + <synopsis>ar <command>opcode1</command> insnum</synopsis> + </refsect1> + + <refsect1> + <title>Initialization</title> + <para> + <emphasis>insnum</emphasis> -- instrument number. Equivalent to p1 in a score <emphasis>i statement</emphasis>. + </para> + </refsect1> + + <refsect1> + <title>Performance</title> + <para> + They go beep. + </para> + </refsect1> + + <refsect1> + <title>Examples</title> + <para> + Here is an example of the opcode1 opcode. It uses the files <ulink url="examples/opcode1.orc"><citetitle>opcode1.orc</citetitle></ulink> and <ulink url="examples/opcode1.sco"><citetitle>opcode1.sco</citetitle></ulink>. + + <example> + <title>Example of the opcode1 opcode.</title> + + <programlisting> +<xi:include href="examples/opcode1.orc" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"/> + </programlisting> + + <programlisting> +<xi:include href="examples/opcode1.sco" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"/> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1> + <title>Credits</title> + <para>Author: Opcode Author</para> + <para>New in version 5.00</para> + </refsect1> +</refentry> diff --git a/examples/opcode_example.csd b/examples/opcode_example.csd new file mode 100644 index 0000000..9d304f5 --- /dev/null +++ b/examples/opcode_example.csd @@ -0,0 +1,83 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o opcode_example.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 50 +nchnls = 1 + +/* example opcode 1: simple oscillator */ + + opcode Oscillator, a, kk + +kamp, kcps xin ; read input parameters +a1 vco2 kamp, kcps ; sawtooth oscillator + xout a1 ; write output + + endop + +/* example opcode 2: lowpass filter with local ksmps */ + + opcode Lowpass, a, akk + + setksmps 1 ; need sr=kr +ain, ka1, ka2 xin ; read input parameters +aout init 0 ; initialize output +aout = ain*ka1 + aout*ka2 ; simple tone-like filter + xout aout ; write output + + endop + +/* example opcode 3: recursive call */ + + opcode RecursiveLowpass, a, akkpp + +ain, ka1, ka2, idep, icnt xin ; read input parameters + if (icnt >= idep) goto skip1 ; check if max depth reached +ain RecursiveLowpass ain, ka1, ka2, idep, icnt + 1 +skip1: +aout Lowpass ain, ka1, ka2 ; call filter + xout aout ; write output + + endop + +/* example opcode 4: de-click envelope */ + + opcode DeClick, a, a + +ain xin +aenv linseg 0, 0.02, 1, p3 - 0.05, 1, 0.02, 0, 0.01, 0 + xout ain * aenv ; apply envelope and write output + + endop + +/* instr 1 uses the example opcodes */ + + instr 1 + +kamp = 20000 ; amplitude +kcps expon 50, p3, 500 ; pitch +a1 Oscillator kamp, kcps ; call oscillator +kflt linseg 0.4, 1.5, 0.4, 1, 0.8, 1.5, 0.8 ; filter envelope +a1 RecursiveLowpass a1, kflt, 1 - kflt, 10 ; 10th order lowpass +a1 DeClick a1 + out a1 + + endin + + +</CsInstruments> +<CsScore> + +i 1 0 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/oscbnk.csd b/examples/oscbnk.csd new file mode 100644 index 0000000..d0166a6 --- /dev/null +++ b/examples/oscbnk.csd @@ -0,0 +1,158 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o oscbnk.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Istvan Varga */ +sr = 48000 +kr = 750 +ksmps = 64 +nchnls = 2 + +ga01 init 0 +ga02 init 0 + +/* sawtooth wave */ +i_ ftgen 1, 0, 16384, 7, 1, 16384, -1 +/* FM waveform */ +i_ ftgen 3, 0, 4096, 7, 0, 512, 0.25, 512, 1, 512, 0.25, 512, \ + 0, 512, -0.25, 512, -1, 512, -0.25, 512, 0 +/* AM waveform */ +i_ ftgen 4, 0, 4096, 5, 1, 4096, 0.01 +/* FM to EQ */ +i_ ftgen 5, 0, 1024, 5, 1, 512, 32, 512, 1 +/* sine wave */ +i_ ftgen 6, 0, 1024, 10, 1 +/* room parameters */ +i_ ftgen 7, 0, 64, -2, 4, 50, -1, -1, -1, 11, \ + 1, 26.833, 0.05, 0.85, 10000, 0.8, 0.5, 2, \ + 1, 1.753, 0.05, 0.85, 5000, 0.8, 0.5, 2, \ + 1, 39.451, 0.05, 0.85, 7000, 0.8, 0.5, 2, \ + 1, 33.503, 0.05, 0.85, 7000, 0.8, 0.5, 2, \ + 1, 36.151, 0.05, 0.85, 7000, 0.8, 0.5, 2, \ + 1, 29.633, 0.05, 0.85, 7000, 0.8, 0.5, 2 + +/* generate bandlimited sawtooth waves */ + +i0 = 0 +loop1: +imaxh = sr / (2 * 440.0 * exp (log(2.0) * (i0 - 69) / 12)) +i_ ftgen i0 + 256, 0, 4096, -30, 1, 1, imaxh +i0 = i0 + 1 + if (i0 < 127.5) igoto loop1 + + instr 1 + +p3 = p3 + 0.4 + +; note frequency +kcps = 440.0 * exp (log(2.0) * (p4 - 69) / 12) +; lowpass max. frequency +klpmaxf limit 64 * kcps, 1000.0, 12000.0 +; FM depth in Hz +kfmd1 = 0.02 * kcps +; AM frequency +kamfr = kcps * 0.02 +kamfr2 = kcps * 0.1 +; table number +kfnum = (256 + 69 + 0.5 + 12 * log(kcps / 440.0) / log(2.0)) +; amp. envelope +aenv linseg 0, 0.1, 1.0, p3 - 0.5, 1.0, 0.1, 0.5, 0.2, 0, 1.0, 0 + +/* oscillator / left */ + +a1 oscbnk kcps, 0.0, kfmd1, 0.0, 40, 200, 0.1, 0.2, 0, 0, 144, \ + 0.0, klpmaxf, 0.0, 0.0, 1.5, 1.5, 2, \ + kfnum, 3, 0, 5, 5, 5 +a2 oscbnk kcps, 1.0, kfmd1, 0.0, 40, 201, 0.1, 0.2, kamfr, kamfr2, 148, \ + 0, 0, 0, 0, 0, 0, -1, \ + kfnum, 3, 4 +a2 pareq a2, kcps * 8, 0.0, 0.7071, 2 +a0 = a1 + a2 * 0.12 +/* delay */ +adel = 0.001 +a01 vdelayx a0, adel, 0.01, 16 +a_ oscili 1.0, 0.25, 6, 0.0 +adel = adel + 1.0 / (exp(log(2.0) * a_) * 8000) +a02 vdelayx a0, adel, 0.01, 16 +a0 = a01 + a02 + +ga01 = ga01 + a0 * aenv * 2500 + +/* oscillator / right */ + +; lowpass max. frequency + +a1 oscbnk kcps, 0.0, kfmd1, 0.0, 40, 202, 0.1, 0.2, 0, 0, 144, \ + 0.0, klpmaxf, 0.0, 0.0, 1.0, 1.0, 2, \ + kfnum, 3, 0, 5, 5, 5 +a2 oscbnk kcps, 1.0, kfmd1, 0.0, 40, 203, 0.1, 0.2, kamfr, kamfr2, 148, \ + 0, 0, 0, 0, 0, 0, -1, \ + kfnum, 3, 4 +a2 pareq a2, kcps * 8, 0.0, 0.7071, 2 +a0 = a1 + a2 * 0.12 +/* delay */ +adel = 0.001 +a01 vdelayx a0, adel, 0.01, 16 +a_ oscili 1.0, 0.25, 6, 0.25 +adel = adel + 1.0 / (exp(log(2.0) * a_) * 8000) +a02 vdelayx a0, adel, 0.01, 16 +a0 = a01 + a02 + +ga02 = ga02 + a0 * aenv * 2500 + + + endin + +/* output / left */ + + instr 81 + +i1 = 0.000001 +aLl, aLh, aRl, aRh spat3di ga01 + i1*i1*i1*i1, -8.0, 4.0, 0.0, 0.3, 7, 4 +ga01 = 0 +aLl butterlp aLl, 800.0 +aRl butterlp aRl, 800.0 + + outs aLl + aLh, aRl + aRh + + endin + +/* output / right */ + + instr 82 + +i1 = 0.000001 +aLl, aLh, aRl, aRh spat3di ga02 + i1*i1*i1*i1, 8.0, 4.0, 0.0, 0.3, 7, 4 +ga02 = 0 +aLl butterlp aLl, 800.0 +aRl butterlp aRl, 800.0 + + outs aLl + aLh, aRl + aRh + + endin + + +</CsInstruments> +<CsScore> + +/* Written by Istvan Varga */ +t 0 60 + +i 1 0 4 41 +i 1 0 4 60 +i 1 0 4 65 +i 1 0 4 69 + +i 81 0 5.5 +i 82 0 5.5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/oscil.csd b/examples/oscil.csd new file mode 100644 index 0000000..a8def6c --- /dev/null +++ b/examples/oscil.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o oscil.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a basic oscillator. +instr 1 + kamp = 10000 + kcps = 440 + ifn = 1 + + a1 oscil kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/oscil3.csd b/examples/oscil3.csd new file mode 100644 index 0000000..ccdeba9 --- /dev/null +++ b/examples/oscil3.csd @@ -0,0 +1,55 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o oscil3.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a basic oscillator. +instr 1 + kamp = 10000 + kcps = 220 + ifn = 1 + + a1 oscil kamp, kcps, ifn + out a1 +endin + +; Instrument #2 - the basic oscillator with cubic interpolation. +instr 2 + kamp = 10000 + kcps = 220 + ifn = 1 + + a1 oscil3 kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave table with a small amount of data. +f 1 0 32 10 0 1 + +; Play Instrument #1, the basic oscillator, for +; two seconds. This should sound relatively rough. +i 1 0 2 + +; Play Instrument #2, the cubic interpolated oscillator, for +; two seconds. This should sound relatively smooth. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/oscili.csd b/examples/oscili.csd new file mode 100644 index 0000000..dc0d3f7 --- /dev/null +++ b/examples/oscili.csd @@ -0,0 +1,55 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o oscili.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a basic oscillator. +instr 1 + kamp = 10000 + kcps = 220 + ifn = 1 + + a1 oscil kamp, kcps, ifn + out a1 +endin + +; Instrument #2 - the basic oscillator with extra interpolation. +instr 2 + kamp = 10000 + kcps = 220 + ifn = 1 + + a1 oscili kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave table with a small amount of data. +f 1 0 32 10 0 1 + +; Play Instrument #1, the basic oscillator, for +; two seconds. This should sound relatively rough. +i 1 0 2 + +; Play Instrument #2, the interpolated oscillator, for +; two seconds. This should sound relatively smooth. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/oscilikt.csd b/examples/oscilikt.csd new file mode 100644 index 0000000..2679df2 --- /dev/null +++ b/examples/oscilikt.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o oscilikt.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a uni-polar (0-1) square wave. + kamp1 init 1 + kcps1 init 2 + itype = 3 + ksquare lfo kamp1, kcps1, itype + + ; Use the square wave to switch between Tables #1 and #2. + kamp2 init 20000 + kcps2 init 220 + kfn = ksquare + 1 + + a1 oscilikt kamp2, kcps2, kfn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine waveform. +f 1 0 4096 10 0 1 +; Table #2: a sawtooth wave +f 2 0 3 -2 1 0 -1 + +; Play Instrument #1 for two seconds. +i 1 0 2 + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/osciliktp.csd b/examples/osciliktp.csd new file mode 100644 index 0000000..b56c4af --- /dev/null +++ b/examples/osciliktp.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o osciliktp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1: osciliktp example +instr 1 + kphs line 0, p3, 4 + + a1x osciliktp 220.5, 1, 0 + a1y osciliktp 220.5, 1, -kphs + a1 = a1x - a1y + + out a1 * 14000 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: Sawtooth wave +f 1 0 3 -2 1 0 -1 + +; Play Instrument #1 for four seconds. +i 1 0 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/oscilikts.csd b/examples/oscilikts.csd new file mode 100644 index 0000000..fe49e93 --- /dev/null +++ b/examples/oscilikts.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o oscilikts.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1: oscilikts example. +instr 1 + ; Frequency envelope. + kfrq expon 400, p3, 1200 + ; Phase. + kphs line 0.1, p3, 0.9 + + ; Sync 1 + atmp1 phasor 100 + ; Sync 2 + atmp2 phasor 150 + async diff 1 - (atmp1 + atmp2) + + a1 oscilikts 14000, kfrq, 1, async, 0 + a2 oscilikts 14000, kfrq, 1, async, -kphs + + out a1 - a2 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: Sawtooth wave +f 1 0 3 -2 1 0 -1 + +; Play Instrument #1 for four seconds. +i 1 0 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/oscils.csd b/examples/oscils.csd new file mode 100644 index 0000000..a63b484 --- /dev/null +++ b/examples/oscils.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o oscils.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a fast sine oscillator. +instr 1 + iamp = 10000 + icps = 440 + iphs = 0 + + a1 oscils iamp, icps, iphs + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/outkpc.csd b/examples/outkpc.csd new file mode 100644 index 0000000..17bc56f --- /dev/null +++ b/examples/outkpc.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer>
+<CsOptions>
+; Select audio/midi flags here according to platform
+; Audio out Audio in No messages
+-odac -iadc -d -M0 -Q1;;;RT audio I/O with MIDI in
+</CsOptions>
+<CsInstruments>
+
+sr = 44100
+kr = 4410
+ksmps = 10
+nchnls = 2
+
+; Example by Giorgio Zucco 2007
+
+kprogram init 0
+
+instr 1 ;Triggered by MIDI notes on channel 1
+
+ ifund notnum
+ ivel veloc
+ idur = 1
+
+; Sends a MIDI program change message according to
+; the triggering note's velocity
+outkpc 1 ,ivel ,0 ,127
+
+noteondur 1 ,ifund ,ivel ,idur
+
+endin
+
+</CsInstruments>
+<CsScore>
+; Dummy ftable
+f 0 60
+</CsScore>
+</CsoundSynthesizer>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/outkpc_fltk.csd b/examples/outkpc_fltk.csd new file mode 100644 index 0000000..77b1771 --- /dev/null +++ b/examples/outkpc_fltk.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d -M0 -Q1;;;RT audio I/O with MIDI in +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +; Example by Giorgio Zucco 2007 + +FLpanel "outkpc",200,100,90,90;start of container +gkpg, gihandle FLcount "Midi-Program change",0,127,1,5,1,152,40,16,23,-1 +FLpanelEnd + +FLrun + +instr 1 + +ktrig changed gkpg +outkpc ktrig,gkpg,0,127 + +endin + + +</CsInstruments> +<CsScore> +; Run instrument 1 for 60 seconds +i 1 0 60 +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/p.csd b/examples/p.csd new file mode 100644 index 0000000..f8d4870 --- /dev/null +++ b/examples/p.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o p.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Get the value in the fourth p-field, p4. + i1 = p(4) + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; p4 = value to be printed. +; Play Instrument #1 for one second, p4 = 50.375. +i 1 0 1 50.375 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pareq.csd b/examples/pareq.csd new file mode 100644 index 0000000..e70ee2f --- /dev/null +++ b/examples/pareq.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pareq.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +instr 15 + ifc = p4 ; Center / Shelf + kq = p5 ; Quality factor sqrt(.5) is no resonance + kv = ampdb(p6) ; Volume Boost/Cut + imode = p7 ; Mode 0=Peaking EQ, 1=Low Shelf, 2=High Shelf + kfc linseg ifc*2, p3, ifc/2 + asig rand 5000 ; Random number source for testing + aout pareq asig, kfc, kv, kq, imode ; Parmetric equalization + outs aout, aout ; Output the results +endin + + +</CsInstruments> +<CsScore> + +; SCORE: + ; Sta Dur Fcenter Q Boost/Cut(dB) Mode + i15 0 1 10000 .2 12 1 + i15 + . 5000 .2 12 1 + i15 . . 1000 .707 -12 2 + i15 . . 5000 .1 -12 0 + e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/partikkel.csd b/examples/partikkel.csd new file mode 100644 index 0000000..83d255c --- /dev/null +++ b/examples/partikkel.csd @@ -0,0 +1,78 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o partikkel.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> + +sr = 44100 +ksmps = 20 +nchnls = 2 + +giSine ftgen 0, 0, 65537, 10, 1 +giCosine ftgen 0, 0, 8193, 9, 1, 1, 90 + +instr 1 + +kgrainfreq = 200 ; 4 grains per second +kdistribution = 0 ; periodic grain distribution +idisttab = -1 ; (default) flat distribution used for grain distribution +async = 0 ; no sync input +kenv2amt = 0 ; no secondary enveloping +ienv2tab = -1 ; default secondary envelope (flat) +ienv_attack = -1 ; ; default attack envelope (flat) +ienv_decay = -1 ; ; default decay envelope (flat) +ksustain_amount = 0.5 ; time (in fraction of grain dur) at sustain level for each grain +ka_d_ratio = 0.5 ; balance between attack and decay time +kduration = (0.5/kgrainfreq)*1000 ; set grain duration relative to grain rate +kamp = 5000 ; amp +igainmasks = -1 ; (default) no gain masking +kwavfreq = 440 ; fundamental frequency of source waveform +ksweepshape = 0 ; shape of frequency sweep (0=no sweep) +iwavfreqstarttab = -1 ; default frequency sweep start (value in table = 1, which give no frequency modification) +iwavfreqendtab = -1 ; default frequency sweep end (value in table = 1, which give no frequency modification) +awavfm = 0 ; no FM input +ifmamptab = -1 ; default FM scaling (=1) +kfmenv = -1 ; default FM envelope (flat) +icosine = giCosine ; cosine ftable +kTrainCps = kgrainfreq ; set trainlet cps equal to grain rate for single-cycle trainlet in each grain +knumpartials = 3 ; number of partials in trainlet +kchroma = 1 ; balance of partials in trainlet +ichannelmasks = -1 ; (default) no channel masking, all grains to output 1 +krandommask = 0 ; no random grain masking +kwaveform1 = giSine ; source waveforms +kwaveform2 = giSine ; +kwaveform3 = giSine ; +kwaveform4 = giSine ; +iwaveamptab = -1 ; (default) equal mix of all 4 sourcve waveforms and no amp for trainlets +asamplepos1 = 0 ; phase offset for reading source waveform +asamplepos2 = 0 ; +asamplepos3 = 0 ; +asamplepos4 = 0 ; +kwavekey1 = 1 ; original key for source waveform +kwavekey2 = 1 ; +kwavekey3 = 1 ; +kwavekey4 = 1 ; +imax_grains = 100 ; max grains per k period + +a1 partikkel kgrainfreq, kdistribution, idisttab, async, kenv2amt, ienv2tab, \ + ienv_attack, ienv_decay, ksustain_amount, ka_d_ratio, kduration, kamp, igainmasks, \ + kwavfreq, ksweepshape, iwavfreqstarttab, iwavfreqendtab, awavfm, \ + ifmamptab, kfmenv, icosine, kTrainCps, knumpartials, \ + kchroma, ichannelmasks, krandommask, kwaveform1, kwaveform2, kwaveform3, kwaveform4, \ + iwaveamptab, asamplepos1, asamplepos2, asamplepos3, asamplepos4, \ + kwavekey1, kwavekey2, kwavekey3, kwavekey4, imax_grains + +outs a1, a1 +endin + +</CsInstruments> +<CsScore> +i1 0 5 ; partikkel +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/partikkel_softsync.csd b/examples/partikkel_softsync.csd new file mode 100644 index 0000000..89a8d61 --- /dev/null +++ b/examples/partikkel_softsync.csd @@ -0,0 +1,170 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out +-odac ;;;RT audio +; For Non-realtime ouput leave only the line below: +; -o partikkel_softsync.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> + +sr = 44100 +ksmps = 20 +nchnls = 2 + +; Example by Oeyvind Brandtsegg 2007, revised 2008 + +giSine ftgen 0, 0, 65537, 10, 1 +giCosine ftgen 0, 0, 8193, 9, 1, 1, 90 +giSigmoRise ftgen 0, 0, 8193, 19, 0.5, 1, 270, 1 ; rising sigmoid +giSigmoFall ftgen 0, 0, 8193, 19, 0.5, 1, 90, 1 ; falling sigmoid + +; ************************************************* +; example of soft synchronization of two partikkel instances +; ************************************************* + instr 1 + + +/*score parameters*/ +igrainrate = p4 ; grain rate +igrainsize = p5 ; grain size in ms +igrainFreq = p6 ; fundamental frequency of source waveform +iosc2Dev = p7 ; partikkel instance 2 grain rate deviation factor +iMaxSync = p8 ; max soft sync amount (increasing to this value during length of note) + +/*overall envelope*/ +iattack = 0.001 +idecay = 0.2 +isustain = 0.7 +irelease = 0.2 +amp linsegr 0, iattack, 1, idecay, isustain, 1, isustain, irelease, 0 + +kgrainfreq = igrainrate ; grains per second +kdistribution = 0 ; periodic grain distribution +idisttab = -1 ; (default) flat distribution used + ; for grain distribution +async = 0 ; no sync input +kenv2amt = 0 ; no secondary enveloping +ienv2tab = -1 ; default secondary envelope (flat) +ienv_attack = giSigmoRise ; default attack envelope (flat) +ienv_decay = giSigmoFall ; default decay envelope (flat) +ksustain_amount = 0.3 ; time (in fraction of grain dur) at + ; sustain level for each grain +ka_d_ratio = 0.2 ; balance between attack and decay time +kduration = igrainsize ; set grain duration in ms +kamp = 0.2*0dbfs ; amp +igainmasks = -1 ; (default) no gain masking +kwavfreq = igrainFreq ; fundamental frequency of source waveform +ksweepshape = 0 ; shape of frequency sweep (0=no sweep) +iwavfreqstarttab = -1 ; default frequency sweep start + ; (value in table = 1, which give + ; no frequency modification) +iwavfreqendtab = -1 ; default frequency sweep end + ; (value in table = 1, which give + ; no frequency modification) +awavfm = 0 ; no FM input +ifmamptab = -1 ; default FM scaling (=1) +kfmenv = -1 ; default FM envelope (flat) +icosine = giCosine ; cosine ftable +kTrainCps = kgrainfreq ; set trainlet cps equal to grain + ; rate for single-cycle trainlet in + ; each grain +knumpartials = 3 ; number of partials in trainlet +kchroma = 1 ; balance of partials in trainlet +ichannelmasks = -1 ; (default) no channel masking, + ; all grains to output 1 +krandommask = 0 ; no random grain masking +kwaveform1 = giSine ; source waveforms +kwaveform2 = giSine ; +kwaveform3 = giSine ; +kwaveform4 = giSine ; +iwaveamptab = -1 ; mix of 4 source waveforms and + ; trainlets (set to default) +asamplepos1 = 0 ; phase offset for reading source waveform +asamplepos2 = 0 ; +asamplepos3 = 0 ; +asamplepos4 = 0 ; +kwavekey1 = 1 ; original key for source waveform +kwavekey2 = 1 ; +kwavekey3 = 1 ; +kwavekey4 = 1 ; +imax_grains = 100 ; max grains per k period +iopcode_id = 1 ; id of opcode, linking partikkel + ; to partikkelsync + +a1 partikkel kgrainfreq, kdistribution, idisttab, async, kenv2amt, \ + ienv2tab,ienv_attack, ienv_decay, ksustain_amount, ka_d_ratio, \ + kduration, kamp, igainmasks, kwavfreq, ksweepshape, \ + iwavfreqstarttab, iwavfreqendtab, awavfm, ifmamptab, kfmenv, \ + icosine, kTrainCps, knumpartials, kchroma, ichannelmasks, \ + krandommask, kwaveform1, kwaveform2, kwaveform3, kwaveform4, \ + iwaveamptab, asamplepos1, asamplepos2, asamplepos3, asamplepos4, \ + kwavekey1, kwavekey2, kwavekey3, kwavekey4, imax_grains, iopcode_id + +async1 partikkelsync iopcode_id ; clock pulse output of the + ; partikkel instance above +ksyncGravity line 0, p3, iMaxSync ; strength of synchronization +aphase2 init 0 +asyncPolarity limit (int(aphase2*2)*2)-1, -1, 1 +; use the phase of partikkelsync instance 2 to find sync +; polarity for partikkel instance 2. +; If the phase of instance 2 is less than 0.5, we want to +; nudge it down when synchronizing, +; and if the phase is > 0.5 we want to nudge it upwards. +async1 = async1*ksyncGravity*asyncPolarity ; prepare sync signal + ; with polarity and strength + +kgrainfreq2 = igrainrate * iosc2Dev ; grains per second for second partikkel instance +iopcode_id2 = 2 +a2 partikkel kgrainfreq2, kdistribution, idisttab, async1, kenv2amt, \ + ienv2tab, ienv_attack, ienv_decay, ksustain_amount, ka_d_ratio, \ + kduration, kamp, igainmasks, kwavfreq, ksweepshape, \ + iwavfreqstarttab, iwavfreqendtab, awavfm, ifmamptab, kfmenv, \ + icosine, kTrainCps, knumpartials, kchroma, ichannelmasks, \ + krandommask, kwaveform1, kwaveform2, kwaveform3, kwaveform4, \ + iwaveamptab, asamplepos1, asamplepos2, asamplepos3, \ + asamplepos4, kwavekey1, kwavekey2, kwavekey3, kwavekey4, \ + imax_grains, iopcode_id2 + +async2, aphase2 partikkelsync iopcode_id2 +; clock pulse and phase +; output of the partikkel instance above, +; we will only use the phase + +outs a1*amp, a2*amp + +endin + +</CsInstruments> +<CsScore> + +/*score parameters +igrainrate = p4 ; grain rate +igrainsize = p5 ; grain size in ms +igrainFreq = p6 ; frequency of source wave within grain +iosc2Dev = p7 ; partikkel instance 2 grain rate deviation factor +iMaxSync = p8 ; max soft sync amount (increasing to this value during length of note) +*/ +; GrRate GrSize GrFund Osc2Dev MaxSync + +i1 0 10 2 20 880 1.3 0.3 +s +i1 0 10 5 20 440 0.8 0.3 +s +i1 0 6 55 15 660 1.8 0.45 +s +i1 0 6 110 10 440 0.6 0.6 +s +i1 0 6 220 3 660 2.6 0.45 +s +i1 0 6 220 3 660 2.1 0.45 +s +i1 0 6 440 3 660 0.8 0.22 +s + +e + +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/pcauchy.csd b/examples/pcauchy.csd new file mode 100644 index 0000000..6b9d38e --- /dev/null +++ b/examples/pcauchy.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pcauchy.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number between 0 and 1. + ; kalpha = 1 + + i1 pcauchy 1 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pchbend.csd b/examples/pchbend.csd new file mode 100644 index 0000000..fa87b87 --- /dev/null +++ b/examples/pchbend.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o pchbend.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 pchbend + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 12 seconds. +i 1 0 12 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pchmidi.csd b/examples/pchmidi.csd new file mode 100644 index 0000000..65c0fbb --- /dev/null +++ b/examples/pchmidi.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o pchmidi.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; This example expects MIDI note inputs on channel 1 + i1 pchmidi + + print i1 +endin + + +</CsInstruments> +<CsScore> + +;Dummy f-table to give time for real-time MIDI events +f 0 8000 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pchmidib.csd b/examples/pchmidib.csd new file mode 100644 index 0000000..b02e0d4 --- /dev/null +++ b/examples/pchmidib.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o pchmidib.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; This example expects MIDI note inputs on channel 1 + i1 pchmidib + + print i1 +endin + + +</CsInstruments> +<CsScore> + +;Dummy f-table to give time for real-time MIDI events +f 0 8000 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pchoct.csd b/examples/pchoct.csd new file mode 100644 index 0000000..a3353d2 --- /dev/null +++ b/examples/pchoct.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pchoct.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Convert an octave-point-decimal value into a + ; pitch-class value. + ioct = 8.75 + ipch = pchoct(ioct) + + print ipch +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pcount.csd b/examples/pcount.csd new file mode 100644 index 0000000..00fca14 --- /dev/null +++ b/examples/pcount.csd @@ -0,0 +1,23 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc ; -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +;-o pcount.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +;Example by Anthony Kozar Dec 2006 +instr 1 + inum pcount + print inum +endin + +</CsInstruments> +<CsScore> +i1 0 3 4 5 ; has 5 pfields +i1 1 3 ; has 5 due to carry +i1 2 3 4 5 6 7 ; has 7 +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/pdclip.csd b/examples/pdclip.csd new file mode 100644 index 0000000..2dcfdde --- /dev/null +++ b/examples/pdclip.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o abs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; test instrument for pdclip opcode +instr 3 + + idur = p3 + iamp = p4 + ifreq = p5 + ifn = p6 + + kenv linseg 0, .05, 1.0, idur - .1, 1.0, .05, 0 + aosc oscil 1.0, ifreq, ifn + + kmod expseg 0.00001, idur, 1.0 + aout pdclip aosc, kmod, 0.0, 1.0 + + out kenv*aout*iamp +endin + +</CsInstruments> +<CsScore> +f1 0 16385 10 1 +f2 0 16385 10 1 .5 .3333 .25 .5 + +; pdclipped sine wave +i3 0 3 15000 440 1 +i3 + 3 15000 330 1 +i3 + 3 15000 220 1 +s + +; pdclipped composite wave +i3 0 3 15000 440 2 +i3 + 3 15000 330 2 +i3 + 3 15000 220 2 +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pdhalf.csd b/examples/pdhalf.csd new file mode 100644 index 0000000..d2e1389 --- /dev/null +++ b/examples/pdhalf.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o abs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +; test instrument for pdhalf opcode +instr 4 + + idur = p3 + iamp = p4 + ifreq = p5 + itable = p6 + + aenv linseg 0, .001, 1.0, idur - .051, 1.0, .05, 0 + aosc phasor ifreq + kamount linseg 0.0, 0.02, -0.99, 0.05, -0.9, idur-0.06, 0.0 + apd pdhalf aosc, kamount + aout tablei apd, itable, 1 + + out aenv*aout*iamp +endin + +</CsInstruments> +<CsScore> +f1 0 16385 10 1 +f2 0 16385 10 1 .5 .3333 .25 .5 +f3 0 16385 9 1 1 270 ; inverted cosine + +; descending "just blues" scale + +; pdhalf with cosine table +; (imitates the CZ-101 "sawtooth waveform") +t 0 100 +i4 0 .333 10000 512 3 +i. + . . 448 +i. + . . 384 +i. + . . 358.4 +i. + . . 341.33 +i. + . . 298.67 +i. + 2 . 256 +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pdhalfy.csd b/examples/pdhalfy.csd new file mode 100644 index 0000000..f7d8d5b --- /dev/null +++ b/examples/pdhalfy.csd @@ -0,0 +1,64 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o abs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +; test instrument for pdhalfy opcode +instr 5 + + idur = p3 + iamp = p4 + ifreq = p5 + iamtinit = p6 ; initial amount of phase distortion + iatt = p7 ; attack time + isuslvl = p8 ; sustain amplitude + idistdec = p9 ; time for distortion amount to reach zero + itable = p10 + + idec = idistdec - iatt + irel = .05 + isus = idur - (idistdec + irel) + + aenv linseg 0, iatt, 1.0, idec, isuslvl, isus, isuslvl, irel, 0, 0, 0 + kamount linseg -iamtinit, idistdec, 0.0, idur-idistdec, 0.0 + aosc phasor ifreq + apd pdhalfy aosc, kamount + aout tablei apd, itable, 1 + + out aenv*aout*iamp +endin + +</CsInstruments> +<CsScore> +f1 0 16385 10 1 ; sine +f3 0 16385 9 1 1 270 ; inverted cosine + +; descending "just blues" scale + +; pdhalfy with cosine table +t 0 100 +i5 0 .333 10000 512 1.0 .02 0.5 .12 3 +i. + . . 448 < +i. + . . 384 < +i. + . . 358.4 < +i. + . . 341.33 < +i. + . . 298.67 < +i. + 2 . 256 0.5 +s + +; pdhalfy with sine table +t 0 100 +i5 0 .333 10000 512 1.0 .001 0.1 .07 1 +i. + . . 448 < +i. + . . 384 < +i. + . . 358.4 < +i. + . . 341.33 < +i. + . . 298.67 < +i. + 2 . 256 0.5 +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/peak.csd b/examples/peak.csd new file mode 100644 index 0000000..45c42dc --- /dev/null +++ b/examples/peak.csd @@ -0,0 +1,39 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o peak.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1 - play an audio file. +instr 1 + ; Capture the highest amplitude in the "beats.wav" file. + asig soundin "beats.wav" + kp peak asig + + ; Print out the peak value once per second. + printk 1, kp + + out asig +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1, the audio file, for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pgmassign.csd b/examples/pgmassign.csd new file mode 100644 index 0000000..a5f4346 --- /dev/null +++ b/examples/pgmassign.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o pgmassign.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Program 55 (synth vox) uses Instrument #10. +pgmassign 55, 10 + +; Instrument #10. +instr 10 + ; Just an example, no working code in here! +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #10 for one second. +i 10 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pgmassign_advanced.csd b/examples/pgmassign_advanced.csd new file mode 100644 index 0000000..5eb4460 --- /dev/null +++ b/examples/pgmassign_advanced.csd @@ -0,0 +1,72 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o pgmassign_advanced.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 10 +nchnls = 1 + + massign 1, 1 ; channels 1 to 4 use instr 1 by default + massign 2, 1 + massign 3, 1 + massign 4, 1 + +; pgmassign.mid has 4 notes with these parameters: +; +; Start time Channel Program +; +; note 1 0.5 1 10 +; note 2 1.5 2 11 +; note 3 2.5 3 12 +; note 4 3.5 4 13 + + pgmassign 0, 0 ; disable program changes + pgmassign 11, 3 ; program 11 uses instr 3 + pgmassign 12, 2 ; program 12 uses instr 2 + +; waveforms for instruments +itmp ftgen 1, 0, 1024, 10, 1 +itmp ftgen 2, 0, 1024, 10, 1, 0.5, 0.3333, 0.25, 0.2, 0.1667, 0.1429, 0.125 +itmp ftgen 3, 0, 1024, 10, 1, 0, 0.3333, 0, 0.2, 0, 0.1429, 0, 0.10101 + + instr 1 /* sine */ + +kcps cpsmidib 2 ; note frequency +asnd oscili 30000, kcps, 1 + out asnd + + endin + + instr 2 /* band-limited sawtooth */ + +kcps cpsmidib 2 ; note frequency +asnd oscili 30000, kcps, 2 + out asnd + + endin + + instr 3 /* band-limited square */ + +kcps cpsmidib 2 ; note frequency +asnd oscili 30000, kcps, 3 + out asnd + + endin + + +</CsInstruments> +<CsScore> + +t 0 120 +f 0 8.5 2 -2 0 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pgmassign_advanced.mid b/examples/pgmassign_advanced.mid Binary files differnew file mode 100644 index 0000000..54f38d8 --- /dev/null +++ b/examples/pgmassign_advanced.mid diff --git a/examples/pgmassign_ignore.csd b/examples/pgmassign_ignore.csd new file mode 100644 index 0000000..f852e24 --- /dev/null +++ b/examples/pgmassign_ignore.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o pgmassign_ignore.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Ignore all program change events. +pgmassign 0, -1 + +; Instrument #1. +instr 1 + ; Just an example, no working code in here! +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/phaser1.csd b/examples/phaser1.csd new file mode 100644 index 0000000..3798d4a --- /dev/null +++ b/examples/phaser1.csd @@ -0,0 +1,60 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o phaser1.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; demonstration of phase shifting abilities of phaser1. +instr 1 + ; Input mixed with output of phaser1 to generate notches. + ; Shows the effects of different iorder values on the sound + idur = p3 + iamp = p4 * .05 + iorder = p5 ; number of 1st-order stages in phaser1 network. + ; Divide iorder by 2 to get the number of notches. + ifreq = p6 ; frequency of modulation of phaser1 + ifeed = p7 ; amount of feedback for phaser1 + + kamp linseg 0, .2, iamp, idur - .2, iamp, .2, 0 + + iharms = (sr*.4) / 100 + + asig gbuzz 1, 100, iharms, 1, .95, 2 ; "Sawtooth" waveform modulation oscillator for phaser1 ugen. + kfreq oscili 5500, ifreq, 1 + kmod = kfreq + 5600 + + aphs phaser1 asig, kmod, iorder, ifeed + + out (asig + aphs) * iamp +endin + + +</CsInstruments> +<CsScore> + +; inverted half-sine, used for modulating phaser1 frequency +f1 0 16384 9 .5 -1 0 +; cosine wave for gbuzz +f2 0 8192 9 1 1 .25 + +; phaser1 +i1 0 5 7000 4 .2 .9 +i1 6 5 7000 6 .2 .9 +i1 12 5 7000 8 .2 .9 +i1 18 5 7000 16 .2 .9 +i1 24 5 7000 32 .2 .9 +i1 30 5 7000 64 .2 .9 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/phaser2.csd b/examples/phaser2.csd new file mode 100644 index 0000000..193e964 --- /dev/null +++ b/examples/phaser2.csd @@ -0,0 +1,55 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o phaser2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 2 ; demonstration of phase shifting abilities of phaser2. + ; Input mixed with output of phaser2 to generate notches. + ; Demonstrates the interaction of imode and ksep. + idur = p3 + iamp = p4 * .04 + iorder = p5 ; number of 2nd-order stages in phaser2 network + ifreq = p6 ; not used + ifeed = p7 ; amount of feedback for phaser2 + imode = p8 ; mode for frequency scaling + isep = p9 ; used with imode to determine notch frequencies + kamp linseg 0, .2, iamp, idur - .2, iamp, .2, 0 + iharms = (sr*.4) / 100 + + ; "Sawtooth" waveform exponentially decaying function, to control notch frequencies + asig gbuzz 1, 100, iharms, 1, .95, 2 + kline expseg 1, idur, .005 + aphs phaser2 asig, kline * 2000, .5, iorder, imode, isep, ifeed + + out (asig + aphs) * iamp +endin + + +</CsInstruments> +<CsScore> + +; cosine wave for gbuzz +f2 0 8192 9 1 1 .25 + +; phaser2, imode=1 +i2 00 10 7000 8 .2 .9 1 .33 +i2 11 10 7000 8 .2 .9 1 2 + +; phaser2, imode=2 +i2 22 10 7000 8 .2 .9 2 .33 +i2 33 10 7000 8 .2 .9 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/phasor.csd b/examples/phasor.csd new file mode 100644 index 0000000..ef05ff4 --- /dev/null +++ b/examples/phasor.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o phasor.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create an index that repeats once per second. + kcps init 1 + kndx phasor kcps + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kfreq table kndx, ifn, ixmode + + ; Generate a sine waveform, use our table values + ; to vary its frequency. + a1 oscil 20000, kfreq, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a line from 200 to 2,000. +f 1 0 1025 -7 200 1024 2000 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/phasorbnk.csd b/examples/phasorbnk.csd new file mode 100644 index 0000000..580b3f9 --- /dev/null +++ b/examples/phasorbnk.csd @@ -0,0 +1,60 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o phasorbnk.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Generate a sinewave table. +giwave ftgen 1, 0, 1024, 10, 1 + +; Instrument #1 +instr 1 + ; Generate 10 voices. + icnt = 10 + ; Empty the output buffer. + asum = 0 + ; Reset the loop index. + kindex = 0 + +; This loop is executed every k-cycle. +loop: + ; Generate non-harmonic partials. + kcps = (kindex+1)*100+30 + ; Get the phase for each voice. + aphas phasorbnk kcps, kindex, icnt + ; Read the wave from the table. + asig table aphas, giwave, 1 + ; Accumulate the audio output. + asum = asum + asig + + ; Increment the index. + kindex = kindex + 1 + + ; Perform the loop until the index (kindex) reaches + ; the counter value (icnt). + if (kindex < icnt) kgoto loop + + out asum*3000 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pindex.csd b/examples/pindex.csd new file mode 100644 index 0000000..648b2f0 --- /dev/null +++ b/examples/pindex.csd @@ -0,0 +1,30 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc ; -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +;-o pindex.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +;Example by Anthony Kozar Dec 2006 + +instr 1 + inum pcount + index init 1 + loop1: + ivalue pindex index + printf_i "p%d = %f\n", 1, index, ivalue + index = index + 1 + if (index <= inum) igoto loop1 + print inum +endin + +</CsInstruments> +<CsScore> +i1 0 3 40 50 ; has 5 pfields +i1 1 2 80 ; has 5 due to carry +i1 2 1 40 50 60 70 ; has 7 +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/pinkish.csd b/examples/pinkish.csd new file mode 100644 index 0000000..9843ac0 --- /dev/null +++ b/examples/pinkish.csd @@ -0,0 +1,39 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pinkish.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + awhite unirand 2.0 + + ; Normalize to +/-1.0 + awhite = awhite - 1.0 + + apink pinkish awhite, 1, 0, 0, 1 + + out apink * 30000 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pitch.csd b/examples/pitch.csd new file mode 100644 index 0000000..3f4a51b --- /dev/null +++ b/examples/pitch.csd @@ -0,0 +1,61 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pitch.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1 - play an audio file without effects. +instr 1 + asig soundin "mary.wav" + out asig +endin + +; Instrument #2 - track the pitch of an audio file. +instr 2 + iupdte = 0.01 + ilo = 7 + ihi = 9 + idbthresh = 10 + ifrqs = 12 + iconf = 10 + istrt = 8 + + asig soundin "mary.wav" + + ; Follow the audio file, get its pitch and amplitude. + koct, kamp pitch asig, iupdte, ilo, ihi, idbthresh, ifrqs, iconf, istrt + + ; Re-synthesize the audio file with a different sounding waveform. + kamp2 = kamp * 10 + kcps = cpsoct(koct) + a1 oscil kamp2, kcps, 1 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: A different sounding waveform. +f 1 0 32768 11 7 3 .7 + +; Play Instrument #1, the audio file, for three seconds. +i 1 0 3 +; Play Instrument #2, the "re-synthesized" waveform, for three seconds. +i 2 3 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pitchamdf.csd b/examples/pitchamdf.csd new file mode 100644 index 0000000..f4e0810 --- /dev/null +++ b/examples/pitchamdf.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pitchamdf.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; synth waveform +giwave ftgen 2, 0, 1024, 10, 1, 1, 1, 1 + +; Instrument #1 - play an audio file with no effects. +instr 1 + ; get input signal with original freq. + asig soundin "mary.wav" + + out asig +endin + +; Instrument #2 - play the synth waveform using the +; same pitch and amplitude as the audio file. +instr 2 + ; get input signal with original freq. + asig soundin "mary.wav" + + ; lowpass-filter + asig tone asig, 1000 + ; extract pitch and envelope + kcps, krms pitchamdf asig, 150, 500, 200 + ; "re-synthesize" with the synth waveform, giwave. + asig1 oscil krms, kcps, giwave + + out asig1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1, the audio file, for three seconds. +i 1 0 3 +; Play Instrument #2, the "re-synthesized" waveform, for three seconds. +i 2 3 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/planet.csd b/examples/planet.csd new file mode 100644 index 0000000..50ccfa2 --- /dev/null +++ b/examples/planet.csd @@ -0,0 +1,72 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o planet.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 2 + +; Instrument #1 - a planet oribiting in 3D space. +instr 1 + ; Create a basic tone. + kamp init 5000 + kcps init 440 + ifn = 1 + asnd oscil kamp, kcps, ifn + + ; Figure out its X, Y, Z coordinates. + km1 init 0.5 + km2 init 0.35 + ksep init 2.2 + ix = 0 + iy = 0.1 + iz = 0 + ivx = 0.5 + ivy = 0 + ivz = 0 + ih = 0.0003 + ifric = -0.1 + ax1, ay1, az1 planet km1, km2, ksep, ix, iy, iz, \ + ivx, ivy, ivz, ih, ifric + + ; Place the basic tone within 3D space. + kx downsamp ax1 + ky downsamp ay1 + kz downsamp az1 + idist = 1 + ift = 0 + imode = 1 + imdel = 1.018853416 + iovr = 2 + aw2, ax2, ay2, az2 spat3d asnd, kx, ky, kz, idist, \ + ift, imode, imdel, iovr + + ; Convert the 3D sound to stereo. + aleft = aw2 + ay2 + aright = aw2 - ay2 + + outs aleft, aright +endin + + +</CsInstruments> +<CsScore> + +; Table #1 a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 10 seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pluck.csd b/examples/pluck.csd new file mode 100644 index 0000000..d02ce21 --- /dev/null +++ b/examples/pluck.csd @@ -0,0 +1,39 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pluck.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 20000 + kcps = 440 + icps = 440 + ifn = 0 + imeth = 1 + + a1 pluck kamp, kcps, icps, ifn, imeth + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/poisson.csd b/examples/poisson.csd new file mode 100644 index 0000000..6100d58 --- /dev/null +++ b/examples/poisson.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o poisson.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +ksmps = 441 ;ksmps set deliberately high to have few k-periods per second +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generates a random number in a poisson distribution. + ; klambda = 1 + + i1 poisson 1 + + print i1 +endin + +instr 2 + +kres poisson p4 +printk (ksmps/sr),kres ;prints every k-period +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +i 2 1 0.2 0.5 +i 2 2 0.2 4 ;average 4 events per k-period +i 2 3 0.2 20 ;average 20 events per k-period +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/polyaft.csd b/examples/polyaft.csd new file mode 100644 index 0000000..a7db4c4 --- /dev/null +++ b/examples/polyaft.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o polyaft.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 10 +nchnls = 1 + + massign 1, 1 +itmp ftgen 1, 0, 1024, 10, 1 ; sine wave + + instr 1 + +kcps cpsmidib 2 ; note frequency +inote notnum ; note number +kaft polyaft inote, 0, 127 ; aftertouch +; interpolate aftertouch to eliminate clicks +ktmp phasor 40 +ktmp trigger 1 - ktmp, 0.5, 0 +kaft tlineto kaft, 0.025, ktmp +; map to sine curve for crossfade +kaft = sin(kaft * 3.14159 / 254) * 22000 + +asnd oscili kaft, kcps, 1 + + out asnd + + endin + + +</CsInstruments> +<CsScore> + +t 0 120 +f 0 9 2 -2 0 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/polyaft.mid b/examples/polyaft.mid Binary files differnew file mode 100644 index 0000000..85c3d48 --- /dev/null +++ b/examples/polyaft.mid diff --git a/examples/polynomial.csd b/examples/polynomial.csd new file mode 100644 index 0000000..9ce13f3 --- /dev/null +++ b/examples/polynomial.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> + ; no sound output + -n +</CsOptions> +<CsInstruments> + +sr = 10 ; audio rate is not important +kr = 10 ; execute the statements in instr 1 ten times per second + +instr 1 + ; ax will vary from 1 to 10 + ax init 1 + + ; ay = ax^3 + 2ax^2 + 3ax + 4 + ay polynomial ax, 4, 3, 2, 1 + + ; convert our a-rate signals to k-rate values so that we can print + ky downsamp ay + kx downsamp ax + printf "%d: %d\n", kx, kx, ky + + ax = ax + 1 +endin + +</CsInstruments> +<CsScore> + +i1 0 1 +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/portk.csd b/examples/portk.csd new file mode 100644 index 0000000..60a8e09 --- /dev/null +++ b/examples/portk.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac ; -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o portk.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 128 +nchnls = 1 + +;Example by Andres Cabrera 2007 + +FLpanel "Slider", 650, 140, 50, 50 + gkval1, gislider1 FLslider "Watch me", 0, 127, 0, 5, -1, 580, 30, 25, 20 + gkval2, gislider2 FLslider "Move me", 0, 127, 0, 5, -1, 580, 30, 25, 80 + gkhtim, gislider3 FLslider "khtim", 0.1, 1, 0, 6, -1, 30, 100, 610, 10 +FLpanelEnd +FLrun + +FLsetVal_i 0.1, gislider3 ;set initial time to 0.1 + +instr 1 +kval portk gkval2, gkhtim ; take the value of slider 2 and apply portamento +FLsetVal 1, kval, gislider1 ;set the value of slider 1 to kval +endin + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one minute. +i 1 0 60 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/poscil.csd b/examples/poscil.csd new file mode 100644 index 0000000..2dd626b --- /dev/null +++ b/examples/poscil.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o poscil.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a basic oscillator. +instr 1 + kamp = 10000 + kcps = 440 + ifn = 1 + + a1 poscil kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/poscil3.csd b/examples/poscil3.csd new file mode 100644 index 0000000..76fe527 --- /dev/null +++ b/examples/poscil3.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o poscil3.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a basic oscillator. +instr 1 + kamp = 10000 + kcps = 440 + ifn = 1 + + a1 poscil3 kamp, kcps, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pow.csd b/examples/pow.csd new file mode 100644 index 0000000..2a103f7 --- /dev/null +++ b/examples/pow.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pow.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; This could also be expressed as: i1 = 2 ^ 12 + i1 pow 2, 12 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/powershape.csd b/examples/powershape.csd new file mode 100644 index 0000000..f431a30 --- /dev/null +++ b/examples/powershape.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o abs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +instr 1 + imaxamp = 10000 + kshapeamt line p5, p3, p6 + aosc oscili 1.0, cpspch(p4), 1 + aout powershape aosc, kshapeamt + adeclick linseg 0.0, 0.01, 1.0, p3 - 0.06, 1.0, 0.05, 0.0 + + out aout * adeclick * imaxamp +endin + +</CsInstruments> +<CsScore> +f1 0 32768 10 1 + +i1 0 1 7.00 0.000001 0.8 +i1 + 0.5 7.02 0.01 1.0 +i1 + . 7.05 0.5 1.0 +i1 + . 7.07 4.0 1.0 +i1 + . 7.09 1.0 10.0 +i1 + 2 7.06 1.0 25.0 + +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/powoftwo.csd b/examples/powoftwo.csd new file mode 100644 index 0000000..1c50509 --- /dev/null +++ b/examples/powoftwo.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o powoftwo.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = powoftwo(12) + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/prealloc.csd b/examples/prealloc.csd new file mode 100644 index 0000000..13b3840 --- /dev/null +++ b/examples/prealloc.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o prealloc.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Pre-allocate memory for five instances of Instrument #1. +prealloc 1, 5 + +; Instrument #1 +instr 1 + ; Generate a waveform, get the cycles per second from the 4th p-field. + a1 oscil 6500, p4, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Just generate a nice, ordinary sine wave. +f 1 0 32768 10 1 + +; Play five instances of Instrument #1 for one second. +; Note that 4th p-field contains cycles per second. +i 1 0 1 220 +i 1 0 1 440 +i 1 0 1 880 +i 1 0 1 1320 +i 1 0 1 1760 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/prepiano.csd b/examples/prepiano.csd new file mode 100644 index 0000000..065de44 --- /dev/null +++ b/examples/prepiano.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o prepiano.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2; + +; Instrument #1. +instr 1 +;; fund NS detune stiffness decay loss (bndry) (hammer) scan prep +aa,ab prepiano 60, 3, 10, p4, 3, 0.002, 2, 2, 1, 5000, -0.01, p5, p6, 0, 0.1, 1, 2 + outs aa*.75, ab*.75 +endin +</CsInstruments> + +<CsScore> +f1 0 8 2 1 0.6 10 100 0.001 ;; 1 rattle +f2 0 8 2 1 0.7 50 500 1000 ;; 1 rubber +i1 0.0 0.5 1 0.09 20 +i1 0.5 . -1 0.09 40 ;; 1 -> skip initialisation +i1 1.0 . -1 0.09 60 +i1 1.5 . -1 0.09 80 +i1 2.0 1.8 -1 0.09 100 +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/print.csd b/examples/print.csd new file mode 100644 index 0000000..cf57429 --- /dev/null +++ b/examples/print.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o print.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print the fourth p-field. + print p4 +endin + + +</CsInstruments> +<CsScore> + +; p4 = value to be printed. +; Play Instrument #1 for one second, p4 = 50.375. +i 1 0 1 50.375 +; Play Instrument #1 for one second, p4 = 300. +i 1 1 1 300 +; Play Instrument #1 for one second, p4 = -999. +i 1 2 1 -999 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/printk.csd b/examples/printk.csd new file mode 100644 index 0000000..2f80a29 --- /dev/null +++ b/examples/printk.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o printk.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Change a value linearly from 0 to 100, + ; over the period defined by p3. + kval line 0, p3, 100 + + ; Print the value of kval, once per second. + printk 1, kval +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 5 seconds. +i 1 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/printk2.csd b/examples/printk2.csd new file mode 100644 index 0000000..c636230 --- /dev/null +++ b/examples/printk2.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o printk2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Change a value linearly from 0 to 10, + ; over the period defined by p3. + kval1 line 0, p3, 10 + + ; If kval1 is greater than or equal to 5, + ; then kval=2, else kval=1. + kval2 = (kval1 >= 5 ? 2 : 1) + + ; Print the value of kval2 when it changes. + printk2 kval2 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 5 seconds. +i 1 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/printks.csd b/examples/printks.csd new file mode 100644 index 0000000..24a807f --- /dev/null +++ b/examples/printks.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o printks.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Change a value linearly from 0 to 100, + ; over the period defined by p3. + kup line 0, p3, 100 + ; Change a value linearly from 30 to 10, + ; over the period defined by p3. + kdown line 30, p3, 10 + + ; Print the value of kup and kdown, once per second. + printks "kup = %f, kdown = %f\\n", 1, kup, kdown +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 5 seconds. +i 1 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/prints.csd b/examples/prints.csd new file mode 100644 index 0000000..7445e81 --- /dev/null +++ b/examples/prints.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o prints.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Matt Ingalls, edited by Kevin Conder. */ +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Init-time print. + prints "%2.3f\\t%!%!%!%!%!%!semicolons!\\n", 1234.56789 +endin + + +</CsInstruments> +<CsScore> + +/* Written by Matt Ingalls, edited by Kevin Conder. */ +; Play instrument #1. +i 1 0 0.004 + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ptrack.csd b/examples/ptrack.csd new file mode 100644 index 0000000..c9d0333 --- /dev/null +++ b/examples/ptrack.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No display +-odac -iadc -d ;;;RT audio I/O +</CsOptions> + +<CsInstruments> +sr= 44100 +ksmps = 16 +nchnls= 1 + +;Example by Victor Lazzarini 2007 + +instr 1 + a1 inch 1 ; take an input signal + kf,ka ptrack a1, 512 ; pitch track with winsize=1024 + kcps port kf, 0.01 ; smooth freq + kamp port ka, 0.01 ; smooth amp + + ; drive an oscillator + aout oscili ampdb(kamp)*0dbfs, kcps, 1 + + out aout +endin + +</CsInstruments> + +<CsScore> +i1 0 3600 +e +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/pvsarp.csd b/examples/pvsarp.csd new file mode 100644 index 0000000..48a4c3a --- /dev/null +++ b/examples/pvsarp.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc ;;;-d RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pvsarp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 256 +nchnls = 1 + +instr 1 +asig in ; get the signal in +idepth = p4 + +fsig pvsanal asig, 1024, 256, 1024, 1 ; analyse it +kbin oscili 0.1, 0.5, 1 ; ftable 1 in the 0-1 range +ftps pvsarp fsig, kbin+0.01, idepth, 2 ; arpeggiate it (range 220.5 - 2425.5) +atps pvsynth ftps ; synthesise it + + out atps +endin + + +</CsInstruments> +<CsScore> + +i 1 0 10 0.5 +i 1 + 10 0.9 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pvsbin.csd b/examples/pvsbin.csd new file mode 100644 index 0000000..1afdbb2 --- /dev/null +++ b/examples/pvsbin.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pvsbin.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 1 +ifftsize = 1024 +iwtype = 1 /* cleaner with hanning window */ + +;a1 soundin "input.wav" ;select a soundifle +a1 inch 1 ;Use realtime input + +fsig pvsanal a1, ifftsize, ifftsize/4, ifftsize, iwtype +kamp, kfr pvsbin fsig, 10 +adm oscil kamp, kfr, 1 + + out adm +endin + +</CsInstruments> +<CsScore> + +i 1 0 30 +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pvsdisp.csd b/examples/pvsdisp.csd new file mode 100644 index 0000000..ef036e4 --- /dev/null +++ b/examples/pvsdisp.csd @@ -0,0 +1,31 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pvsdisp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 1 +asig inch 1 +;a1 soundin "input.wav" ;select a soundifle +fsig pvsanal asig, 1024,256, 1024, 1 +pvsdisp fsig + +endin + +</CsInstruments> +<CsScore> + +i 1 0 30 +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pvsfwrite.csd b/examples/pvsfwrite.csd new file mode 100644 index 0000000..7e0db8f --- /dev/null +++ b/examples/pvsfwrite.csd @@ -0,0 +1,30 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pvsfwrite.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 1 +asig inch 1 ; input +fsig pvsanal asig, 1024, 256, 1024, 1 ; analysis +pvsfwrite fsig,"test.pvx" ; write file + +endin + +</CsInstruments> +<CsScore> + +i 1 0 30 +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pvsosc.csd b/examples/pvsosc.csd new file mode 100644 index 0000000..d1cba25 --- /dev/null +++ b/examples/pvsosc.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pvsosc.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 1 +; a band-limited sawtooth-wave oscillator +fsig pvsosc 10000, 440, 1, 1024 ; generate wave spectral signal +asig pvsynth fsig ; resynthesise it +out asig +endin + +instr 2 +; a band-limited square-wave oscillator +fsig pvsosc 10000, 440, 2, 1024 ; generate wave spectral signal +asig pvsynth fsig ; resynthesise it +out asig +endin + + +instr 3 +; a pulse oscillator +fsig pvsosc 10000, 440, 3, 1024 ; generate wave spectral signal +asig pvsynth fsig ; resynthesise it +out asig +endin + +instr 4 +; a cosine-wave oscillator +fsig pvsosc 10000, 440, 4, 1024 ; generate wave spectral signal +asig pvsynth fsig ; resynthesise it +out asig +endin + +</CsInstruments> +<CsScore> + +i 1 0 1 +i 2 2 1 +i 3 4 1 +i 4 6 1 + +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/pvspitch.csd b/examples/pvspitch.csd new file mode 100644 index 0000000..3fba360 --- /dev/null +++ b/examples/pvspitch.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o pvspitch.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 128 +nchnls = 1 + + +giwave ftgen 0, 0, 4096, 10, 1, 0.5, 0.333, 0.25, 0.2, 0.1666 + +instr 1 + +ifftsize = 1024 +iwtype = 1 /* cleaner with hanning window */ + +a1 inch 1 ;Realtime audio input +;a1 soundin "input.wav" ;Use this line for file input + +fsig pvsanal a1, ifftsize, ifftsize/4, ifftsize, iwtype +kfr, kamp pvspitch fsig, 0.01 + +adm oscil kamp, kfr * 1.5, giwave ;Generate note a fifth above detected pitch + + out adm +endin + + +</CsInstruments> +<CsScore> + +i 1 0 30 + +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/r.csd b/examples/r.csd new file mode 100644 index 0000000..a80c72c --- /dev/null +++ b/examples/r.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o r.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; The score's p4 parameter has the number of repeats. + kreps = p4 + ; The score's p5 parameter has our note's frequency. + kcps = p5 + + ; Print the number of repeats. + printks "Repeated %i time(s).\\n", 1, kreps + + ; Generate a nice beep. + a1 oscil 20000, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; We'll repeat this section 6 times. Each time it +; is repeated, its macro REPS_MACRO is incremented. +r6 REPS_MACRO + +; Play Instrument #1. +; p4 = the r statement's macro, REPS_MACRO. +; p5 = the frequency in cycles per second. +i 1 00.10 00.10 $REPS_MACRO 1760 +i 1 00.30 00.10 $REPS_MACRO 880 +i 1 00.50 00.10 $REPS_MACRO 440 +i 1 00.70 00.10 $REPS_MACRO 220 + +; Marks the end of the section. +s + +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/raises.csd b/examples/raises.csd new file mode 100644 index 0000000..efeb6b5 --- /dev/null +++ b/examples/raises.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o raises.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = 2 ^ 12 + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/rand.csd b/examples/rand.csd new file mode 100644 index 0000000..1028ac1 --- /dev/null +++ b/examples/rand.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o rand.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Choose a random frequency between 4,100 and 44,100. + kfreq rand 20000 + kcps = kfreq + 24100 + + a1 oscil 30000, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/randh.csd b/examples/randh.csd new file mode 100644 index 0000000..a50d372 --- /dev/null +++ b/examples/randh.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o randh.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Choose a random frequency between 200 and 1000. + ; Generate new random numbers at 4 Hz. + ; kamp = 400 + ; kcps = 4 + ; iseed = 0.5 + ; isize = 0 + ; ioffset = 600 + + kcps randh 400, 4, 0.5, 0, 600 + printk2 kcps + + a1 oscil 30000, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/randi.csd b/examples/randi.csd new file mode 100644 index 0000000..a496547 --- /dev/null +++ b/examples/randi.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o randi.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Choose a random frequency between 4,100 and 44,100. + ; Generate new random numbers at 10 Hz. + ; kamp = 40000 + ; kcps = 10 + ; iseed = 0.5 + ; isize = 0 + ; ioffset = 4100 + + kcps randi 40000, 10, 0.5, 0, 4100 + + a1 oscil 30000, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/random.csd b/examples/random.csd new file mode 100644 index 0000000..5ac86ad --- /dev/null +++ b/examples/random.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o random.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number between 220 and 440. + kmin init 220 + kmax init 440 + k1 random kmin, kmax + + printks "k1 = %f\\n", 0.1, k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/randomh.csd b/examples/randomh.csd new file mode 100644 index 0000000..26e59b3 --- /dev/null +++ b/examples/randomh.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o randomh.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Choose a random frequency between 220 and 440 Hz. + ; Generate new random numbers at 10 Hz. + kmin = 220 + kmax = 440 + kcps = 10 + + k1 randomh kmin, kmax, kcps + + printks "k1 = %f\\n", 0.1, k1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/randomi.csd b/examples/randomi.csd new file mode 100644 index 0000000..def7ad5 --- /dev/null +++ b/examples/randomi.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o randomi.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Choose a random frequency between 220 and 440. + ; Generate new random numbers at 10 Hz. + kmin init 220 + kmax init 440 + kcps init 10 + + k1 randomi kmin, kmax, kcps + + printks "k1 = %f\\n", 0.1, k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/rbjeq.csd b/examples/rbjeq.csd new file mode 100644 index 0000000..ab4c3c6 --- /dev/null +++ b/examples/rbjeq.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o rbjeq.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 10 +nchnls = 1 + + instr 1 + +a1 vco2 10000, 155.6 ; sawtooth wave +kfco expon 8000, p3, 200 ; filter frequency +a1 rbjeq a1, kfco, 1, kfco * 0.005, 1, 0 ; resonant lowpass + out a1 + + endin + + +</CsInstruments> +<CsScore> + +i 1 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/readclock.csd b/examples/readclock.csd new file mode 100644 index 0000000..5d33331 --- /dev/null +++ b/examples/readclock.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o readclock.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Start clock #1. + clockon 1 + ; Do something that keeps Csound busy. + a1 oscili 10000, 440, 1 + out a1 + ; Stop clock #1. + clockoff 1 + ; Print the time accumulated in clock #1. + i1 readclock 1 + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Initialize the function tables. +; Table 1: an ordinary sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for one second starting at 0:00. +i 1 0 1 +; Play Instrument #1 for one second starting at 0:01. +i 1 1 1 +; Play Instrument #1 for one second starting at 0:02. +i 1 2 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/readk.csd b/examples/readk.csd new file mode 100644 index 0000000..ba68d03 --- /dev/null +++ b/examples/readk.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o readk.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +0dbfs = 1 +; By Andres Cabrera 2008 + +instr 1 +; Read a number from the file every 0.5 seconds + kfibo readk "fibonacci.txt", 7, 0.5 + kpitchclass = 8 + ((kfibo % 12)/100) + printk2 kpitchclass + kcps = cpspch( kpitchclass ) + printk2 kcps + a1 oscil 0.5, kcps, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> +f 1 0 1024 10 1 +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/reinit.csd b/examples/reinit.csd new file mode 100644 index 0000000..6dfaa63 --- /dev/null +++ b/examples/reinit.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o reinit.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +instr 1 + +reset: + timout 0, p3/10, contin + reinit reset + +contin: + kLine expon 440, p3/10, 880 + aSig oscil 10000, kLine, 1 + out aSig + rireturn + +endin + + +</CsInstruments> +<CsScore> + +f1 0 4096 10 1 + +i1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/repluck.csd b/examples/repluck.csd new file mode 100644 index 0000000..2af2659 --- /dev/null +++ b/examples/repluck.csd @@ -0,0 +1,44 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o repluck.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + iplk = 0.75 + kamp = 30000 + icps = 220 + kpick = 0.75 + krefl = 0.5 + axcite oscil 1, 1, 1 + + apluck repluck iplk, kamp, icps, kpick, krefl, axcite + + out apluck +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/reson.csd b/examples/reson.csd new file mode 100644 index 0000000..967b155 --- /dev/null +++ b/examples/reson.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o reson.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a sine waveform. + asine buzz 15000, 440, 3, 1 + + ; Vary the cut-off frequency from 220 to 1280. + kcf line 220, p3, 1320 + kbw init 20 + + ; Run the sine through a resonant filter. + ares reson asine, kcf, kbw + + ; Give the filtered signal the same amplitude + ; as the original signal. + a1 balance ares, asine + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, an ordinary sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 4 seconds. +i 1 0 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/resonr.csd b/examples/resonr.csd new file mode 100644 index 0000000..9ccc45a --- /dev/null +++ b/examples/resonr.csd @@ -0,0 +1,70 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o resonr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Sean Costello */ + ; Orchestra file for resonant filter sweep of a sawtooth-like waveform. + ; The outputs of reson, resonr, and resonz are scaled by coefficients + ; specified in the score, so that each filter can be heard on its own + ; from the same instrument. + + sr = 44100 + kr = 4410 + ksmps = 10 + nchnls = 1 + +instr 1 + + idur = p3 + ibegfreq = p4 ; beginning of sweep frequency + iendfreq = p5 ; ending of sweep frequency + ibw = p6 ; bandwidth of filters in Hz + ifreq = p7 ; frequency of gbuzz that is to be filtered + iamp = p8 ; amplitude to scale output by + ires = p9 ; coefficient to scale amount of reson in output + iresr = p10 ; coefficient to scale amount of resonr in output + iresz = p11 ; coefficient to scale amount of resonz in output + + ; Frequency envelope for reson cutoff + kfreq linseg ibegfreq, idur * .5, iendfreq, idur * .5, ibegfreq + + ; Amplitude envelope to prevent clicking + kenv linseg 0, .1, iamp, idur - .2, iamp, .1, 0 + + ; Number of harmonics for gbuzz scaled to avoid aliasing + iharms = (sr*.4)/ifreq + + asig gbuzz 1, ifreq, iharms, 1, .9, 1 ; "Sawtooth" waveform + ain = kenv * asig ; output scaled by amp envelope + ares reson ain, kfreq, ibw, 1 + aresr resonr ain, kfreq, ibw, 1 + aresz resonz ain, kfreq, ibw, 1 + + out ares * ires + aresr * iresr + aresz * iresz + +endin + + +</CsInstruments> +<CsScore> + +/* Written by Sean Costello */ +f1 0 8192 9 1 1 .25 ; cosine table for gbuzz generator + +i1 0 10 1 3000 200 100 4000 1 0 0 ; reson output with bw = 200 +i1 10 10 1 3000 200 100 4000 0 1 0 ; resonr output with bw = 200 +i1 20 10 1 3000 200 100 4000 0 0 1 ; resonz output with bw = 200 +i1 30 10 1 3000 50 200 8000 1 0 0 ; reson output with bw = 50 +i1 40 10 1 3000 50 200 8000 0 1 0 ; resonr output with bw = 50 +i1 50 10 1 3000 50 200 8000 0 0 1 ; resonz output with bw = 50 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/resony.csd b/examples/resony.csd new file mode 100644 index 0000000..1e08bf6 --- /dev/null +++ b/examples/resony.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o resony.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a nice sawtooth waveform. + asig vco 32000, 220, 1 + + ; Vary the base frequency from 60 to 600 Hz. + kbf line 60, p3, 600 + kbw = 50 + inum = 2 + ksep = 1 + isepmode = 0 + iscl = 1 + + a1 resony asig, kbf, kbw, inum, ksep, isepmode, iscl + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave for the vco opcode. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/reverb.csd b/examples/reverb.csd new file mode 100644 index 0000000..7039531 --- /dev/null +++ b/examples/reverb.csd @@ -0,0 +1,63 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o reverb.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; init an audio receiver/mixer +ga1 init 0 + +; Instrument #1. (there may be many copies) +instr 1 + ; generate a source signal + a1 oscili 7000, cpspch(p4), 1 + ; output the direct sound + out a1 + ; and add to audio receiver + ga1 = ga1 + a1 +endin + +; (highest instr number executed last) +instr 99 + ; reverberate whatever is in ga1 + a3 reverb ga1, 1.5 + ; and output the result + out a3 + ; empty the receiver for the next pass + ga1 = 0 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 128 10 1 + +; p4 = frequency (in a pitch-class) +; Play Instrument #1 for a tenth of a second, p4=6.00 +i 1 0 0.1 6.00 +; Play Instrument #1 for a tenth of a second, p4=6.02 +i 1 1 0.1 6.02 +; Play Instrument #1 for a tenth of a second, p4=6.04 +i 1 2 0.1 6.04 +; Play Instrument #1 for a tenth of a second, p4=6.06 +i 1 3 0.1 6.06 + +; Make sure the reverb remains active. +i 99 0 6 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/reverbsc.csd b/examples/reverbsc.csd new file mode 100644 index 0000000..cfceee4 --- /dev/null +++ b/examples/reverbsc.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o reverbsc.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +sr = 48000 +ksmps = 32 +nchnls = 2 +0dbfs = 1 + + instr 1 +a1 vco2 0.85, 440, 10 +kfrq port 100, 0.004, 20000 +a1 butterlp a1, kfrq +a2 linseg 0, 0.003, 1, 0.01, 0.7, 0.005, 0, 1, 0 +a1 = a1 * a2 +a2 = a1 * p5 +a1 = a1 * p4 + denorm a1, a2 +aL, aR reverbsc a1, a2, 0.85, 12000, sr, 0.5, 1 + outs a1 + aL, a2 + aR + endin + +</CsInstruments> +<CsScore> +i 1 0 1 0.71 0.71 +i 1 1 1 0 1 +i 1 2 1 -0.71 0.71 +i 1 3 1 1 0 +i 1 4 4 0.71 0.71 +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/rezzy.csd b/examples/rezzy.csd new file mode 100644 index 0000000..59878f4 --- /dev/null +++ b/examples/rezzy.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o rezzy.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a nice sawtooth waveform. + asig vco 32000, 220, 1 + + ; Vary the filter-cutoff frequency from .2 to 2 KHz. + kfco line 200, p3, 2000 + + ; Set the resonance amount. + kres init 25 + + a1 rezzy asig, kfco, kres + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave for the vco opcode. +f 1 0 16384 10 1 + +; Play Instrument #1 for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/rms.csd b/examples/rms.csd new file mode 100644 index 0000000..267b430 --- /dev/null +++ b/examples/rms.csd @@ -0,0 +1,59 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d -m0 ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o rms.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +ksmps = 128 +nchnls = 1 + +;Example by Andres Cabrera 2007 + +0dbfs = 1 + +FLpanel "rms", 400, 100, 50, 50 + gkrmstext, gihrmstext FLtext "Rms", -100, 0, 0.1, 3, 110, 30, 60, 50 + gkihp, gihandle FLtext "ihp", 0, 10, 0.05, 1, 100, 30, 220, 50 + gkrmsslider, gihrmsslider FLslider "", -60, -0.5, -1, 5, -1, 380, 20, 10, 10 + +FLpanelEnd +FLrun + + +FLsetVal_i 5, gihandle +; Instrument #1. +instr 1 + a1 inch 1 + +label: + kval rms a1, i(gkihp) ;measures rms of input channel 1 +rireturn + + kval = dbamp(kval) ; convert to db full scale + printk 0.5, kval + FLsetVal 1, kval, gihrmsslider ;update the slider and text values + FLsetVal 1, kval, gihrmstext + knewihp changed gkihp ; reinit when ihp text has changed + if (knewihp == 1) then + reinit label ;needed because ihp is an i-rate parameter + endif +endin + + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one minute +i 1 0 60 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/rnd.csd b/examples/rnd.csd new file mode 100644 index 0000000..58e21eb --- /dev/null +++ b/examples/rnd.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o rnd.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number from 0 to 1. + i1 = rnd(1) + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #1 for one second. +i 1 1 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/rnd31.csd b/examples/rnd31.csd new file mode 100644 index 0000000..d9dbf03 --- /dev/null +++ b/examples/rnd31.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o rnd31.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create random numbers at a-rate in the range -2 to 2 with + ; a triangular distribution, seed from the current time. + a31 rnd31 2, -0.5 + + ; Use the random numbers to choose a frequency. + afreq = a31 * 500 + 100 + + a1 oscil 30000, afreq, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/rnd31_krate.csd b/examples/rnd31_krate.csd new file mode 100644 index 0000000..17386f9 --- /dev/null +++ b/examples/rnd31_krate.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o rnd31_krate.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create random numbers at k-rate in the range -1 to 1 + ; with a uniform distribution, seed=10. + k1 rnd31 1, 0, 10 + + printks "k1=%f\\n", 0.1, k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/rnd31_seed7.csd b/examples/rnd31_seed7.csd new file mode 100644 index 0000000..be3a641 --- /dev/null +++ b/examples/rnd31_seed7.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o rnd31_seed7.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; i-rate random numbers with linear distribution, seed=7. + ; (Note that the seed was used only in the first call.) + i1 rnd31 1, 0.5, 7 + i2 rnd31 1, 0.5 + i3 rnd31 1, 0.5 + + print i1 + print i2 + print i3 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/rnd31_time.csd b/examples/rnd31_time.csd new file mode 100644 index 0000000..11f4408 --- /dev/null +++ b/examples/rnd31_time.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o rnd31_time.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; i-rate random numbers with linear distribution, + ; seeding from the current time. (Note that the seed + ; was used only in the first call.) + i1 rnd31 1, 0.5, 0 + i2 rnd31 1, 0.5 + i3 rnd31 1, 0.5 + + print i1 + print i2 + print i3 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/rtclock.csd b/examples/rtclock.csd new file mode 100644 index 0000000..b1a8eb4 --- /dev/null +++ b/examples/rtclock.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o rtclock.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1 +instr 1 + ; Get the system time. + k1 rtclock + ; Print it once per second. + printk 1, k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/sandpaper.csd b/examples/sandpaper.csd new file mode 100644 index 0000000..087cdd8 --- /dev/null +++ b/examples/sandpaper.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o sandpaper.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +;orchestra --------------- + + sr = 44100 + kr = 4410 + ksmps = 10 + nchnls = 1 + +instr 01 ;an example of sandpaper blocks + a1 line 2, p3, 2 ;preset amplitude increase + a2 sandpaper p4, 0.01 ;sandpaper needs a little amp help at these settings + a3 product a1, a2 ;increase amplitude + out a3 + endin + + +</CsInstruments> +<CsScore> + +;score ------------------- + + i1 0 1 26000 + e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/scale.csd b/examples/scale.csd new file mode 100644 index 0000000..a274d70 --- /dev/null +++ b/examples/scale.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in Silent +-odac -iadc -d ;;;realtime output +</CsOptions> +<CsInstruments> + +sr = 22050 +ksmps = 10 +nchnls = 2 + +/*--- ---*/ + + instr 1 ; scale test + +kmod ctrl7 1, 1, 0, 1 + printk2 kmod + +kout scale kmod, 0, -127 + printk2 kout + + endin + +/*--- ---*/ +</CsInstruments> +<CsScore> + +i1 0 8888 + +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/scans.csd b/examples/scans.csd new file mode 100644 index 0000000..8b2bbef --- /dev/null +++ b/examples/scans.csd @@ -0,0 +1,57 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o scans.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + sr = 44100 + ksmps = 128 + nchnls = 1 + + instr 1 +a0 = 0 +; scanu init, irate, ifnvel, ifnmass, ifnstif, ifncentr, ifndamp, kmass, kstif, kcentr, kdamp, ileft, iright, kpos, kstrngth, ain, idisp, id + scanu 1, .01, 6, 2, 3, 4, 5, 2, .1, .1, -.01, .1, .5, 0, 0, a0, 1, 2 +;ar scans kamp, kfreq, ifntraj, id +a1 scans ampdb(p4), cpspch(p5), 7, 2 + out a1 + endin + + +</CsInstruments> +<CsScore> + +; Initial condition +f1 0 128 7 0 64 1 64 0 + +; Masses +f2 0 128 -7 1 128 1 + +; Spring matrices +f3 0 16384 -23 "string-128.matrix" + +; Centering force +f4 0 128 -7 0 128 2 + +; Damping +f5 0 128 -7 1 128 1 + +; Initial velocity +f6 0 128 -7 0 128 0 + +; Trajectories +f7 0 128 -5 .001 128 128 + +; Note list +i1 0 10 86 6.00 +i1 11 14 86 7.00 +i1 15 20 86 5.00 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/scantable.csd b/examples/scantable.csd new file mode 100644 index 0000000..20340b9 --- /dev/null +++ b/examples/scantable.csd @@ -0,0 +1,54 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o scantable.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Table #1 - initial position +git1 ftgen 1, 0, 128, 7, 0, 64, 1, 64, 0 +; Table #2 - masses +git2 ftgen 2, 0, 128, -7, 1, 128, 1 +; Table #3 - stiffness +git3 ftgen 3, 0, 128, -7, 0, 64, 100, 64, 0 +; Table #4 - damping +git4 ftgen 4, 0, 128, -7, 1, 128, 1 +; Table #5 - initial velocity +git5 ftgen 5, 0, 128, -7, 0, 128, 0 + +; Instrument #1. +instr 1 + kamp init 20000 + kpch init 220 + ipos = 1 + imass = 2 + istiff = 3 + idamp = 4 + ivel = 5 + + a1 scantable kamp, kpch, ipos, imass, istiff, idamp, ivel + a2 dcblock a1 + + out a2 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for ten seconds. +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/schedkwhen.csd b/examples/schedkwhen.csd new file mode 100644 index 0000000..702884c --- /dev/null +++ b/examples/schedkwhen.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o schedkwhen.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1 - oscillator with a high note. +instr 1 + ; Use the fourth p-field as the trigger. + ktrigger = p4 + kmintim = 0 + kmaxnum = 2 + kinsnum = 2 + kwhen = 0 + kdur = 0.5 + + ; Play Instrument #2 at the same time, if the trigger is set. + schedkwhen ktrigger, kmintim, kmaxnum, kinsnum, kwhen, kdur + + ; Play a high note. + a1 oscils 10000, 880, 1 + out a1 +endin + +; Instrument #2 - oscillator with a low note. +instr 2 + ; Play a low note. + a1 oscils 10000, 220, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; p4 = trigger for Instrument #2 (when p4 > 0). +; Play Instrument #1 for half a second, no trigger. +i 1 0 0.5 0 +; Play Instrument #1 for half a second, trigger Instrument #2. +i 1 1 0.5 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/schedkwhennamed.csd b/examples/schedkwhennamed.csd new file mode 100644 index 0000000..91eef55 --- /dev/null +++ b/examples/schedkwhennamed.csd @@ -0,0 +1,44 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d +; For Non-realtime ouput leave only the line below: +; -o schedkwhennamed.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + sr = 48000 + ksmps = 16 + nchnls = 2 + 0dbfs = 1 + +; Example by Jonathan Murphy 2007 + + gSinstr2 = "printer" + + instr 1 + + ktrig metro 1 +if (ktrig == 1) then + ;Call instrument "printer" once per second + schedkwhennamed ktrig, 0, 1, gSinstr2, 0, 1 + +endif + + endin + + instr printer + + ktime timeinsts + printk2 ktime + + endin + +</CsInstruments> +<CsScore> +i1 0 10 +e +</CsScore> +</CsoundSynthesizer> + diff --git a/examples/schedule.csd b/examples/schedule.csd new file mode 100644 index 0000000..cd4adb1 --- /dev/null +++ b/examples/schedule.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o schedule.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - oscillator with a high note. +instr 1 + ; Play Instrument #2 at the same time. + schedule 2, 0, p3 + + ; Play a high note. + a1 oscils 10000, 880, 1 + out a1 +endin + +; Instrument #2 - oscillator with a low note. +instr 2 + ; Play a low note. + a1 oscils 10000, 220, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for half a second. +i 1 0 0.5 +; Play Instrument #1 for half a second. +i 1 1 0.5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/schedwhen.csd b/examples/schedwhen.csd new file mode 100644 index 0000000..bcab331 --- /dev/null +++ b/examples/schedwhen.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o schedwhen.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1 - oscillator with a high note. +instr 1 + ; Use the fourth p-field as the trigger. + ktrigger = p4 + kinsnum = 2 + kwhen = 0 + kdur = p3 + + ; Play Instrument #2 at the same time, if the trigger is set. + schedwhen ktrigger, kinsnum, kwhen, kdur + + ; Play a high note. + a1 oscils 10000, 880, 1 + out a1 +endin + +; Instrument #2 - oscillator with a low note. +instr 2 + ; Play a low note. + a1 oscils 10000, 220, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; p4 = trigger for Instrument #2 (when p4 > 0). +; Play Instrument #1 for half a second, trigger Instrument #2. +i 1 0 0.5 1 +; Play Instrument #1 for half a second, no trigger. +i 1 1 0.5 0 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/schottstaedt.orc b/examples/schottstaedt.orc new file mode 100644 index 0000000..f5868ca --- /dev/null +++ b/examples/schottstaedt.orc @@ -0,0 +1,71 @@ + + + +;=========================================================== +; schottstaedt.orc +;=========================================================== + + sr = 44100 + kr = 2205 + ksmps = 20 + nchnls = 2 + + +; functions for the schottstaedt string +giSineWave ftgen 1, 0, 512, 10, 1 +giTable1 ftgen 2, 0, 129, 7, 1, 129, 0 +giVibEnvlp ftgen 3, 0, 129, 5, .01, 129, 1 +giPanLeft ftgen 10, 0, 129, 9, .25, 1, 90 +giPanRight ftgen 11, 0, 129, 9, .25, 1, 0 + + + + instr 1 ; a schottstaedt string instrument +;=========================================================== +; p4=amp(0-1) p5=pitch(in oct) p6=pan(0=l, 1=r) +;=========================================================== +; set constants +iamp = 32767*p4 + +icps = cpsoct(p5) + +; check to see if pan is out of our range +ipanfac = (p6 > 1 ? 1 : p6) +ipanfac = (p6 < 0 ? 0 : ipanfac) +; map linear pan factor to more natural sqrt function +ilpan tablei ipanfac,10,1 +irpan tablei ipanfac,11,1 + +indx1 = 7.5/log(icps) +indx2 = (8.5-log(icps))/(3+icps*1000) +indx3 = 1.25/sqrt(icps) + + + +;vibrato unit +krnd randi .0075,15 +kvibe oscil1i 0,.015,p3/4,3 ;envlp for vibrato +kvib oscili krnd+kvibe,5.5*kvibe,1 + +;attack noise +kgaten oscil1i 0,iamp/5,.2,2 +krnd randi kgaten,.2*icps +anoise oscili krnd,2000,1 + +;main unit +kgate oscil1i 0,1,.2,2 ;envlp for indicies to make + ;chiff sound + +amod1 oscili (kgate+indx1)*icps,icps,1 +amod2 oscili (kgate+indx2)*3*icps,3*icps,1 ;modulators +amod3 oscili (kgate+indx3)*4*icps,4*icps,1 + +amods = icps+amod1+amod2+amod3 + +asig oscili iamp,amods*(kvib+1),1 ;carrier oscil with vibrato + +asigs linen asig+anoise,.2,p3,.2 ;final envlp for oscil+noise + + outs asigs*ilpan,asigs*irpan + + endin diff --git a/examples/scogen.csd b/examples/scogen.csd new file mode 100644 index 0000000..a368cbc --- /dev/null +++ b/examples/scogen.csd @@ -0,0 +1,219 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +; -odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +-n +;Don't write audio ouput to disk +</CsOptions> +<CsInstruments> +;=========================================================== +; scogen.csd by: Matt Ingalls +; +; a "port" of sorts +; of the old "mills" score generator (scogen) +; +; this instrument creates a schottstaedt.sco file +; to be used with the schottstaedt.orc file +; +; as long as you dont save schottstaedt.orc as a .csd +; file, you should be able to keep it open in MacCsound +; and render each newly generated .sco file. +; +;=========================================================== + + +gScoName = "/Users/matt/Desktop/schottstaedt.sco" ; the name of the file to be generated + + sr = 100 ; this defines our temporal resolution, + ; an sr of 100 means we will generate p2 and p3 values + ; to the nearest 1/100th of a second + + ksmps = 1 ; set kr=sr so we can do everything at k-rate + + +; some print opcodes +opcode PrintInteger, 0, k + kval xin + fprintks gScoName, "%d", kval +endop + +opcode PrintFloat, 0, k + kval xin + fprintks gScoName, "%f", kval +endop + +opcode PrintTab, 0, 0 + fprintks gScoName, "%n" +endop + +opcode PrintReturn, 0, 0 + fprintks gScoName, "%r" +endop + + +; recursively calling opcode to handle all the optional parameters +opcode ProcessAdditionalPfields, 0, ikio + iPtable, kndx, iNumPfields, iPfield xin + + ; additional pfields start at 5, we use a default 0 to identify the first call + iPfield = (iPfield == 0 ? 5 : iPfield) + + if (iPfield > iNumPfields) goto endloop + ; find our tables + iMinTable table 2*iPfield-1, iPtable + iMaxTable table 2*iPfield, iPtable + + ; get values from our tables + kMin tablei kndx, iMinTable + kMax tablei kndx, iMaxTable + + ; find a random value in the range and write it to the score + fprintks gScoName, "%t%f", kMin + rnd(kMax-kMin) + + ; recursively call for any additional pfields. + ProcessAdditionalPfields iPtable, kndx, iNumPfields, iPfield + 1 + endloop: + +endop + + +/* =========================================================== + Generate a gesture of i-statements + + p2 = start of the gesture + p3 = duration of the gesture + p4 = number of a function that contains a list of all + function table numbers used to define the + pfield random distribution + p5 = scale generated p4 values according to density (0=off, 1=on) [todo] + p6 = let durations overlap gesture duration (0=off, 1=on) [todo] + p7 = seed for random number generator seed [todo] + =========================================================== +*/ +instr Gesture + + ; initialize + iResolution = 1/sr + + kNextStart init p2 + kCurrentTime init p2 + + iNumPfields table 0, p4 + iInstrMinTable table 1, p4 + iInstrMaxTable table 2, p4 + iDensityMinTable table 3, p4 + iDensityMaxTable table 4, p4 + iDurMinTable table 5, p4 + iDurMaxTable table 6, p4 + iAmpMinTable table 7, p4 + iAmpMaxTable table 8, p4 + + ; check to make sure there is enough data + print iNumPfields + if iNumPfields < 4 then + prints "%dError: At least 4 p-fields (8 functions) need to be specified.%n", iNumPfields + turnoff + endif + + ; initial comment + fprints gScoName, "%!Generated Gesture from %f to %f seconds%n %!%t%twith a p-max of %d%n%n", p2, p3, iNumPfields + + ; k-rate stuff + if (kCurrentTime >= kNextStart) then ; write a new note! + + kndx = (kCurrentTime-p2)/p3 + + ; get the required pfield ranges + kInstMin tablei kndx, iInstrMinTable + kInstMax tablei kndx, iInstrMaxTable + kDensMin tablei kndx, iDensityMinTable + kDensMax tablei kndx, iDensityMaxTable + kDurMin tablei kndx, iDurMinTable + kDurMax tablei kndx, iDurMaxTable + kAmpMin tablei kndx, iAmpMinTable + kAmpMax tablei kndx, iAmpMaxTable + + ; find random values for all our required parametrs and print the i-statement + fprintks gScoName, "i%d%t%f%t%f%t%f", kInstMin + rnd(kInstMax-kInstMin), kNextStart, kDurMin + rnd(kDurMax-kDurMin), kAmpMin + rnd(kAmpMax-kAmpMin) + + ; now any additional pfields + ProcessAdditionalPfields p4, kndx, iNumPfields + + PrintReturn + + ; calculate next starttime + kDensity = kDensMin + rnd(kDensMax-kDensMin) + if (kDensity < iResolution) then + kDensity = iResolution + endif + kNextStart = kNextStart + kDensity + endif + + kCurrentTime = kCurrentTime + iResolution +endin + + +</CsInstruments> +<CsScore> +/* +=========================================================== + scogen.sco + + this csound module generates a score file + you specify a gesture of notes by giving + the "gesture" instrument a number to a + (negative) gen2 table. + + this table stores numbers to pairs of functions. + each function-pair represents a range (min-max) + of randomness for every pfield for the notes to + be generated. +=========================================================== +*/ + + +; common tables for pfield ranges +f100 0 2 -7 0 2 0 ; static 0 +f101 0 2 -7 1 2 1 ; static 1 +f102 0 2 -7 0 2 1 ; ramp 0->1 +f103 0 2 -7 1 2 0 ; ramp 1->0 +f105 0 2 -7 10 2 10 ; static 10 +f106 0 2 -7 .1 2 .1 ; static .1 + +; specific pfield ranges +f10 0 2 -7 .8 2 .01 ; density +f11 0 2 -7 8 2 4 ; pitchmin +f12 0 2 -7 8 2 12 ; pitchmax + + +;=== table containing the function numbers used for all the p-field distributions +; +; p1 - table number +; p2 - time table is instantiated +; p3 - size of table (must be >= p5!) +; p4 - gen# (should be = -2) +; p5 - number of pfields of each note to be generated +; p6 - table number of the function representing the minimum possible note number (p1) of a generated note +; p7 - table number of the function representing the maximum possible note number (p1) of a generated note +; p8 - table number of the function representing the minimum possible noteon-to-noteon time (p2 density) of a generated note +; p9 - table number of the function representing the maximum possible noteon-to-noteon time (p2 density) of a generated note +; p10 - table number of the function representing the minimum possible duration (p3) of a generated note +; p11 - table number of the function representing the maximum possible duration (p3) of a generated note +; p12 - table number of the function representing the maximum possible amplitude (p4) of a generated note +; p13 - table number of the function representing the maximum possible amplitude (p5) of a generated note +; p14,p16.. - table number of the function representing the minimum possible value for additional pfields (p5,p6..) of a generated note +; p15,p17.. - table number of the function representing the maximum possible value for additional pfields (p5,p6..) of a generated note + +; siz 2 #pds p1min p1max p2min p2max p3min p3max p4min p4max p5min p5max p6min p6max +f1 0 32 -2 6 101 101 10 10 101 105 100 106 11 12 100 101 + + +;gesture definitions +; start dur pTble scale overlap seed +i"Gesture" 0 60 1 ;todo-->0 0 123 +</CsScore> + +</CsoundSynthesizer> + diff --git a/examples/sekere.csd b/examples/sekere.csd new file mode 100644 index 0000000..4189961 --- /dev/null +++ b/examples/sekere.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o sekere.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +;orchestra --------------- + + sr = 44100 + kr = 4410 + ksmps = 10 + nchnls = 1 + +instr 01 ;an example of a sekere +a1 sekere p4, 0.01 + out a1 + endin + + +</CsInstruments> +<CsScore> + +;score ------------------- + + i1 0 1 26000 + e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/semitone.csd b/examples/semitone.csd new file mode 100644 index 0000000..f2d6b8c --- /dev/null +++ b/examples/semitone.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o semitone.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; The root note is A above middle-C (440 Hz) + iroot = 440 + + ; Raise the root note by three semitones to C. + isemitone = 3 + + ; Calculate the new note. + ifactor = semitone(isemitone) + inew = iroot * ifactor + + ; Print out all of the values. + print iroot + print ifactor + print inew +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/sensekey.csd b/examples/sensekey.csd new file mode 100644 index 0000000..c8ad1b1 --- /dev/null +++ b/examples/sensekey.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o sensekey.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + k1 sensekey + printk2 k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for thirty seconds. +i 1 0 30 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/seqtime.csd b/examples/seqtime.csd new file mode 100644 index 0000000..c5f214e --- /dev/null +++ b/examples/seqtime.csd @@ -0,0 +1,74 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o seqtime.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> + + sr = 44100 + ksmps = 64 + nchnls = 1 + +; By Tim Mortimer and Andres Cabrera 2007 + +0dbfs = 1 + +gisine ftgen 0, 0, 8192, 10, 1 +;;; table defining an integer pitch set +gipset ftgen 0, 0, 4, -2, 8.00, 8.04, 8.07, 8.10 +;;;DELTA times for seqtime +gidelta ftgen 0, 0, 4, -2, .5, 1, .25, 1.25 + + + instr 1 + +kndx init 0 +ktrigger init 0 + +ktime_unit init 1 +kstart init p4 +kloop init p5 +kinitndx init 0 +kfn_times init gidelta + +ktrigger seqtime ktime_unit, kstart, kloop, kinitndx, kfn_times + +printk2 ktrigger + + +if (ktrigger > 0) then + kpitch table kndx, gipset + event "i", 2, 0, 1, kpitch + kndx = kndx + 1 + kndx = kndx % kloop +endif + + endin + + + instr 2 +icps = cpspch (p4) +a1 buzz 1, icps, 7, gisine +aamp expseg 0.00003,.02,1,p3-.02,0.00003 + +a1 = a1 * aamp * 0.5 + +out a1 + endin + +</CsInstruments> + +<CsScore> +; start dur kstart kloop +i 1 0 7 0 4 +i 1 8 10 0 3 +i 1 19 10 4 4 + +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/setctrl.csd b/examples/setctrl.csd new file mode 100644 index 0000000..9d7b0a7 --- /dev/null +++ b/examples/setctrl.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o setctrl.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Display the label "Volume" on Slider #1. + setctrl 1, "Volume", 4 + ; Set Slider #1's initial value to 20. + setctrl 1, 20, 1 + + ; Capture and display the values for Slider #1. + k1 control 1 + printk2 k1 + + ; Play a simple oscillator. + ; Use the values from Slider #1 for amplitude. + kamp = k1 * 128 + a1 oscil kamp, 440, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for thirty seconds. +i 1 0 30 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/shaker.csd b/examples/shaker.csd new file mode 100644 index 0000000..3229f30 --- /dev/null +++ b/examples/shaker.csd @@ -0,0 +1,32 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o shaker.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1 +instr 1 + a1 shaker 10000, 440, 8, 0.999, 100, 0 + out a1 +endin + + +</CsInstruments> +<CsScore> + +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/sin.csd b/examples/sin.csd new file mode 100644 index 0000000..c0c920a --- /dev/null +++ b/examples/sin.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o sin.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + irad = 25 + i1 = sin(irad) + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/sinh.csd b/examples/sinh.csd new file mode 100644 index 0000000..f9077d4 --- /dev/null +++ b/examples/sinh.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o sinh.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + irad = 1 + i1 = sinh(irad) + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/sininv.csd b/examples/sininv.csd new file mode 100644 index 0000000..d8e3e8d --- /dev/null +++ b/examples/sininv.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o sininv.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + irad = 0.5 + i1 = sininv(irad) + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/sleighbells.csd b/examples/sleighbells.csd new file mode 100644 index 0000000..ef3b861 --- /dev/null +++ b/examples/sleighbells.csd @@ -0,0 +1,42 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o sleighbells.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1: An example of sleighbells. +instr 1 + a1 sleighbells 20000, 0.01 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +i 1 0.00 0.25 +i 1 0.30 0.25 +i 1 0.60 0.25 +i 1 0.90 0.25 +i 1 1.20 0.25 +i 1 1.50 0.25 +i 1 1.80 0.25 +i 1 2.10 0.25 +i 1 2.40 0.25 +i 1 2.70 0.25 +i 1 3.00 0.25 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/sndwarp.csd b/examples/sndwarp.csd new file mode 100644 index 0000000..018f2ee --- /dev/null +++ b/examples/sndwarp.csd @@ -0,0 +1,64 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o sndwarp.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - play an audio file. +instr 1 + ; Use the audio file defined in Table #1. + a1 loscil 30000, 1, 1, 1 + + out a1 +endin + +; Instrument #2 - time-stretch an audio file. +instr 2 + kamp init 6500 + ; Start at 1 second and end at 3.5 seconds. + ktimewarp line 1, p3, 3.5 + ; Playback at the normal speed. + kresample init 1 + ; Use the audio file defined in Table #1. + ifn1 = 1 + ibeg = 0 + iwsize = 4410 + irandw = 882 + ioverlap = 15 + ; Use Table #2 for the windowing function. + ifn2 = 2 + ; Use the ktimewarp parameter as a "time" pointer. + itimemode = 1 + + a1 sndwarp kamp, ktimewarp, kresample, ifn1, ibeg, iwsize, irandw, ioverlap, ifn2, itimemode + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: an audio file. +f 1 0 262144 1 "mary.wav" 0 0 0 +; Table #2: half of a sine wave. +f 2 0 16384 9 0.5 1 0 + +; Play Instrument #1 for 3.5 seconds. +i 1 0 3.5 +; Play Instrument #2 for 7 seconds (time-stretched). +i 2 3.5 10.5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/soundin.csd b/examples/soundin.csd new file mode 100644 index 0000000..b87b737 --- /dev/null +++ b/examples/soundin.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o soundin.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1 - play an audio file. +instr 1 + asig soundin "beats.wav" + out asig +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1, the audio file, for three seconds. +i 1 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/spat3d_UHJ.csd b/examples/spat3d_UHJ.csd new file mode 100644 index 0000000..1447df4 --- /dev/null +++ b/examples/spat3d_UHJ.csd @@ -0,0 +1,83 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o spat3d_UHJ.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Istvan Varga */ +sr = 48000 +kr = 750 +ksmps = 64 +nchnls = 2 + +itmp ftgen 1, 0, 64, -2, \ + /* depth1, depth2, max delay, IR length, idist, seed */ \ + 3, 48, -1, 0.01, 0.25, 123, \ + 1, 21.982, 0.05, 0.87, 4000.0, 0.6, 0.7, 2, /* ceil */ \ + 1, 1.753, 0.05, 0.87, 3500.0, 0.5, 0.7, 2, /* floor */ \ + 1, 15.220, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* front */ \ + 1, 9.317, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* back */ \ + 1, 17.545, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* right */ \ + 1, 12.156, 0.05, 0.87, 5000.0, 0.8, 0.7, 2 /* left */ + + instr 1 + +p3 = p3 + 1.0 + +kazim line 0.0, 4.0, 360.0 ; azimuth +kelev line 40, p3 - 1.0, -20 ; elevation +kdist = 2.0 ; distance +; convert coordinates +kX = kdist * cos(kelev * 0.01745329) * sin(kazim * 0.01745329) +kY = kdist * cos(kelev * 0.01745329) * cos(kazim * 0.01745329) +kZ = kdist * sin(kelev * 0.01745329) + +; source signal +a1 phasor 160.0 +a2 delay1 a1 +a1 = a1 - a2 +kffrq1 port 200.0, 0.8, 12000.0 +affrq upsamp kffrq1 +affrq pareq affrq, 5.0, 0.0, 1.0, 2 +kffrq downsamp affrq +aenv4 phasor 3.0 +aenv4 limit 2.0 - aenv4 * 8.0, 0.0, 1.0 +a1 butterbp a1 * aenv4, kffrq, 160.0 +aenv linseg 1.0, p3 - 1.0, 1.0, 0.04, 0.0, 1.0, 0.0 +a_ = 4000000 * a1 * aenv + 0.00000001 + +; spatialize +a_W, a_X, a_Y, a_Z spat3d a_, kX, kY, kZ, 1.0, 1, 2, 2.0, 2 + +; convert to UHJ format (stereo) +aWre, aWim hilbert a_W +aXre, aXim hilbert a_X +aYre, aYim hilbert a_Y + +aWXre = 0.0928*aXre + 0.4699*aWre +aWXim = 0.2550*aXim - 0.1710*aWim + +aL = aWXre + aWXim + 0.3277*aYre +aR = aWXre - aWXim - 0.3277*aYre + + outs aL, aR + + endin + + +</CsInstruments> +<CsScore> + +/* Written by Istvan Varga */ +t 0 60 + +i 1 0.0 8.0 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/spat3d_quad.csd b/examples/spat3d_quad.csd new file mode 100644 index 0000000..780432b --- /dev/null +++ b/examples/spat3d_quad.csd @@ -0,0 +1,98 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o spat3d_quad.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Istvan Varga */ +sr = 48000 +kr = 1000 +ksmps = 48 +nchnls = 4 + +/* room parameters */ + +idep = 3 /* early reflection depth */ + +itmp ftgen 1, 0, 64, -2, \ + /* depth1, depth2, max delay, IR length, idist, seed */ \ + idep, 48, -1, 0.01, 0.25, 123, \ + 1, 21.982, 0.05, 0.87, 4000.0, 0.6, 0.7, 2, /* ceil */ \ + 1, 1.753, 0.05, 0.87, 3500.0, 0.5, 0.7, 2, /* floor */ \ + 1, 15.220, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* front */ \ + 1, 9.317, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* back */ \ + 1, 17.545, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* right */ \ + 1, 12.156, 0.05, 0.87, 5000.0, 0.8, 0.7, 2 /* left */ + + instr 1 + +/* some source signal */ + +a1 phasor 150 ; oscillator +a1 butterbp a1, 500, 200 ; filter +a1 = taninv(a1 * 100) +a2 phasor 3 ; envelope +a2 mirror 40*a2, -100, 5 +a2 limit a2, 0, 1 +a1 = a1 * a2 * 9000 + +kazim line 0, 2.5, 360 ; move sound source around +kdist line 1, 10, 4 ; distance + +; convert polar coordinates +kX = sin(kazim * 3.14159 / 180) * kdist +kY = cos(kazim * 3.14159 / 180) * kdist +kZ = 0 + +a1 = a1 + 0.000001 * 0.000001 ; avoid underflows + +imode = 2 ; change this to 3 for 8 spk in a cube, + ; or 1 for simple stereo + +aW, aX, aY, aZ spat3d a1, kX, kY, kZ, 1.0, 1, imode, 2, 2 + +aW = aW * 1.4142 + +; stereo +; +;aL = aW + aY /* left */ +;aR = aW - aY /* right */ + +; quad (square) +; +aFL = aW + aX + aY /* front left */ +aFR = aW + aX - aY /* front right */ +aRL = aW - aX + aY /* rear left */ +aRR = aW - aX - aY /* rear right */ + +; eight channels (cube) +; +;aUFL = aW + aX + aY + aZ /* upper front left */ +;aUFR = aW + aX - aY + aZ /* upper front right */ +;aURL = aW - aX + aY + aZ /* upper rear left */ +;aURR = aW - aX - aY + aZ /* upper rear right */ +;aLFL = aW + aX + aY - aZ /* lower front left */ +;aLFR = aW + aX - aY - aZ /* lower front right */ +;aLRL = aW - aX + aY - aZ /* lower rear left */ +;aLRR = aW - aX - aY - aZ /* lower rear right */ + + outq aFL, aFR, aRL, aRR + + endin + + +</CsInstruments> +<CsScore> + +/* Written by Istvan Varga */ +t 0 60 +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/spat3d_stereo.csd b/examples/spat3d_stereo.csd new file mode 100644 index 0000000..8fef6c4 --- /dev/null +++ b/examples/spat3d_stereo.csd @@ -0,0 +1,97 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o spat3d_stereo.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +/* Written by Istvan Varga */ +sr = 48000 +kr = 1000 +ksmps = 48 +nchnls = 2 + +/* room parameters */ + +idep = 3 /* early reflection depth */ + +itmp ftgen 1, 0, 64, -2, \ + /* depth1, depth2, max delay, IR length, idist, seed */ \ + idep, 48, -1, 0.01, 0.25, 123, \ + 1, 21.982, 0.05, 0.87, 4000.0, 0.6, 0.7, 2, /* ceil */ \ + 1, 1.753, 0.05, 0.87, 3500.0, 0.5, 0.7, 2, /* floor */ \ + 1, 15.220, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* front */ \ + 1, 9.317, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* back */ \ + 1, 17.545, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* right */ \ + 1, 12.156, 0.05, 0.87, 5000.0, 0.8, 0.7, 2 /* left */ + + instr 1 + +/* some source signal */ + +a1 phasor 150 ; oscillator +a1 butterbp a1, 500, 200 ; filter +a1 = taninv(a1 * 100) +a2 phasor 3 ; envelope +a2 mirror 40*a2, -100, 5 +a2 limit a2, 0, 1 +a1 = a1 * a2 * 9000 + +kazim line 0, 2.5, 360 ; move sound source around +kdist line 1, 10, 4 ; distance + +; convert polar coordinates +kX = sin(kazim * 3.14159 / 180) * kdist +kY = cos(kazim * 3.14159 / 180) * kdist +kZ = 0 + +a1 = a1 + 0.000001 * 0.000001 ; avoid underflows + +imode = 1 ; change this to 3 for 8 spk in a cube, + ; or 1 for simple stereo + +aW, aX, aY, aZ spat3d a1, kX, kY, kZ, 1.0, 1, imode, 2, 2 + +aW = aW * 1.4142 + +; stereo +; +aL = aW + aY /* left */ +aR = aW - aY /* right */ + +; quad (square) +; +;aFL = aW + aX + aY /* front left */ +;aFR = aW + aX - aY /* front right */ +;aRL = aW - aX + aY /* rear left */ +;aRR = aW - aX - aY /* rear right */ + +; eight channels (cube) +; +;aUFL = aW + aX + aY + aZ /* upper front left */ +;aUFR = aW + aX - aY + aZ /* upper front right */ +;aURL = aW - aX + aY + aZ /* upper rear left */ +;aURR = aW - aX - aY + aZ /* upper rear right */ +;aLFL = aW + aX + aY - aZ /* lower front left */ +;aLFR = aW + aX - aY - aZ /* lower front right */ +;aLRL = aW - aX + aY - aZ /* lower rear left */ +;aLRR = aW - aX - aY - aZ /* lower rear right */ + + outs aL, aR + + endin + + +</CsInstruments> +<CsScore> + +/* Written by Istvan Varga */ +i 1 0 10 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/sprintfk.csd b/examples/sprintfk.csd new file mode 100644 index 0000000..36c0555 --- /dev/null +++ b/examples/sprintfk.csd @@ -0,0 +1,39 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o sprintfk.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + sr = 48000 + ksmps = 16 + nchnls = 2 + 0dbfs = 1 + +; Example by Jonathan Murphy 2007 + + instr 1 + + S1 = "1" + S2 = " + 1" + ktrig init 0 + kval init 2 +if (ktrig == 1) then + S1 strcatk S1, S2 + kval = kval + 1 +endif + String sprintfk "%s = %d", S1, kval + puts String, kval + ktrig metro 1 + + endin + +</CsInstruments> +<CsScore> +i1 0 10 +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/sqrt.csd b/examples/sqrt.csd new file mode 100644 index 0000000..8637e96 --- /dev/null +++ b/examples/sqrt.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o sqrt.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = sqrt(64) + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/stix.csd b/examples/stix.csd new file mode 100644 index 0000000..a645463 --- /dev/null +++ b/examples/stix.csd @@ -0,0 +1,36 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o stix.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +;orchestra --------------- + + sr = 44100 + kr = 4410 + ksmps = 10 + nchnls = 1 + +instr 01 ;an example of stix + a1 line 20, p3, 20 ;preset amplitude increase + a2 stix p4, 0.01 ;stix needs a little amp help at these settings + a3 product a1, a2 ;increase amplitude + out a3 + endin + + +</CsInstruments> +<CsScore> + +;score ------------------- + + i1 0 1 26000 + e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/streson.csd b/examples/streson.csd new file mode 100644 index 0000000..5315433 --- /dev/null +++ b/examples/streson.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o streson.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a normal sine wave. + asig oscils 8000, 440, 1 + + ; Vary the fundamental frequency of the string + ; resonator linearly from 220 to 880 Hertz. + kfr line 220, p3, 880 + ifdbgain = 0.95 + + ; Run our sine wave through the string resonator. + astres streson asig, kfr, ifdbgain + + ; The resonance can get quite loud. + ; So we'll clip the signal at 30,000. + a1 clip astres, 1, 30000 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for five seconds. +i 1 0 5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/string-128.matrix b/examples/string-128.matrix new file mode 100644 index 0000000..15ec999 --- /dev/null +++ b/examples/string-128.matrix @@ -0,0 +1 @@ +0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
\ No newline at end of file diff --git a/examples/strsub.csd b/examples/strsub.csd new file mode 100644 index 0000000..5bcedd5 --- /dev/null +++ b/examples/strsub.csd @@ -0,0 +1,30 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc ;;;-d RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o strsub.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +; By: Jonathan Murphy 2007 + +instr 1 + Smember strget p4 + + ; Parse Smember + istrlen strlen Smember + idelimiter strindex Smember, ":" + + S1 strsub Smember, 0, idelimiter ; "String1" + S2 strsub Smember, idelimiter + 1, istrlen ; "String2" + + printf "First string: %s\nSecond string: %s\n", 1, S1, S2 + +endin + +</CsInstruments> +<CsScore> +i 1 0 1 "String1:String2" +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/subinstr.csd b/examples/subinstr.csd new file mode 100644 index 0000000..c2b8de8 --- /dev/null +++ b/examples/subinstr.csd @@ -0,0 +1,61 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o subinstr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - Creates a basic tone. +instr 1 + ; Print the value of p4, should be equal to + ; Instrument #2's iamp field. + print p4 + + ; Print the value of p5, should be equal to + ; Instrument #2's ipitch field. + print p5 + + ; Create a tone. + asig oscils p4, p5, 0 + + out asig +endin + + +; Instrument #2 - Demonstrates the subinstr opcode. +instr 2 + iamp = 20000 + ipitch = 440 + + ; Use Instrument #1 to create a basic sine-wave tone. + ; Its p4 parameter will be set using the iamp variable. + ; Its p5 parameter will be set using the ipitch variable. + abasic subinstr 1, iamp, ipitch + + ; Output the basic tone that we have created. + out abasic +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #2 for one second. +i 2 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/subinstr_named.csd b/examples/subinstr_named.csd new file mode 100644 index 0000000..44a523c --- /dev/null +++ b/examples/subinstr_named.csd @@ -0,0 +1,62 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o subinstr_named.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument "basic_tone" - Creates a basic tone. +instr basic_tone + ; Print the value of p4, should be equal to + ; Instrument #2's iamp field. + print p4 + + ; Print the value of p5, should be equal to + ; Instrument #2's ipitch field. + print p5 + + ; Create a tone. + asig oscils p4, p5, 0 + + out asig +endin + + +; Instrument #1 - Demonstrates the subinstr opcode. +instr 1 + iamp = 20000 + ipitch = 440 + + ; Use the "basic_tone" named instrument to create a + ; basic sine-wave tone. + ; Its p4 parameter will be set using the iamp variable. + ; Its p5 parameter will be set using the ipitch variable. + abasic subinstr "basic_tone", iamp, ipitch + + ; Output the basic tone that we have created. + out abasic +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/subtracts.csd b/examples/subtracts.csd new file mode 100644 index 0000000..f59a15b --- /dev/null +++ b/examples/subtracts.csd @@ -0,0 +1,33 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o subtracts.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 = 24 - 8 + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/svfilter.csd b/examples/svfilter.csd new file mode 100644 index 0000000..adf7afd --- /dev/null +++ b/examples/svfilter.csd @@ -0,0 +1,62 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o svfilter.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Orchestra file for resonant filter sweep of a sawtooth-like waveform. +; The seperate outputs of the filter are scaled by values from the score, +; and are mixed together. +sr = 44100 +kr = 2205 +ksmps = 20 +nchnls = 1 + +instr 1 + + idur = p3 + ifreq = p4 + iamp = p5 + ilowamp = p6 ; determines amount of lowpass output in signal + ihighamp = p7 ; determines amount of highpass output in signal + ibandamp = p8 ; determines amount of bandpass output in signal + iq = p9 ; value of q + + iharms = (sr*.4) / ifreq + + asig gbuzz 1, ifreq, iharms, 1, .9, 1 ; Sawtooth-like waveform + kfreq linseg 1, idur * 0.5, 4000, idur * 0.5, 1 ; Envelope to control filter cutoff + + alow, ahigh, aband svfilter asig, kfreq, iq + + aout1 = alow * ilowamp + aout2 = ahigh * ihighamp + aout3 = aband * ibandamp + asum = aout1 + aout2 + aout3 + kenv linseg 0, .1, iamp, idur -.2, iamp, .1, 0 ; Simple amplitude envelope + out asum * kenv + +endin + + +</CsInstruments> +<CsScore> + +f1 0 8192 9 1 1 .25 + +i1 0 5 100 1000 1 0 0 5 ; lowpass sweep +i1 5 5 200 1000 1 0 0 30 ; lowpass sweep, octave higher, higher q +i1 10 5 100 1000 0 1 0 5 ; highpass sweep +i1 15 5 200 1000 0 1 0 30 ; highpass sweep, octave higher, higher q +i1 20 5 100 1000 0 0 1 5 ; bandpass sweep +i1 25 5 200 1000 0 0 1 30 ; bandpass sweep, octave higher, higher q +i1 30 5 200 2000 .4 .6 0 ; notch sweep - notch formed by combining highpass and lowpass outputs +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/syncphasor.csd b/examples/syncphasor.csd new file mode 100644 index 0000000..748701e --- /dev/null +++ b/examples/syncphasor.csd @@ -0,0 +1,52 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o abs.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +instr 1 + ; Use two syncphasors - one is the "master", + ; the other the "slave" + + ; master's frequency determines pitch + imastercps = cpspch(p4) + imaxamp = 10000 + + ; the slave's frequency affects the timbre + kslavecps line imastercps, p3, imastercps * 3 + + ; the master "oscillator" + ; the master has no sync input + anosync init 0.0 + am, async syncphasor imastercps, anosync + + ; the slave "oscillator" + aout, as syncphasor kslavecps, async + + adeclick linseg 0.0, 0.05, 1.0, p3 - 0.1, 1.0, 0.05, 0.0 + + ; Output the slave's phase value which is a rising + ; sawtooth wave. This produces aliasing, but hey, this + ; this is just an example ;) + + out aout * adeclick * imaxamp +endin + +</CsInstruments> +<CsScore> + +i1 0 1 7.00 +i1 + 0.5 7.02 +i1 + . 7.05 +i1 + . 7.07 +i1 + . 7.09 +i1 + 2 7.06 + +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/system.csd b/examples/system.csd new file mode 100644 index 0000000..733f3dd --- /dev/null +++ b/examples/system.csd @@ -0,0 +1,54 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac ; -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o system.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 1 +; Waits for command to execute before continuing +ires system_i 1,{{ ps + date + cd ~/Desktop + pwd + ls -l + whois csounds.com + }} +print ires +turnoff +endin + +instr 2 +; Runs command in a separate thread +ires system_i 1,{{ ps + date + cd ~/Desktop + pwd + ls -l + whois csounds.com + }}, 1 + +print ires +turnoff +endin + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for thirty seconds. +i 1 0 1 +i 2 5 1 +e + + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/table.csd b/examples/table.csd new file mode 100644 index 0000000..c1c6599 --- /dev/null +++ b/examples/table.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o table.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Vary our index linearly from 0 to 1. + kndx line 0, p3, 1 + + ; Read Table #1 with our index. + ifn = 1 + ixmode = 1 + kfreq table kndx, ifn, ixmode + + ; Generate a sine waveform, use our table values + ; to vary its frequency. + a1 oscil 20000, kfreq, 2 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a line from 200 to 2,000. +f 1 0 1025 -7 200 1024 2000 +; Table #2, a sine wave. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/table1.inc b/examples/table1.inc new file mode 100644 index 0000000..be5cb98 --- /dev/null +++ b/examples/table1.inc @@ -0,0 +1,4 @@ +/* table1.inc */ +; Table #1, a sine wave. +f 1 0 16384 10 1 +/* table1.inc */ diff --git a/examples/tableng.csd b/examples/tableng.csd new file mode 100644 index 0000000..e6ced1e --- /dev/null +++ b/examples/tableng.csd @@ -0,0 +1,39 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o tableng.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Let's look at Table #1. + ifn = 1 + ilen tableng ifn + + print ilen +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/tablexkt.csd b/examples/tablexkt.csd new file mode 100644 index 0000000..4aff314 --- /dev/null +++ b/examples/tablexkt.csd @@ -0,0 +1,52 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o tablexkt.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> +;Example by Jonathan Murphy + + sr = 44100 + ksmps = 10 + nchnls = 1 + + instr 1 + + ifn = 1 ; query f1 as to number of samples + ilen = nsamp(ifn) + + itrns = 4 ; transpose up 4 octaves + ilps = 16 ; allow iwsize/2 samples at start + ilpe = ilen - 16 ; and at end + imode = 3 ; loop forwards and backwards + istrt = 16 ; start 16 samples into loop + + alphs lphasor itrns, ilps, ilpe, imode, istrt + ; use lphasor as index + andx = alphs + + kfn = 1 ; read f1 + kwarp = 4 ; anti-aliasing, should be same value as itrns above + iwsize = 32 ; iwsize must be at least 8 * kwarp + + atab tablexkt andx, kfn, kwarp, iwsize + + atab = atab * 10000 + + out atab + + endin + +</CsInstruments> + +<CsScore> +f 1 0 262144 1 "beats.wav" 0 4 1 +i1 0 60 +e +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/tambourine.csd b/examples/tambourine.csd new file mode 100644 index 0000000..f3fedd1 --- /dev/null +++ b/examples/tambourine.csd @@ -0,0 +1,32 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o tambourine.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1: An example of a tambourine. +instr 01 + a1 tambourine 15000, 0.01 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/tan.csd b/examples/tan.csd new file mode 100644 index 0000000..0da677b --- /dev/null +++ b/examples/tan.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o tan.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + irad = 25 + i1 = tan(irad) + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/tanh.csd b/examples/tanh.csd new file mode 100644 index 0000000..6732991 --- /dev/null +++ b/examples/tanh.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o tanh.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + irad = 1 + i1 = tanh(irad) + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/taninv.csd b/examples/taninv.csd new file mode 100644 index 0000000..4f410e9 --- /dev/null +++ b/examples/taninv.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o taninv.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + irad = 0.5 + i1 = taninv(irad) + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/taninv2.csd b/examples/taninv2.csd new file mode 100644 index 0000000..ef600c2 --- /dev/null +++ b/examples/taninv2.csd @@ -0,0 +1,35 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o taninv2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Returns the arctangent for 1/2. + i1 taninv2 1, 2 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/tbvcf.csd b/examples/tbvcf.csd new file mode 100644 index 0000000..1820676 --- /dev/null +++ b/examples/tbvcf.csd @@ -0,0 +1,85 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o tbvcf.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +;--------------------------------------------------------- +; TBVCF Test +; Coded by Hans Mikelson December, 2000 +;--------------------------------------------------------- + sr = 44100 ; Sample rate + kr = 4410 ; Kontrol rate + ksmps = 10 ; Samples/Kontrol period + nchnls = 2 ; Normal stereo + zakinit 50, 50 + + instr 10 + + idur = p3 ; Duration + iamp = p4 ; Amplitude + ifqc = cpspch(p5) ; Pitch to frequency + ipanl = sqrt(p6) ; Pan left + ipanr = sqrt(1-p6) ; Pan right + iq = p7 + idist = p8 + iasym = p9 + + kdclck linseg 0, .002, 1, idur-.004, 1, .002, 0 ; Declick envelope + + kfco expseg 10000, idur, 1000 ; Frequency envelope + + ax vco 1, ifqc, 2, 1 ; Square wave + ay tbvcf ax, kfco, iq, idist, iasym ; TB-VCF + ay buthp ay/1, 100 ; Hi-pass + + outs ay*iamp*ipanl*kdclck, ay*iamp*ipanr*kdclck + endin + + +</CsInstruments> +<CsScore> + +f1 0 65536 10 1 + +; TeeBee Test +; Sta Dur Amp Pitch Pan Q Dist1 Asym +i10 0 0.2 32767 7.00 .5 0.0 2.0 0.0 +i10 0.3 0.2 32767 7.00 .5 0.8 2.0 0.0 +i10 0.6 0.2 32767 7.00 .5 1.6 2.0 0.0 +i10 0.9 0.2 32767 7.00 .5 2.4 2.0 0.0 +i10 1.2 0.2 32767 7.00 .5 3.2 2.0 0.0 +i10 1.5 0.2 32767 7.00 .5 4.0 2.0 0.0 +i10 1.8 0.2 32767 7.00 .5 0.0 2.0 0.25 +i10 2.1 0.2 32767 7.00 .5 0.8 2.0 0.25 +i10 2.4 0.2 32767 7.00 .5 1.6 2.0 0.25 +i10 2.7 0.2 32767 7.00 .5 2.4 2.0 0.25 +i10 3.0 0.2 32767 7.00 .5 3.2 2.0 0.25 +i10 3.3 0.2 32767 7.00 .5 4.0 2.0 0.25 +i10 3.6 0.2 32767 7.00 .5 0.0 2.0 0.5 +i10 3.9 0.2 32767 7.00 .5 0.8 2.0 0.5 +i10 4.2 0.2 32767 7.00 .5 1.6 2.0 0.5 +i10 4.5 0.2 32767 7.00 .5 2.4 2.0 0.5 +i10 4.8 0.2 32767 7.00 .5 3.2 2.0 0.5 +i10 5.1 0.2 32767 7.00 .5 4.0 2.0 0.5 +i10 5.4 0.2 32767 7.00 .5 0.0 2.0 0.75 +i10 5.7 0.2 32767 7.00 .5 0.8 2.0 0.75 +i10 6.0 0.2 32767 7.00 .5 1.6 2.0 0.75 +i10 6.3 0.2 32767 7.00 .5 2.4 2.0 0.75 +i10 6.6 0.2 32767 7.00 .5 3.2 2.0 0.75 +i10 6.9 0.2 32767 7.00 .5 4.0 2.0 0.75 +i10 7.2 0.2 32767 7.00 .5 0.0 2.0 1.0 +i10 7.5 0.2 32767 7.00 .5 0.8 2.0 1.0 +i10 7.8 0.2 32767 7.00 .5 1.6 2.0 1.0 +i10 8.1 0.2 32767 7.00 .5 2.4 2.0 1.0 +i10 8.4 0.2 32767 7.00 .5 3.2 2.0 1.0 +i10 8.7 0.2 32767 7.00 .5 4.0 2.0 1.0 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/tempest.csd b/examples/tempest.csd new file mode 100644 index 0000000..8d274c4 --- /dev/null +++ b/examples/tempest.csd @@ -0,0 +1,54 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o tempest.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use the "beats.wav" sound file. + asig soundin "beats.wav" + ; Extract the pitch and the envelope. + kcps, krms pitchamdf asig, 150, 500, 200 + + iprd = 0.01 + imindur = 0.1 + imemdur = 3 + ihp = 1 + ithresh = 30 + ihtim = 0.005 + ixfdbak = 0.05 + istartempo = 110 + ifn = 1 + + ; Estimate its tempo. + k1 tempest krms, iprd, imindur, imemdur, ihp, ithresh, ihtim, ixfdbak, istartempo, ifn + printk2 k1 + + out asig +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a declining line. +f 1 0 128 16 1 128 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/tempo.csd b/examples/tempo.csd new file mode 100644 index 0000000..a8a5b93 --- /dev/null +++ b/examples/tempo.csd @@ -0,0 +1,63 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o tempo.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kval tempoval + + printk 0.1, kval + + ; If the fourth p-field is 1, increase the tempo. + if (p4 == 1) kgoto speedup + kgoto playit + +speedup: + ; Increase the tempo to 150 beats per minute. + tempo 150, 60 + +playit: + + a1 oscil 10000, 440, 1 + out a1 +endin + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; p4 = plays at a faster tempo (when p4=1). +; Play Instrument #1 at the normal tempo, repeat 3 times. +r3 +i 1 00.00 00.25 0 +i 1 00.25 00.25 0 +i 1 00.50 00.25 0 +i 1 00.75 00.25 0 +s + +; Play Instrument #1 at a faster tempo, repeat 3 times. +r3 +i 1 00.00 00.25 1 +i 1 00.25 00.25 0 +i 1 00.50 00.25 0 +i 1 00.75 00.25 0 +s + +e + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/tempoval.csd b/examples/tempoval.csd new file mode 100644 index 0000000..7cdbfa1 --- /dev/null +++ b/examples/tempoval.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o tempoval.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Adjust the tempo to 120 beats per minute. + tempo 120, 60 + + ; Get the tempo value. + kval tempoval + + printks "kval = %f\\n", 0.1, kval +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/timeinstk.csd b/examples/timeinstk.csd new file mode 100644 index 0000000..9b9fc2f --- /dev/null +++ b/examples/timeinstk.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o timeinstk.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the value from timeinstk every half-second. + k1 timeinstk + printks "k1 = %f samples\\n", 0.5, k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/timeinsts.csd b/examples/timeinsts.csd new file mode 100644 index 0000000..c0fd1ea --- /dev/null +++ b/examples/timeinsts.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o timeinsts.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the value from timeinsts every half-second. + k1 timeinsts + printks "k1 = %f seconds\\n", 0.5, k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/timek.csd b/examples/timek.csd new file mode 100644 index 0000000..f6e313f --- /dev/null +++ b/examples/timek.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o timek.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the value from timek every half-second. + k1 timek + printks "k1 = %f samples\\n", 0.5, k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/times.csd b/examples/times.csd new file mode 100644 index 0000000..4b78db7 --- /dev/null +++ b/examples/times.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o times.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print out the value from times every half-second. + k1 times + printks "k1 = %f seconds\\n", 0.5, k1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/trigger.csd b/examples/trigger.csd new file mode 100644 index 0000000..1c6ff00 --- /dev/null +++ b/examples/trigger.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o trigger.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a square-wave low frequency oscillator as the trigger. + klf lfo 1, 10, 3 + ktr trigger klf, 1, 2 + + ; When the value of the trigger isn't equal to 0, print it out. + if (ktr == 0) kgoto contin + ; Print the value of the trigger and the time it occurred. + ktm times + printks "time = %f seconds, trigger = %f\\n", 0, ktm, ktr + +contin: + ; Continue with processing. +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/trirand.csd b/examples/trirand.csd new file mode 100644 index 0000000..de1d800 --- /dev/null +++ b/examples/trirand.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o trirand.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number between -1 and 1. + ; krange = 1 + + i1 trirand 1 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/turnoff.csd b/examples/turnoff.csd new file mode 100644 index 0000000..d07205a --- /dev/null +++ b/examples/turnoff.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o turnoff.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + k1 expon 440, p3/10,880 ; begin gliss and continue + if k1 < sr/2 kgoto contin ; until Nyquist detected + turnoff ; then quit + +contin: + a1 oscil 10000, k1, 1 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1: an ordinary sine wave. +f 1 0 32768 10 1 + +; Play Instrument #1 for 4 seconds. +i 1 0 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/twopeaks.aiff b/examples/twopeaks.aiff Binary files differnew file mode 100644 index 0000000..90eff56 --- /dev/null +++ b/examples/twopeaks.aiff diff --git a/examples/unirand.csd b/examples/unirand.csd new file mode 100644 index 0000000..3db4b12 --- /dev/null +++ b/examples/unirand.csd @@ -0,0 +1,37 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o unirand.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number between 0 and 1. + ; krange = 1 + + i1 unirand 1 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vadd.csd b/examples/vadd.csd new file mode 100644 index 0000000..8dcf6eb --- /dev/null +++ b/examples/vadd.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ival = p5 +ielements = p6 +idstoffset = p7 +kval init 25 +vadd ifn1, ival, ielements, idstoffset, 1 + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +i2 0.0 0.2 1 +i1 0.4 0.01 1 5 3 4 +i2 0.8 0.2 1 +i1 1.0 0.01 1 8 5 -3 +i2 1.2 0.2 1 +i1 1.4 0.01 1 1 10 12 +i2 1.6 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vadd_i.csd b/examples/vadd_i.csd new file mode 100644 index 0000000..64fb385 --- /dev/null +++ b/examples/vadd_i.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ival = p5 +ielements = p6 +idstoffset = p7 +kval init 25 +vadd_i ifn1, ival, ielements, idstoffset + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +i2 0.0 0.2 1 +i1 0.4 0.01 1 2 3 4 +i2 0.8 0.2 1 +i1 1.0 0.01 1 0.5 5 -3 +i2 1.2 0.2 1 +i1 1.4 0.01 1 1.5 10 12 +i2 1.6 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vaddv.csd b/examples/vaddv.csd new file mode 100644 index 0000000..96b25f1 --- /dev/null +++ b/examples/vaddv.csd @@ -0,0 +1,64 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ifn2 = p5 +ielements = p6 +idstoffset = p7 +isrcoffset = p8 +kval init 25 +vaddv ifn1, ifn2, ielements, idstoffset, isrcoffset, 1 + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + +</CsInstruments> +<CsScore> + +f 1 0 16 -7 1 15 16 + +f 2 0 16 -7 1 15 2 + + +i2 0.0 0.2 1 +i2 0.2 0.2 2 +i1 0.4 0.01 1 2 5 3 8 +i2 0.8 0.2 1 +i1 1.0 0.01 1 2 5 10 -2 +i2 1.2 0.2 1 +i1 1.4 0.01 1 2 8 14 0 +i2 1.6 0.2 1 +i1 1.8 0.01 1 2 8 0 14 +i2 2.0 0.2 1 +i1 2.2 0.002 1 1 8 5 2 +i2 2.4 0.2 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vaget.csd b/examples/vaget.csd new file mode 100644 index 0000000..c18d496 --- /dev/null +++ b/examples/vaget.csd @@ -0,0 +1,66 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o avarget.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +sr=44100 +ksmps=16 +nchnls=2 + + instr 1 ; Sqrt Signal +ifreq = (p4 > 15 ? p4 : cpspch(p4)) +iamp = ampdb(p5) + +aout init 0 +ksampnum init 0 + +kenv linseg 0, p3 * .5, 1, p3 * .5, 0 + +aout1 vco2 1, ifreq +aout2 vco2 .5, ifreq * 2 +aout3 vco2 .2, ifreq * 4 + +aout sum aout1, aout2, aout3 + +;Take Sqrt of signal, checking for negatives +kcount = 0 + +loopStart: + + kval vaget kcount,aout + + if (kval > .0) then + kval = sqrt(kval) + elseif (kval < 0) then + kval = sqrt(-kval) * -1 + else + kval = 0 + endif + + vaset kval, kcount,aout + +loop_lt kcount, 1, ksmps, loopStart + +aout = aout * kenv + +aout moogladder aout, 8000, .1 + +aout = aout * iamp + +outs aout, aout + endin + +</CsInstruments> + +<CsScore> + +i1 0.0 2 440 80 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vaset.csd b/examples/vaset.csd new file mode 100644 index 0000000..02ab98b --- /dev/null +++ b/examples/vaset.csd @@ -0,0 +1,55 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o avarset.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +sr=44100 +ksmps=1 +nchnls=2 + + instr 1 ; Sine Wave +ifreq = (p4 > 15 ? p4 : cpspch(p4)) +iamp = ampdb(p5) + +kenv adsr 0.1, 0.05, .9, 0.2 + +aout init 0 +ksampnum init 0 + +kcount = 0 + +iperiod = sr / ifreq + +i2pi = 3.14159 * 2 + +loopStart: + +kphase = (ksampnum % iperiod) / iperiod + +knewval = sin(kphase * i2pi) + + vaset knewval, kcount,aout + + ksampnum = ksampnum + 1 + +loop_lt kcount, 1, ksmps, loopStart + +aout = aout * iamp * kenv + +outs aout, aout + endin + +</CsInstruments> + +<CsScore> + +i1 0.0 2 440 80 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vbap8.csd b/examples/vbap8.csd new file mode 100644 index 0000000..38473e2 --- /dev/null +++ b/examples/vbap8.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +;-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +-o vbap8.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + sr = 41000 + kr = 441 + ksmps = 100 + nchnls = 4 + vbaplsinit 2, 8, 0, 45, 90, 135, 200, 245, 290, 315 + + instr 1 + asig oscil 20000, 440, 1 + a1,a2,a3,a4,a5,a6,a7,a8 vbap8 asig, p4, 0, 20 ;p4 = azimuth + + ;render twice with alternate outq statements + ; to obtain two 4 channel .wav files: + + outq a1,a2,a3,a4 + ; outq a5,a6,a7,a8 +; or use an 8-channel output for realtime output (set nchnls to 8): +; outo a1,a2,a3,a4,a5,a6,a7,a8 + endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +, azimuth +i 1 0 1 20 +i 1 + . 40 +i 1 + . 60 +i 1 + . 80 +i 1 + . 100 +i 1 + . 120 +i 1 + . 140 +i 1 + . 160 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vbap8move.csd b/examples/vbap8move.csd new file mode 100644 index 0000000..f1a1f66 --- /dev/null +++ b/examples/vbap8move.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vbap4move.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 48000 +ksmps = 10 +nchnls = 8 + +;Example by Hector Centeno 2007 + +vbaplsinit 2, 8, 15, 65, 115, 165, 195, 245, 295, 345 + + instr 1 +ifldnum = 9 +ispread = 30 +idur = p3 + +;; Generate a sound source +kenv loopseg 10, 0, 0, 0, 0.5, 1, 10, 0 +a1 pinkish 3000*kenv + +;; Move circling around once all the speakers +aout1, aout2, aout3, aout4, aout5, aout6, aout7, aout8 vbap8move a1, idur, ispread, ifldnum, 15, 65, 115, 165, 195, 245, 295, 345, 15 + +;; Speaker mapping +aFL = aout8 ; Front Left +aFR = aout1 ; Front Right +aMFL = aout7 ; Mid Front Left +aMFR = aout2 ; Mid Front Right +aMBL = aout6 ; Mid Back Left +aMBR = aout3 ; Mid Back Right +aBL = aout5 ; Back Left +aBR = aout4 ; Back Right + +outo aFL, aFR, aMFL, aMFR, aMBL, aMBR, aBL, aBR + + endin + +</CsInstruments> +<CsScore> +i1 0 30 +e +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vcella.csd b/examples/vcella.csd new file mode 100644 index 0000000..daea5e4 --- /dev/null +++ b/examples/vcella.csd @@ -0,0 +1,101 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vcella.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> +; vcella.csd +; by Anthony Kozar + +; This file demonstrates some of the new opcodes available in +; Csound 5 that come from Gabriel Maldonado's CsoundAV. + +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Cellular automata-driven oscillator bank using vcella and adsynt +instr 1 + idur = p3 + iCArate = p4 ; number of times per second the CA calculates new values + + ; f-tables for CA parameters + iCAinit = p5 ; CA initial states + iCArule = p6 ; CA rule values + ; The rule is used as follows: + ; the states (values) of each cell are summed with their neighboring cells within + ; the specied radius (+/- 1 or 2 cells). Each sum is used as an index to read a + ; value from the rule table which becomes the new state value for its cell. + ; All new states are calculated first, then the new values are all applied + ; simultaneously. + + ielements = ftlen(iCAinit) + inumrules = ftlen(iCArule) + iradius = 1 + + ; create some needed tables + iCAstate ftgen 0, 0, ielements, -2, 0 ; will hold the current CA states + ifreqs ftgen 0, 0, ielements, -2, 0 ; will hold the oscillator frequency for each cell + iamps ftgen 0, 0, ielements, -2, 0 ; will hold the amplitude for each cell + + ; calculate cellular automata state + ktrig metro iCArate ; trigger the CA to update iCArate times per second + vcella ktrig, 0, iCAstate, iCAinit, iCArule, ielements, inumrules, iradius + + ; scale CA state for use as amplitudes of the oscillator bank + vcopy iamps, iCAstate, ielements + vmult iamps, (1/3), ielements ; divide by 3 since state values are 0-3 + + vport iamps, .01, ielements ; need to smooth the amplitude changes for adsynt + ; we could use adsynt2 instead of adsynt, but it does not seem to be working + + ; i-time loop for calculating frequencies + index = 0 + inew = 1 + iratio = 1.125 ; just major second (creating a whole tone scale) +loop1: + tableiw inew, index, ifreqs, 0 ; 0 indicates integer indices + inew = inew * iratio + index = index + 1 + if (index < ielements) igoto loop1 + + ; create sound with additive oscillator bank + ifreqbase = 64 + iwavefn = 1 + iphs = 2 ; random oscillator phases + + kenv linseg 0.0, 0.5, 1.0, idur - 1.0, 1.0, 0.5, 0.0 + aosc adsynt kenv, ifreqbase, iwavefn, ifreqs, iamps, ielements, iphs + + out aosc * ampdb(68) +endin + +</CsInstruments> + +<CsScore> +f1 0 16384 10 1 + +; This example uses a 4-state cellular automata +; Possible state values are 0, 1, 2, and 3 + +; CA initial state +; We have 16 cells in our CA, so the initial state table is size 16 +f10 0 16 -2 0 1 0 0 1 0 0 2 2 0 0 1 0 0 1 0 + +; CA rule +; The maximum sum with radius 1 (3 cells) is 9, so we need 10 values in the rule (0-9) +f11 0 16 -2 1 0 3 2 1 0 0 2 1 0 + +; Here is our one and only note! +i1 0 20 4 10 11 + +e + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vco.csd b/examples/vco.csd new file mode 100644 index 0000000..59a1c97 --- /dev/null +++ b/examples/vco.csd @@ -0,0 +1,71 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vco.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 44100 +ksmps = 1 +nchnls = 1 + +; Instrument #1 +instr 1 + ; Set the amplitude. + kamp = p4 + + ; Set the frequency. + kcps = cpspch(p5) + + ; Select the wave form. + iwave = p6 + + ; Set the pulse-width/saw-ramp character. + kpw init 0.5 + + ; Use Table #1. + ifn = 1 + + ; Generate the waveform. + asig vco kamp, kcps, iwave, kpw, ifn + + ; Output and amplification. + out asig +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 65536 10 1 + +; Define the score. +; p4 = raw amplitude (0-32767) +; p5 = frequency, in pitch-class notation. +; p6 = the waveform (1=Saw, 2=Square/PWM, 3=Tri/Saw-Ramp-Mod) +i 1 00 02 20000 05.00 1 +i 1 02 02 20000 05.00 2 +i 1 04 02 20000 05.00 3 + +i 1 06 02 20000 07.00 1 +i 1 08 02 20000 07.00 2 +i 1 10 02 20000 07.00 3 + +i 1 12 02 20000 09.00 1 +i 1 14 02 20000 09.00 2 +i 1 16 02 20000 09.00 3 + +i 1 18 02 20000 11.00 1 +i 1 20 02 20000 11.00 2 +i 1 22 02 20000 11.00 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vco2.csd b/examples/vco2.csd new file mode 100644 index 0000000..f59e14f --- /dev/null +++ b/examples/vco2.csd @@ -0,0 +1,66 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vco2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 10 +nchnls = 1 + +; user defined waveform -1: trapezoid wave with default parameters (can be +; accessed at ftables starting from 10000) +itmp ftgen 1, 0, 16384, 7, 0, 2048, 1, 4096, 1, 4096, -1, 4096, -1, 2048, 0 +ift vco2init -1, 10000, 0, 0, 0, 1 +; user defined waveform -2: fixed table size (4096), number of partials +; multiplier is 1.02 (~238 tables) +itmp ftgen 2, 0, 16384, 7, 1, 4095, 1, 1, -1, 4095, -1, 1, 0, 8192, 0 +ift vco2init -2, ift, 1.02, 4096, 4096, 2 + + instr 1 +kcps expon p4, p3, p5 ; instr 1: basic vco2 example +a1 vco2 12000, kcps ; (sawtooth wave with default + out a1 ; parameters) + endin + + instr 2 +kcps expon p4, p3, p5 ; instr 2: +kpw linseg 0.1, p3/2, 0.9, p3/2, 0.1 ; PWM example +a1 vco2 10000, kcps, 2, kpw + out a1 + endin + + instr 3 +kcps expon p4, p3, p5 ; instr 3: vco2 with user +a1 vco2 14000, kcps, 14 ; defined waveform (-1) +aenv linseg 1, p3 - 0.1, 1, 0.1, 0 ; de-click envelope + out a1 * aenv + endin + + instr 4 +kcps expon p4, p3, p5 ; instr 4: vco2ft example, +kfn vco2ft kcps, -2, 0.25 ; with user defined waveform +a1 oscilikt 12000, kcps, kfn ; (-2), and sr/4 bandwidth + out a1 + endin + + +</CsInstruments> +<CsScore> + +i 1 0 3 20 2000 +i 2 4 2 200 400 +i 3 7 3 400 20 +i 4 11 2 100 200 + +f 0 14 + +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vcomb.csd b/examples/vcomb.csd new file mode 100644 index 0000000..7b5562d --- /dev/null +++ b/examples/vcomb.csd @@ -0,0 +1,75 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc -M0 ;;;RT audio I/O with MIDI in +</CsOptions> +<CsInstruments> + +; Example by Jonathan Murphy and Charles Gran 2007 + sr = 44100 + ksmps = 10 + nchnls = 2 + + ; new, and important. Make sure that midi note events are only + ; received by instruments that actually need them. + + ; turn default midi routing off + massign 0, 0 + ; route note events on channel 1 to instr 1 + massign 1, 1 + +; Define your midi controllers +#define C1 #21# +#define C2 #22# +#define C3 #23# + +; Initialize MIDI controllers + initc7 1, $C1, 0.5 ;delay send + initc7 1, $C2, 0.5 ;delay: time to zero + initc7 1, $C3, 0.5 ;delay: rate + + gaosc init 0 + +; Define an opcode to "smooth" the MIDI controller signal + opcode smooth, k, k + kin xin + kport linseg 0, 0.0001, 0.01, 1, 0.01 + kin portk kin, kport + xout kin + endop + +instr 1 + ; Generate a sine wave at the frequency of the MIDI note that triggered the intrument + ifqc cpsmidi + iamp ampmidi 10000 + aenv linenr iamp, .01, .1, .01 ;envelope + a1 oscil aenv, ifqc, 1 +; All sound goes to the global variable gaosc + gaosc = gaosc + a1 + endin + + instr 198 ; ECHO + kcmbsnd ctrl7 1, $C1, 0, 1 ;delay send + ktime ctrl7 1, $C2, 0.01, 6 ;time loop fades out + kloop ctrl7 1, $C3, 0.01, 1 ;loop speed +; Receive MIDI controller values and then smooth them + kcmbsnd smooth kcmbsnd + ktime smooth ktime + kloop smooth kloop + imaxlpt = 1 ;max loop time +; Create a variable reverberation (delay) of the gaosc signal + acomb vcomb gaosc, ktime, kloop, imaxlpt, 1 + aout = (acomb * kcmbsnd) + gaosc * (1 - kcmbsnd) + outs aout, aout + gaosc = 0 + endin + +</CsInstruments> + +<CsScore> +f1 0 16384 10 1 +i198 0 10000 +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vcopy.csd b/examples/vcopy.csd new file mode 100644 index 0000000..e56d973 --- /dev/null +++ b/examples/vcopy.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer> +<CsOptions>; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vcopy.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + +sr=44100 +kr=4410 +ksmps=10 +nchnls=2 + + instr 1 ;table playback +ar lposcil 1, 1, 0, 262144, 1 +outs ar,ar + endin + + instr 2 +vcopy 2, 1, 20000 ;copy vector from sample to empty table +vmult 5, 20000, 262144 ;scale noise to make it audible +vcopy 1, 5, 20000 ;put noise into sample +turnoff + endin + + instr 3 +vcopy 1, 2, 20000 ;put original information back in +turnoff + endin + +</CsInstruments> +<CsScore> +f1 0 262144 -1 "beats.wav" 0 4 0 +f2 0 262144 2 0 + +f5 0 262144 21 3 30000 + +i1 0 4 +i2 3 1 + +s +i1 0 4 +i3 3 1 +s + +i1 0 4 + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vdivv.csd b/examples/vdivv.csd new file mode 100644 index 0000000..ba100fc --- /dev/null +++ b/examples/vdivv.csd @@ -0,0 +1,64 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ifn2 = p5 +ielements = p6 +idstoffset = p7 +isrcoffset = p8 +kval init 25 +vdivv ifn1, ifn2, ielements, idstoffset, isrcoffset, 1 + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + +</CsInstruments> +<CsScore> + +f 1 0 16 -7 1 15 16 + +f 2 0 16 -7 1 15 2 + + +i2 0.0 0.2 1 +i2 0.2 0.2 2 +i1 0.4 0.01 1 2 5 3 8 +i2 0.8 0.2 1 +i1 1.0 0.01 1 2 5 10 -2 +i2 1.2 0.2 1 +i1 1.4 0.01 1 2 8 14 0 +i2 1.6 0.2 1 +i1 1.8 0.01 1 2 8 0 14 +i2 2.0 0.2 1 +i1 2.2 0.002 1 1 8 5 2 +i2 2.4 0.2 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/veloc.csd b/examples/veloc.csd new file mode 100644 index 0000000..d71a756 --- /dev/null +++ b/examples/veloc.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages MIDI in +-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in +; For Non-realtime ouput leave only the line below: +; -o veloc.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + i1 veloc + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 12 seconds. +i 1 0 12 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vexp.csd b/examples/vexp.csd new file mode 100644 index 0000000..b3ec01f --- /dev/null +++ b/examples/vexp.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ival = p5 +ielements = p6 +idstoffset = p7 +kval init 25 +vexp ifn1, ival, ielements, idstoffset, 1 + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +i2 0.0 0.2 1 +i1 0.4 0.01 1 2 3 4 +i2 0.8 0.2 1 +i1 1.0 0.01 1 0.5 5 -3 +i2 1.2 0.2 1 +i1 1.4 0.01 1 1.5 10 12 +i2 1.6 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vexp_i.csd b/examples/vexp_i.csd new file mode 100644 index 0000000..50e6f28 --- /dev/null +++ b/examples/vexp_i.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ival = p5 +ielements = p6 +idstoffset = p7 +kval init 25 +vexp_i ifn1, ival, ielements, idstoffset + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +i2 0.0 0.2 1 +i1 0.4 0.01 1 2 3 4 +i2 0.8 0.2 1 +i1 1.0 0.01 1 0.5 5 -3 +i2 1.2 0.2 1 +i1 1.4 0.01 1 1.5 10 12 +i2 1.6 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vexpseg.csd b/examples/vexpseg.csd new file mode 100644 index 0000000..40f9f82 --- /dev/null +++ b/examples/vexpseg.csd @@ -0,0 +1,59 @@ +<CsoundSynthesizer> +<CsOptions> +-odac -B441 -b441 +</CsOptions> +<CsInstruments> + + +sr=44100 +ksmps=10 +nchnls=2 + +gilen init 32 + +gitable1 ftgen 0, 0, gilen, 10, 1 +gitable2 ftgen 0, 0, gilen, 10, 1 + +gitable3 ftgen 0, 0, gilen, -7, 30, gilen, 35 +gitable4 ftgen 0, 0, gilen, -7, 400, gilen, 450 +gitable5 ftgen 0, 0, gilen, -7, 5000, gilen, 5500 + +instr 1 +vcopy gitable2, gitable1, gilen +turnoff +endin + +instr 2 +vexpseg gitable2, 16, gitable3, 2, gitable4, 2, gitable5 +endin + +instr 3 +kcount init 0 +if kcount < 16 then + kval table kcount, gitable2 + printk 0,kval + kcount = kcount +1 +else +turnoff +endif + +endin + + +</CsInstruments> +<CsScore> +i1 0 1 +s +i2 0 10 +i3 0 1 +i3 1 1 +i3 1.5 1 +i3 2 1 +i3 2.5 1 +i3 3 1 +i3 3.5 1 +i3 4 1 +i3 4.5 1 + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vexpv.csd b/examples/vexpv.csd new file mode 100644 index 0000000..238473a --- /dev/null +++ b/examples/vexpv.csd @@ -0,0 +1,64 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ifn2 = p5 +ielements = p6 +idstoffset = p7 +isrcoffset = p8 +kval init 25 +vexpv ifn1, ifn2, ielements, idstoffset, isrcoffset, 1 + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +f 2 0 16 -7 0 16 1 + +i2 0.0 0.2 1 +i2 0.2 0.2 2 +i1 0.4 0.01 1 2 5 3 8 +i2 0.8 0.2 1 +i1 1.0 0.01 1 2 5 10 -2 +i2 1.2 0.2 1 +i1 1.4 0.01 1 2 8 14 0 +i2 1.6 0.2 1 +i1 1.8 0.002 1 2 8 0 14 +i2 2.0 0.2 1 +i1 2.2 0.002 1 1 8 5 2 +i2 2.4 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vibes.csd b/examples/vibes.csd new file mode 100644 index 0000000..ec4aaea --- /dev/null +++ b/examples/vibes.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vibes.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; kamp = 20000 + ; kfreq = 440 + ; ihrd = 0.5 + ; ipos = 0.561 + ; imp = 1 + ; kvibf = 6.0 + ; kvamp = 0.05 + ; ivibfn = 2 + ; idec = 0.1 + + a1 vibes 20000, 440, 0.5, 0.561, 1, 6.0, 0.05, 2, 0.1 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, the "marmstk1.wav" audio file. +f 1 0 256 1 "marmstk1.wav" 0 0 0 +; Table #2, a sine wave for the vibrato. +f 2 0 128 10 1 + +; Play Instrument #1 for four seconds. +i 1 0 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vibr.csd b/examples/vibr.csd new file mode 100644 index 0000000..9f1d5b2 --- /dev/null +++ b/examples/vibr.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vibr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create a vibrato waveform. + kaverageamp init 7500 + kaveragefreq init 5 + ifn = 1 + kvamp vibr kaverageamp, kaveragefreq, ifn + + ; Generate a tone including the vibrato. + a1 oscili 10000+kvamp, 440, 2 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave for the vibrato. +f 1 0 256 10 1 +; Table #1, a sine wave for the oscillator. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vibrato.csd b/examples/vibrato.csd new file mode 100644 index 0000000..e0414de --- /dev/null +++ b/examples/vibrato.csd @@ -0,0 +1,54 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vibrato.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Create a vibrato waveform. + kaverageamp init 2500 + kaveragefreq init 6 + krandamountamp init 0.3 + krandamountfreq init 0.5 + kampminrate init 3 + kampmaxrate init 5 + kcpsminrate init 3 + kcpsmaxrate init 5 + ifn = 1 + kvamp vibrato kaverageamp, kaveragefreq, krandamountamp, \ + krandamountfreq, kampminrate, kampmaxrate, \ + kcpsminrate, kcpsmaxrate, ifn + + ; Generate a tone including the vibrato. + a1 oscili 10000+kvamp, 440, 2 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave for the vibrato. +f 1 0 256 10 1 +; Table #1, a sine wave for the oscillator. +f 2 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/virtual.csd b/examples/virtual.csd new file mode 100644 index 0000000..263088c --- /dev/null +++ b/examples/virtual.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions>; Select audio/midi flags here according to platform +; Audio out Audio in Virtual MIDI -M0 is needed anyway +-odac -iadc -+rtmidi=virtual -M0 +</CsOptions> + +<CsInstruments> +; By Mark Jamerson 2007 + +sr=44100 +ksmps=10 +nchnls=2 + +massign 1,1 +prealloc 1,10 + +instr 1 ;Midi FM synth + +inote cpsmidi +iveloc ampmidi 10000 +idur = 2 + xtratim 1 + +kgate oscil 1,10,2 +anoise noise 100*inote,.99 +acps samphold anoise,kgate +aosc oscili 1000,acps,1 +aout = aosc + +; Use controller 7 to control volume +kvol ctrl7 1, 7, 0.2, 1 + +outs kvol * aout, kvol * aout + +endin + +</CsInstruments> + +<CsScore> +f0 3600 +f1 0 1024 10 1 +f2 0 16 7 1 8 0 8 +f3 0 1024 10 1 .5 .6 .3 .2 .5 + +e +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vlinseg.csd b/examples/vlinseg.csd new file mode 100644 index 0000000..c6d70c5 --- /dev/null +++ b/examples/vlinseg.csd @@ -0,0 +1,59 @@ +<CsoundSynthesizer> +<CsOptions> +-odac -B441 -b441 +</CsOptions> +<CsInstruments> + + +sr=44100 +ksmps=10 +nchnls=2 + +gilen init 32 + +gitable1 ftgen 0, 0, gilen, 10, 1 +gitable2 ftgen 0, 0, gilen, 10, 1 + +gitable3 ftgen 0, 0, gilen, -7, 30, gilen, 35 +gitable4 ftgen 0, 0, gilen, -7, 400, gilen, 450 +gitable5 ftgen 0, 0, gilen, -7, 5000, gilen, 5500 + +instr 1 +vcopy gitable2, gitable1, gilen +turnoff +endin + +instr 2 +vlinseg gitable2, 16, gitable3, 2, gitable4, 2, gitable5 +endin + +instr 3 +kcount init 0 +if kcount < 16 then + kval table kcount, gitable2 + printk 0,kval + kcount = kcount +1 +else +turnoff +endif + +endin + + +</CsInstruments> +<CsScore> +i1 0 1 +s +i2 0 10 +i3 0 1 +i3 1 1 +i3 1.5 1 +i3 2 1 +i3 2.5 1 +i3 3 1 +i3 3.5 1 +i3 4 1 +i3 4.5 1 + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vlowres.csd b/examples/vlowres.csd new file mode 100644 index 0000000..803b550 --- /dev/null +++ b/examples/vlowres.csd @@ -0,0 +1,49 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vlowres.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Use a nice sawtooth waveform. + asig vco 32000, 220, 1 + + ; Vary the cutoff frequency from 30 to 300 Hz. + kfco line 30, p3, 300 + kres = 25 + iord = 2 + ksep = 20 + + ; Apply the filters. + avlr vlowres asig, kfco, kres, iord, ksep + + ; It gets loud, so clip the output amplitude to 30,000. + a1 clip avlr, 1, 30000 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vmap.csd b/examples/vmap.csd new file mode 100644 index 0000000..3503649 --- /dev/null +++ b/examples/vmap.csd @@ -0,0 +1,57 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vmap.wav -W ;;; for file output any platform +</CsOptions> + +<CsInstruments> +ksmps = 256 +nchnls = 2 +gisize = 64 + +gitable ftgen 0, 0, gisize, 10, 1 ;Table to be processed +gimap1 ftgen 0, 0, gisize, -7, gisize-1, gisize-1, 0 ; Mapping function to reverse table +gimap2 ftgen 0, 0, gisize, -5, 1, gisize-1, gisize-1 ; Mapping function for PWM +gimap3 ftgen 0, 0, gisize, -7, 1, (gisize/2)-1, gisize-1, 1, 1, (gisize/2)-1, gisize-1 ; Double frequency + +instr 1 ;Hear an oscillator using gitable +asig oscil 10000, 440, gitable +outs asig,asig +endin + +instr 2 ;Reverse the table (no sound change, except for a single click +vmap gimap1, gitable, gisize +vcopy_i gitable, gimap1, gisize +turnoff +endin + +instr 3 ;Non-interpolated PWM (or phase waveshaping) +vmap gimap2, gitable, gisize +vcopy_i gitable, gimap2, gisize +turnoff +endin + +instr 4 ;Double frequency +vmap gimap3, gitable, gisize +vcopy_i gitable, gimap3, gisize +turnoff +endin + + +</CsInstruments> + +<CsScore> +i 1 0 8 + +i 2 2 1 +i 3 4 1 +i 4 6 1 + +e +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/vmult-2.csd b/examples/vmult-2.csd new file mode 100644 index 0000000..993a70b --- /dev/null +++ b/examples/vmult-2.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ival = p5 +ielements = p6 +idstoffset = p7 +kval init 25 +vmult ifn1, ival, ielements, idstoffset, 1 + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +i2 0.0 0.2 1 +i1 0.4 0.01 1 2 3 4 +i2 0.8 0.2 1 +i1 1.0 0.01 1 0.5 5 -3 +i2 1.2 0.2 1 +i1 1.4 0.01 1 1.5 10 12 +i2 1.6 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vmult.csd b/examples/vmult.csd new file mode 100644 index 0000000..2a4dd86 --- /dev/null +++ b/examples/vmult.csd @@ -0,0 +1,52 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + +sr=44100 +kr=4410 +ksmps=10 +nchnls=2 + + instr 1 ;table playback +ar lposcil 1, 1, 0, 262144, 1 +outs ar,ar + endin + + instr 2 +vcopy 2, 1, 40000 ;copy vector from sample to empty table +vmult 5, 10000, 262144 ;scale noise to make it audible +vcopy 1, 5, 40000 ;put noise into sample +turnoff + endin + + instr 3 +vcopy 1, 2, 40000 ;put original information back in +turnoff + endin + +</CsInstruments> +<CsScore> +f1 0 262144 -1 "beats.wav" 0 4 0 +f2 0 262144 2 0 + +f5 0 262144 21 3 30000 + +i1 0 4 +i2 3 1 + +s +i1 0 4 +i3 3 1 +s + +i1 0 4 + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vmult_i.csd b/examples/vmult_i.csd new file mode 100644 index 0000000..a9777fc --- /dev/null +++ b/examples/vmult_i.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ival = p5 +ielements = p6 +idstoffset = p7 +kval init 25 +vmult_i ifn1, ival, ielements, idstoffset + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +i2 0.0 0.2 1 +i1 0.4 0.01 1 2 3 4 +i2 0.8 0.2 1 +i1 1.0 0.01 1 0.5 5 -3 +i2 1.2 0.2 1 +i1 1.4 0.01 1 1.5 10 12 +i2 1.6 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vmultv.csd b/examples/vmultv.csd new file mode 100644 index 0000000..c7962da --- /dev/null +++ b/examples/vmultv.csd @@ -0,0 +1,64 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ifn2 = p5 +ielements = p6 +idstoffset = p7 +isrcoffset = p8 +kval init 25 +vmultv ifn1, ifn2, ielements, idstoffset, isrcoffset, 1 + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +f 2 0 16 -7 1 16 2 + +i2 0.0 0.2 1 +i2 0.2 0.2 2 +i1 0.4 0.01 1 2 5 3 8 +i2 0.8 0.2 1 +i1 1.0 0.01 1 2 5 10 -2 +i2 1.2 0.2 1 +i1 1.4 0.01 1 2 8 14 0 +i2 1.6 0.2 1 +i1 1.8 0.01 1 2 8 0 14 +i2 2.0 0.2 1 +i1 2.2 0.002 1 1 8 5 2 +i2 2.4 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/voice.csd b/examples/voice.csd new file mode 100644 index 0000000..c27c8e8 --- /dev/null +++ b/examples/voice.csd @@ -0,0 +1,50 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o voice.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 22050 +kr = 2205 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 3 + kfreq = 0.8 + kphoneme = 6 + kform = 0.488 + kvibf = 0.04 + kvamp = 1 + ifn = 1 + ivfn = 2 + + av voice kamp, kfreq, kphoneme, kform, kvibf, kvamp, ifn, ivfn + + ; It tends to get loud, so clip voice's amplitude at 30,000. + a1 clip av, 2, 30000 + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, an audio file for the carrier waveform. +f 1 0 256 1 "impuls20.aiff" 0 0 0 +; Table #2, a sine wave for the vibrato waveform. +f 2 0 256 10 1 + +; Play Instrument #1 for a half-second. +i 1 0 0.5 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vpow.csd b/examples/vpow.csd new file mode 100644 index 0000000..9bfa0a5 --- /dev/null +++ b/examples/vpow.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ival = p5 +ielements = p6 +idstoffset = p7 +kval init 25 +vpow ifn1, ival, ielements, idstoffset, 1 + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +i2 0.0 0.2 1 +i1 0.4 0.01 1 2 3 4 +i2 0.8 0.2 1 +i1 1.0 0.01 1 0.5 5 -3 +i2 1.2 0.2 1 +i1 1.4 0.01 1 1.5 10 12 +i2 1.6 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vpow_i.csd b/examples/vpow_i.csd new file mode 100644 index 0000000..bde1863 --- /dev/null +++ b/examples/vpow_i.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ival = p5 +ielements = p6 +idstoffset = p7 +kval init 25 +vpow_i ifn1, ival, ielements, idstoffset + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +i2 0.0 0.2 1 +i1 0.4 0.01 1 2 3 4 +i2 0.8 0.2 1 +i1 1.0 0.01 1 0.5 5 -3 +i2 1.2 0.2 1 +i1 1.4 0.01 1 1.5 10 12 +i2 1.6 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vpowv.csd b/examples/vpowv.csd new file mode 100644 index 0000000..dd4adc1 --- /dev/null +++ b/examples/vpowv.csd @@ -0,0 +1,62 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ifn2 = p5 +ielements = p6 +idstoffset = p7 +isrcoffset = p8 +kval init 25 +vpowv ifn1, ifn2, ielements, idstoffset, isrcoffset, 1 + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + + +</CsInstruments> + +<CsScore> + +f 1 0 16 -7 1 16 17 + +f 2 0 16 -7 1 16 2 + +i2 0.0 0.2 1 +i2 0.2 0.2 2 +i1 0.4 0.01 1 2 5 3 8 +i2 0.8 0.2 1 +i1 1.0 0.01 1 2 5 10 -2 +i2 1.2 0.2 1 +i1 1.4 0.01 1 2 8 14 0 +i2 1.6 0.2 1 +i1 1.8 0.01 1 2 8 0 14 +i2 2.0 0.2 1 +e + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vrandh.csd b/examples/vrandh.csd new file mode 100644 index 0000000..4ebd140 --- /dev/null +++ b/examples/vrandh.csd @@ -0,0 +1,56 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vranh.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +;Example by Andres Cabrera + +sr=44100 +ksmps=128 +nchnls=2 + +gitab ftgen 0, 0, 16, -7, 0, 128, 0 + + +instr 1 + krange init p4 + kcps init p5 + ioffset init p6 + + kav1 init 0 + kav2 init 0 + kcount init 0 + + ; table krange kcps ielements idstoffset iseed isize ioffset + vrandh gitab, krange, kcps, 3, 3, 2, 0, ioffset + + kfreq1 table 3, gitab + kfreq2 table 4, gitab + kfreq3 table 5, gitab + + ;Change the frequency of three oscillators according to the random values + aosc1 oscili 4000, kfreq1, 1 + aosc2 oscili 2000, kfreq2, 1 + aosc3 oscili 4000, kfreq3, 1 + + outs aosc1+aosc2, aosc3+aosc2 +endin + +</CsInstruments> +<CsScore> +f 1 0 1024 10 1 +; krange kcps ioffset +i 1 0 5 100 1 300 +i 1 5 5 300 1 400 +i 1 10 5 100 2 1000 +i 1 15 5 400 4 1000 +i 1 20 5 1000 8 2000 +i 1 25 5 250 16 300 +e + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vrandi.csd b/examples/vrandi.csd new file mode 100644 index 0000000..8e9589e --- /dev/null +++ b/examples/vrandi.csd @@ -0,0 +1,54 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o vrandi.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +sr=44100 +ksmps=128 +nchnls=2 + +;Example by Andres Cabrera + +gitab ftgen 0, 0, 16, -7, 0, 128, 0 + +instr 1 + krange init p4 + kcps init p5 + ioffset init p6 + ; table krange kcps ielements idstoffset iseed isize ioffset + vrandi gitab, krange, kcps, 3, 3, 2, 1, ioffset + + kfreq1 table 3, gitab + kfreq2 table 4, gitab + kfreq3 table 5, gitab + + ;Change the frequency of three oscillators according to the random values + aosc1 oscili 4000, kfreq1, 1 + aosc2 oscili 2000, kfreq2, 1 + aosc3 oscili 4000, kfreq3, 1 + + outs aosc1+aosc2, aosc3+aosc2 +endin + +</CsInstruments> +<CsScore> + +f 1 0 2048 10 1 + +; krange kcps ioffset +i 1 0 5 100 1 300 +i 1 5 5 5 1 400 +i 1 10 5 100 2 1000 +i 1 15 5 400 4 1000 +i 1 20 5 1000 8 2000 +i 1 20 5 300 32 350 + +e + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/vsubv.csd b/examples/vsubv.csd new file mode 100644 index 0000000..f08d4e0 --- /dev/null +++ b/examples/vsubv.csd @@ -0,0 +1,64 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o cigoto.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + + +sr=44100 +ksmps=128 +nchnls=2 + + instr 1 +ifn1 = p4 +ifn2 = p5 +ielements = p6 +idstoffset = p7 +isrcoffset = p8 +kval init 25 +vsubv ifn1, ifn2, ielements, idstoffset, isrcoffset, 1 + endin + + instr 2 ;Printtable +itable = p4 +isize = ftlen(itable) +kcount init 0 +kval table kcount, itable +printk2 kval + +if (kcount == isize) then + turnoff +endif + +kcount = kcount + 1 + endin + +</CsInstruments> +<CsScore> + +f 1 0 16 -7 1 15 16 + +f 2 0 16 -7 1 15 2 + + +i2 0.0 0.2 1 +i2 0.2 0.2 2 +i1 0.4 0.01 1 2 5 3 8 +i2 0.8 0.2 1 +i1 1.0 0.01 1 2 5 10 -2 +i2 1.2 0.2 1 +i1 1.4 0.01 1 2 8 14 0 +i2 1.6 0.2 1 +i1 1.8 0.01 1 2 8 0 14 +i2 2.0 0.2 1 +i1 2.2 0.002 1 1 8 5 2 +i2 2.4 0.2 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vtable1k.csd b/examples/vtable1k.csd new file mode 100644 index 0000000..a2a676a --- /dev/null +++ b/examples/vtable1k.csd @@ -0,0 +1,62 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +</CsOptions> +<CsInstruments> + +sr = 44100 +ksmps = 100 +nchnls = 2 + +giElem init 13 +giOutTab ftgen 1,0,128, 2, 0 +giFreqTab ftgen 2,0,128,-7, 1,giElem, giElem+1 +giSine ftgen 3,0,256,10, 1 + + FLpanel "This Panel contains a Slider Bank",500,400 + FLslidBnk "mod1@mod2@mod3@amp@freq1@freq2@freq3@freqPo", giElem, giOutTab, 360, 600, 100, 10 + FLpanel_end + + FLrun + + instr 1 + +kout1 init 0 +kout2 init 0 +kout3 init 0 +kout4 init 0 +kout5 init 0 +kout6 init 0 +kout7 init 0 +kout8 init 0 + +vtable1k giOutTab, kout1 , kout2, kout3, kout4, kout5 , kout6, kout7, kout8 +kmodindex1= 2 * db(kout1 * 80 ) +kmodindex2= 2 * db(kout2 * 80 ) +kmodindex3= 2 * db(kout3 * 80 ) +kamp = 50 * db(kout4 * 70 ) +kfreq1 = 1.1 * octave(kout5 * 10) +kfreq2 = 1.1 * octave(kout6 * 10) +kfreq3 = 1.1 * octave(kout7 * 10) +kfreq4 = 30 * octave(kout8 * 8) + +amod1 oscili kmodindex1, kfreq1, giSine +amod2 oscili kmodindex2, kfreq2, giSine +amod3 oscili kmodindex3, kfreq3, giSine +aout oscili kamp, kfreq4+amod1+amod2+amod3, giSine + + + outs aout, aout + endin + + +</CsInstruments> +<CsScore> + +i1 0 3600 +f0 3600 + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vtablei.csd b/examples/vtablei.csd new file mode 100644 index 0000000..9fe9b74 --- /dev/null +++ b/examples/vtablei.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +-odac -B441 -b441 +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 100 +ksmps = 441 +nchnls = 2 + +gindx init 0 + + instr 1 +kindex init 0 +ktrig metro 0.5 +if ktrig = 0 goto noevent +event "i", 2, 0, 0.5, kindex +kindex = kindex + 1 +noevent: + + endin + + instr 2 +iout1 init 0 +iout2 init 0 +iout3 init 0 +iout4 init 0 +indx = p4 +vtablei indx, 1, 1, 0, iout1,iout2, iout3, iout4 +print iout1, iout2, iout3, iout4 +turnoff + endin + +</CsInstruments> +<CsScore> +f 1 0 32 10 1 +i 1 0 20 + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vtablek.csd b/examples/vtablek.csd new file mode 100644 index 0000000..3e45008 --- /dev/null +++ b/examples/vtablek.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +-odac -B441 -b441 +</CsOptions> +<CsInstruments> + +sr = 44100 +kr = 100 +ksmps = 441 +nchnls = 2 + +gkindx init -1 + + instr 1 +kindex init 0 +ktrig metro 0.5 +if ktrig = 0 goto noevent +gkindx = gkindx + 1 +noevent: + + endin + + instr 2 +kout1 init 0 +kout2 init 0 +kout3 init 0 +kout4 init 0 +vtablek gkindx, 1, 1, 0, kout1,kout2, kout3, kout4 +printk2 kout1 +printk2 kout2 +printk2 kout3 +printk2 kout4 + endin + +</CsInstruments> +<CsScore> +f 1 0 32 10 1 +i 1 0 20 +i 2 0 20 +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vtablewa.csd b/examples/vtablewa.csd new file mode 100644 index 0000000..e86fc42 --- /dev/null +++ b/examples/vtablewa.csd @@ -0,0 +1,34 @@ +<CsoundSynthesizer> +<CsOptions> +;-ovtablewa.wav -W -b441 -B441 +-odac -b441 -B441 +</CsOptions> +<CsInstruments> + + +sr=44100 +kr=441 +ksmps=100 +nchnls=2 + + instr 1 +ilen = ftlen (1) + +knew1 oscil 10000, 440, 3 +knew2 oscil 15000, 440, 3, 0.5 +kindex phasor 0.3 +asig oscil 1, sr/ilen , 1 +vtablewk kindex*ilen, 1, 0, knew1, knew2 +out asig,asig + endin + + +</CsInstruments> +<CsScore> +f1 0 262144 -1 "beats.aiff" 0 4 0 +f2 0 262144 2 0 +f3 0 1024 10 1 + +i1 0 10 +</CsScore> +</CsoundSynthesizer> diff --git a/examples/vtablewk.csd b/examples/vtablewk.csd new file mode 100644 index 0000000..0d049e9 --- /dev/null +++ b/examples/vtablewk.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +-odac -b441 -B441 +</CsOptions> +<CsInstruments> + + +sr=44100 +kr=4410 +ksmps=10 +nchnls=2 + + instr 1 +vcopy +ar random 0, 1 +vtablewa ar +out ar,ar + endin + + +</CsInstruments> +<CsScore> +f1 0 262144 -1 "beats.wav" 0 4 0 +f2 0 262144 2 0 + + +i1 0 4 +i2 3 1 + +s +i1 0 4 +i3 3 1 +s + +i1 0 4 + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/waveset.csd b/examples/waveset.csd new file mode 100644 index 0000000..e0e6e89 --- /dev/null +++ b/examples/waveset.csd @@ -0,0 +1,44 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o waveset.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - play an audio file. +instr 1 + asig soundin "beats.wav" + out asig +endin + + +; Instrument #2 - stretch the audio file with waveset. +instr 2 + asig soundin "beats.wav" + a1 waveset asig, 2 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for four seconds. +i 2 3 4 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/weibull.csd b/examples/weibull.csd new file mode 100644 index 0000000..66d6a05 --- /dev/null +++ b/examples/weibull.csd @@ -0,0 +1,38 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o weibull.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Generate a random number in a Weibull distribution. + ; ksigma = 1 + ; ktau = 1 + + i1 weibull 1, 1 + + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/wgbow.csd b/examples/wgbow.csd new file mode 100644 index 0000000..c3054bf --- /dev/null +++ b/examples/wgbow.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wgbow.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 31129.60 + kfreq = 440 + kpres = 3.0 + krat = 0.127236 + kvibf = 6.12723 + ifn = 1 + + ; Create an amplitude envelope for the vibrato. + kv linseg 0, 0.5, 0, 1, 1, p3-0.5, 1 + kvamp = kv * 0.01 + + a1 wgbow kamp, kfreq, kpres, krat, kvibf, kvamp, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 128 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/wgbowedbar.csd b/examples/wgbowedbar.csd new file mode 100644 index 0000000..7fe4622 --- /dev/null +++ b/examples/wgbowedbar.csd @@ -0,0 +1,43 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wgbowedbar.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + + instr 1 +; pos = [0, 1] +; bowpress = [1, 10] +; gain = [0.8, 1] +; intr = [0,1] +; trackvel = [0, 1] +; bowpos = [0, 1] + + kb line 0.5, p3, 0.1 + kp line 0.6, p3, 0.7 + kc line 1, p3, 1 + + a1 wgbowedbar p4, cpspch(p5), kb, kp, 0.995, p6, 0 + + out a1 + endin + + +</CsInstruments> +<CsScore> + + i1 0 3 32000 7.00 0 + e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/wgbrass.csd b/examples/wgbrass.csd new file mode 100644 index 0000000..3b0116f --- /dev/null +++ b/examples/wgbrass.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wgbrass.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 31129.60 + kfreq = 440 + ktens = 0.4 + iatt = 0.1 + kvibf = 6.137 + ifn = 1 + + ; Create an amplitude envelope for the vibrato. + kvamp line 0, p3, 0.5 + + a1 wgbrass kamp, kfreq, ktens, iatt, kvibf, kvamp, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 128 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/wgclar.csd b/examples/wgclar.csd new file mode 100644 index 0000000..bab1fe1 --- /dev/null +++ b/examples/wgclar.csd @@ -0,0 +1,47 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wgclar.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp init 31129.60 + kfreq = 440 + kstiff = -0.3 + iatt = 0.1 + idetk = 0.1 + kngain = 0.2 + kvibf = 5.735 + kvamp = 0.1 + ifn = 1 + + a1 wgclar kamp, kfreq, kstiff, iatt, idetk, kngain, kvibf, kvamp, ifn + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/wgflute.csd b/examples/wgflute.csd new file mode 100644 index 0000000..23afa7a --- /dev/null +++ b/examples/wgflute.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wgflute.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + kamp = 31129.60 + kfreq = 440 + kjet = 0.32 + iatt = 0.1 + idetk = 0.1 + kngain = 0.15 + kvibf = 5.925 + kvamp = 0.05 + ifn = 1 + + a1 wgflute kamp, kfreq, kjet, iatt, idetk, kngain, kvibf, kvamp, ifn + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/wgpluck.csd b/examples/wgpluck.csd new file mode 100644 index 0000000..629f14c --- /dev/null +++ b/examples/wgpluck.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wgpluck.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + icps = 220 + iamp = 20000 + kpick = 0.5 + iplk = 0 + idamp = 10 + ifilt = 1000 + + axcite oscil 1, 1, 1 + apluck wgpluck icps, iamp, kpick, iplk, idamp, ifilt, axcite + + out apluck +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/wgpluck2.csd b/examples/wgpluck2.csd new file mode 100644 index 0000000..302f761 --- /dev/null +++ b/examples/wgpluck2.csd @@ -0,0 +1,40 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wgpluck2.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + iplk = 0.75 + kamp = 30000 + icps = 220 + kpick = 0.75 + krefl = 0.5 + + apluck wgpluck2 iplk, kamp, icps, kpick, krefl + + out apluck +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/wgpluck_brighter.csd b/examples/wgpluck_brighter.csd new file mode 100644 index 0000000..b9e90cb --- /dev/null +++ b/examples/wgpluck_brighter.csd @@ -0,0 +1,45 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wgpluck_brighter.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + icps = 220 + iamp = 20000 + kpick = 0.5 + iplk = 0 + idamp = 30 + ifilt = 10 + + axcite oscil 1, 1, 1 + apluck wgpluck icps, iamp, kpick, iplk, idamp, ifilt, axcite + + out apluck +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/wguide1.csd b/examples/wguide1.csd new file mode 100644 index 0000000..f2a5ae7 --- /dev/null +++ b/examples/wguide1.csd @@ -0,0 +1,51 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wguide1.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1 - a simple noise waveform. +instr 1 + ; Generate some noise. + asig noise 20000, 0.5 + + out asig +endin + +; Instrument #2 - a waveguide example. +instr 2 + ; Generate some noise. + asig noise 20000, 0.5 + + ; Run it through a wave-guide model. + kfreq init 200 + kcutoff init 3000 + kfeedback init 0.8 + awg1 wguide1 asig, kfreq, kcutoff, kfeedback + + out awg1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +; Play Instrument #2 for 2 seconds. +i 2 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/wguide2.csd b/examples/wguide2.csd new file mode 100644 index 0000000..31f71cc --- /dev/null +++ b/examples/wguide2.csd @@ -0,0 +1,29 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wguide1.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> +sr = 44100 +nchnls = 2 +instr 1 + afrq line 50, 10, 100 + asig oscil 3000, afrq, 1 + aenv expon 1,10,0.000001 + aexc = aenv*asig + ares wguide2 aexc, 500, 1200, 777, 1500, 0.2, 0.25 + out ares,asig +endin +</CsInstruments> + +<CsScore> +f1 0 4096 10 1 +i1 0 3 +e +</CsScore> + +</CsoundSynthesizer> + diff --git a/examples/wterrain.csd b/examples/wterrain.csd new file mode 100644 index 0000000..fcad993 --- /dev/null +++ b/examples/wterrain.csd @@ -0,0 +1,41 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o wterrain.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +instr 1 +kdclk linseg 0, 0.01, 1, p3-0.02, 1, 0.01, 0 +kcx line 0.1, p3, 1.9 +krx linseg 0.1, p3/2, 0.5, p3/2, 0.1 +kpch line cpspch(p4), p3, p5 * cpspch(p4) +a1 wterrain 10000, kpch, kcx, kcx, -krx, krx, p6, p7 +a1 dcblock a1 + out a1*kdclk +endin + + +</CsInstruments> +<CsScore> + +f1 0 8192 10 1 0 0.33 0 0.2 0 0.14 0 0.11 +f2 0 4096 10 1 + +i1 0 4 7.00 1 1 1 +i1 4 4 6.07 1 1 2 +i1 8 8 6.00 1 2 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/xtratim-2.csd b/examples/xtratim-2.csd new file mode 100644 index 0000000..df2beca --- /dev/null +++ b/examples/xtratim-2.csd @@ -0,0 +1,88 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in Silent MIDI in +-odac -idac -d -M0 ;;;realtime I/O +</CsOptions> + +<CsInstruments> +;xtratim example by Jonathan Murphy Dec. 2006 + + sr = 44100 + ksmps = 32 + nchnls = 2 + + ; sine wave for oscillators +gisin ftgen 1, 0, 4096, 10, 1 + ; set volume initially to midpoint + ctrlinit 1, 7,64 + +;;; simple two oscil, two envelope synth + instr 1 + + ; frequency + kcps cpsmidib + ; initial velocity (noteon) + ivel veloc + + ; master volume + kamp ctrl7 1, 7, 0, 127 + kamp = kamp * ivel + + ; parameters for aenv1 + iatt1 = 0.03 + idec1 = 1 + isus1 = 0.25 + irel1 = 1 + ; parameters for aenv2 + iatt2 = 0.06 + idec2 = 2 + isus2 = 0.5 + irel2 = 2 + + ; extra (release) time allocated + xtratim (irel1>irel2 ? irel1 : irel2) + ; krel is used to trigger envelope release + krel init 0 + krel release + ; if noteoff received, krel == 1, otherwise krel == 0 +if (krel == 1) kgoto rel + + ; attack, decay, sustain segments + atmp1 linseg 0, iatt1, 1, idec1, isus1 , 1, isus1 + atmp2 linseg 0, iatt2, 1, idec2, isus2 , 1, isus2 + aenv1 = atmp1 + aenv2 = atmp2 + kgoto done + + ; release segment +rel: + atmp3 linseg 1, irel1, 0, 1, 0 + atmp4 linseg 1, irel2, 0, 1, 0 + aenv1 = atmp1 * atmp3 ;to go from the current value (in case + aenv2 = atmp2 * atmp4 ;the attack hasn't finished) to the release. + + ; control oscillator amplitude using envelopes +done: + aosc1 oscil aenv1, kcps, 1 + aosc2 oscil aenv2, kcps * 1.5, 1 + aosc1 = aosc1 * kamp + aosc2 = aosc2 * kamp + + ; send aosc1 to left channel, aosc2 to right, + ; release times are noticably different + + outs aosc1, aosc2 + + endin + +</CsInstruments> + +<CsScore> + +f 0 3600 ;dummy table to wait for realtime MIDI events + +</CsScore> + +</CsoundSynthesizer>
\ No newline at end of file diff --git a/examples/xtratim.csd b/examples/xtratim.csd new file mode 100644 index 0000000..ec4a7ab --- /dev/null +++ b/examples/xtratim.csd @@ -0,0 +1,46 @@ +<CsoundSynthesizer> + +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in Silent MIDI in +-odac -idac -d -M0 ;;;realtime I/O +</CsOptions> + +<CsInstruments> +;Simple usage of the xtratim opcode + +instr 1 + + inum notnum + icps cpsmidi + iamp ampmidi 4000 + ; + ;------- complex envelope block ------ + xtratim 1 ;extra-time, i.e. release dur + krel init 0 + krel release ;outputs release-stage flag (0 or 1 values) + if (krel == 1) kgoto rel ;if in release-stage goto release section + ; + ;************ attack and sustain section *********** + kmp1 linseg 0, .03, 1, .05, 1, .07, 0, .08, .5, 4, 1, 50, 1 + kmp = kmp1*iamp + kgoto done + ; + ;--------- release section -------- + rel: + kmp2 linseg 1, .3, .2, .7, 0 + kmp = kmp1*kmp2*iamp + done: + ;------ + a1 oscili kmp, icps, 1 + out a1 + endin + +</CsInstruments> + +<CsScore> +f 0 3600 ;dummy table to wait for realtime MIDI events +e +</CsScore> + +</CsoundSynthesizer> diff --git a/examples/xyin.csd b/examples/xyin.csd new file mode 100644 index 0000000..b43d836 --- /dev/null +++ b/examples/xyin.csd @@ -0,0 +1,59 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc --displays ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o xyin.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Instrument #1. +instr 1 + ; Print and capture values every 0.1 seconds. + iprd = 0.1 + ; The x values are from 1 to 30. + ixmin = 1 + ixmax = 30 + ; The y values are from 1 to 30. + iymin = 1 + iymax = 30 + ; The initial values for X and Y are both 15. + ixinit = 15 + iyinit = 15 + + ; Get the values kx and ky using the xyin opcode. + kx, ky xyin iprd, ixmin, ixmax, iymin, iymax, ixinit, iyinit + + ; Print out the values of kx and ky. + printks "kx=%f, ky=%f\\n", iprd, kx, ky + + ; Play an oscillator, use the x values for amplitude and + ; the y values for frequency. + kamp = kx * 1000 + kcps = ky * 220 + a1 oscil kamp, kcps, 1 + + out a1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 30 seconds. +i 1 0 30 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zacl.csd b/examples/zacl.csd new file mode 100644 index 0000000..cea8b26 --- /dev/null +++ b/examples/zacl.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zacl.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a simple waveform. +instr 1 + ; Generate a simple sine waveform. + asin oscil 20000, 440, 1 + + ; Send the sine waveform to za variable #1. + zaw asin, 1 +endin + +; Instrument #2 -- generates audio output. +instr 2 + ; Read za variable #1. + a1 zar 1 + + ; Generate the audio output. + out a1 + + ; Clear the za variables, get them ready for + ; another pass. + zacl 0, 1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zakinit.csd b/examples/zakinit.csd new file mode 100644 index 0000000..2b4deef --- /dev/null +++ b/examples/zakinit.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zakinit.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 3 a-rate variables and 5 k-rate variables. +zakinit 3, 5 + +; Instrument #1 -- a simple waveform. +instr 1 + ; Generate a simple sine waveform. + asin oscil 20000, 440, 1 + + ; Send the sine waveform to za variable #1. + zaw asin, 1 +endin + +; Instrument #2 -- generates audio output. +instr 2 + ; Read za variable #1. + a1 zar 1 + + ; Generate audio output. + out a1 + + ; Clear the za variables, get them ready for + ; another pass. + zacl 0, 3 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zamod.csd b/examples/zamod.csd new file mode 100644 index 0000000..174d440 --- /dev/null +++ b/examples/zamod.csd @@ -0,0 +1,62 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zamod.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 2 a-rate variables and 2 k-rate variables. +zakinit 2, 2 + +; Instrument #1 -- a simple waveform. +instr 1 + ; Vary an a-rate signal linearly from 20,000 to 0. + asig line 20000, p3, 0 + + ; Send the signal to za variable #1. + zaw asig, 1 +endin + +; Instrument #2 -- generates audio output. +instr 2 + ; Generate a simple sine wave. + asin oscil 1, 440, 1 + + ; Modify the sine wave, multiply its amplitude by + ; za variable #1. + a1 zamod asin, -1 + + ; Generate the audio output. + out a1 + + ; Clear the za variables, prepare them for + ; another pass. + zacl 0, 2 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +; Play Instrument #2 for 2 seconds. +i 2 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zar.csd b/examples/zar.csd new file mode 100644 index 0000000..444fab2 --- /dev/null +++ b/examples/zar.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zar.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a simple waveform. +instr 1 + ; Generate a simple sine waveform. + asin oscil 20000, 440, 1 + + ; Send the sine waveform to za variable #1. + zaw asin, 1 +endin + +; Instrument #2 -- generates audio output. +instr 2 + ; Read za variable #1. + a1 zar 1 + + ; Generate audio output. + out a1 + + ; Clear the za variables, get them ready for + ; another pass. + zacl 0, 1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zarg.csd b/examples/zarg.csd new file mode 100644 index 0000000..7038f9a --- /dev/null +++ b/examples/zarg.csd @@ -0,0 +1,59 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zarg.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a simple waveform. +instr 1 + ; Generate a simple sine waveform, with an amplitude + ; between 0 and 1. + asin oscil 1, 440, 1 + + ; Send the sine waveform to za variable #1. + zaw asin, 1 +endin + +; Instrument #2 -- generates audio output. +instr 2 + ; Read za variable #1, multiply its amplitude by 20,000. + a1 zarg 1, 20000 + + ; Generate audio output. + out a1 + + ; Clear the za variables, get them ready for + ; another pass. + zacl 0, 1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zaw.csd b/examples/zaw.csd new file mode 100644 index 0000000..1a389dc --- /dev/null +++ b/examples/zaw.csd @@ -0,0 +1,58 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zaw.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a simple waveform. +instr 1 + ; Generate a simple sine waveform. + asin oscil 20000, 440, 1 + + ; Send the sine waveform to za variable #1. + zaw asin, 1 +endin + +; Instrument #2 -- generates audio output. +instr 2 + ; Read za variable #1. + a1 zar 1 + + ; Generate the audio output. + out a1 + + ; Clear the za variables, get them ready for + ; another pass. + zacl 0, 1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zawm.csd b/examples/zawm.csd new file mode 100644 index 0000000..ee48431 --- /dev/null +++ b/examples/zawm.csd @@ -0,0 +1,69 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zawm.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a basic instrument. +instr 1 + ; Generate a simple sine waveform. + asin oscil 15000, 440, 1 + + ; Mix the sine waveform with za variable #1. + zawm asin, 1 +endin + +; Instrument #2 -- another basic instrument. +instr 2 + ; Generate another waveform with a different frequency. + asin oscil 15000, 880, 1 + + ; Mix this sine waveform with za variable #1. + zawm asin, 1 +endin + +; Instrument #3 -- generates audio output. +instr 3 + ; Read za variable #1, containing both waveforms. + a1 zar 1 + + ; Generate the audio output. + out a1 + + ; Clear the za variables, get them ready for + ; another pass. + zacl 0, 1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +; Play Instrument #3 for one second. +i 3 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zir.csd b/examples/zir.csd new file mode 100644 index 0000000..7b995f5 --- /dev/null +++ b/examples/zir.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zir.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a simple instrument. +instr 1 + ; Set the zk variable #1 to 32.594. + ziw 32.594, 1 +endin + +; Instrument #2 -- prints out zk variable #1. +instr 2 + ; Read the zk variable #1 at i-rate. + i1 zir 1 + + ; Print out the value of zk variable #1. + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ziw.csd b/examples/ziw.csd new file mode 100644 index 0000000..32a5591 --- /dev/null +++ b/examples/ziw.csd @@ -0,0 +1,48 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ziw.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a simple instrument. +instr 1 + ; Set zk variable #1 to 64.182. + ziw 64.182, 1 +endin + +; Instrument #2 -- prints out zk variable #1. +instr 2 + ; Read zk variable #1 at i-rate. + i1 zir 1 + + ; Print out the value of zk variable #1. + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/ziwm.csd b/examples/ziwm.csd new file mode 100644 index 0000000..0ddb0cf --- /dev/null +++ b/examples/ziwm.csd @@ -0,0 +1,57 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in +-odac -iadc ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o ziwm.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a simple instrument. +instr 1 + ; Add 20.5 to zk variable #1. + ziwm 20.5, 1 +endin + +; Instrument #2 -- another simple instrument. +instr 2 + ; Add 15.25 to zk variable #1. + ziwm 15.25, 1 +endin + +; Instrument #3 -- prints out zk variable #1. +instr 3 + ; Read zk variable #1 at i-rate. + i1 zir 1 + + ; Print out the value of zk variable #1. + ; It should be 35.75 (20.5 + 15.25) + print i1 +endin + + +</CsInstruments> +<CsScore> + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +; Play Instrument #3 for one second. +i 3 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zkcl.csd b/examples/zkcl.csd new file mode 100644 index 0000000..1568b6d --- /dev/null +++ b/examples/zkcl.csd @@ -0,0 +1,62 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zkcl.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a simple waveform. +instr 1 + ; Linearly vary a k-rate signal from 220 to 1760. + kline line 220, p3, 1760 + + ; Add the linear signal to zk variable #1. + zkw kline, 1 +endin + +; Instrument #2 -- generates audio output. +instr 2 + ; Read zk variable #1. + kfreq zkr 1 + + ; Use the value of zk variable #1 to vary + ; the frequency of a sine waveform. + a1 oscil 20000, kfreq, 1 + + ; Generate the audio output. + out a1 + + ; Clear the zk variables, get them ready for + ; another pass. + zkcl 0, 1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for three seconds. +i 1 0 3 +; Play Instrument #2 for three seconds. +i 2 0 3 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zkmod.csd b/examples/zkmod.csd new file mode 100644 index 0000000..525e4bf --- /dev/null +++ b/examples/zkmod.csd @@ -0,0 +1,72 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zkmod.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 2 + +; Initialize the ZAK space. +; Create 2 a-rate variables and 2 k-rate variables. +zakinit 2, 2 + +; Instrument #1 -- a signal with jitter. +instr 1 + ; Generate a k-rate signal goes from 30 to 2,000. + kline line 30, p3, 2000 + + ; Add the signal into zk variable #1. + zkw kline, 1 +endin + +; Instrument #2 -- generates audio output. +instr 2 + ; Create a k-rate signal modulated the jitter opcode. + kamp init 20 + kcpsmin init 40 + kcpsmax init 60 + kjtr jitter kamp, kcpsmin, kcpsmax + + ; Get the frequency values from zk variable #1. + kfreq zkr 1 + ; Add the the frequency values in zk variable #1 to + ; the jitter signal. + kjfreq zkmod kjtr, 1 + + ; Use a simple sine waveform for the left speaker. + aleft oscil 20000, kfreq, 1 + ; Use a sine waveform with jitter for the right speaker. + aright oscil 20000, kjfreq, 1 + + ; Generate the audio output. + outs aleft, aright + + ; Clear the zk variables, prepare them for + ; another pass. + zkcl 0, 2 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 2 seconds. +i 1 0 2 +; Play Instrument #2 for 2 seconds. +i 2 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zkr.csd b/examples/zkr.csd new file mode 100644 index 0000000..ba4bd86 --- /dev/null +++ b/examples/zkr.csd @@ -0,0 +1,62 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zkr.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a simple waveform. +instr 1 + ; Linearly vary a k-rate signal from 440 to 880. + kline line 440, p3, 880 + + ; Add the linear signal to zk variable #1. + zkw kline, 1 +endin + +; Instrument #2 -- generates audio output. +instr 2 + ; Read zk variable #1. + kfreq zkr 1 + + ; Use the value of zk variable #1 to vary + ; the frequency of a sine waveform. + a1 oscil 20000, kfreq, 1 + + ; Generate the audio output. + out a1 + + ; Clear the zk variables, get them ready for + ; another pass. + zkcl 0, 1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for one second. +i 1 0 1 +; Play Instrument #2 for one second. +i 2 0 1 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zkw.csd b/examples/zkw.csd new file mode 100644 index 0000000..e2a024a --- /dev/null +++ b/examples/zkw.csd @@ -0,0 +1,62 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zkw.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a simple waveform. +instr 1 + ; Linearly vary a k-rate signal from 100 to 1,000. + kline line 100, p3, 1000 + + ; Add the linear signal to zk variable #1. + zkw kline, 1 +endin + +; Instrument #2 -- generates audio output. +instr 2 + ; Read zk variable #1. + kfreq zkr 1 + + ; Use the value of zk variable #1 to vary + ; the frequency of a sine waveform. + a1 oscil 20000, kfreq, 1 + + ; Generate the audio output. + out a1 + + ; Clear the zk variables, get them ready for + ; another pass. + zkcl 0, 1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for two seconds. +i 1 0 2 +; Play Instrument #2 for two seconds. +i 2 0 2 +e + + +</CsScore> +</CsoundSynthesizer> diff --git a/examples/zkwm.csd b/examples/zkwm.csd new file mode 100644 index 0000000..4da81f7 --- /dev/null +++ b/examples/zkwm.csd @@ -0,0 +1,75 @@ +<CsoundSynthesizer> +<CsOptions> +; Select audio/midi flags here according to platform +; Audio out Audio in No messages +-odac -iadc -d ;;;RT audio I/O +; For Non-realtime ouput leave only the line below: +; -o zkwm.wav -W ;;; for file output any platform +</CsOptions> +<CsInstruments> + +; Initialize the global variables. +sr = 44100 +kr = 4410 +ksmps = 10 +nchnls = 1 + +; Initialize the ZAK space. +; Create 1 a-rate variable and 1 k-rate variable. +zakinit 1, 1 + +; Instrument #1 -- a basic instrument. +instr 1 + ; Generate a k-rate signal. + ; The signal goes from 30 to 20,000 then back to 30. + kramp linseg 30, p3/2, 20000, p3/2, 30 + + ; Mix the signal into the zk variable #1. + zkwm kramp, 1 +endin + +; Instrument #2 -- another basic instrument. +instr 2 + ; Generate another k-rate signal. + ; This is a low frequency oscillator. + klfo lfo 3500, 2 + + ; Mix this signal into the zk variable #1. + zkwm klfo, 1 +endin + +; Instrument #3 -- generates audio output. +instr 3 + ; Read zk variable #1, containing a mix of both signals. + kamp zkr 1 + + ; Create a sine waveform. Its amplitude will vary + ; according to the values in zk variable #1. + a1 oscil kamp, 880, 1 + + ; Generate the audio output. + out a1 + + ; Clear the zk variable, get it ready for + ; another pass. + zkcl 0, 1 +endin + + +</CsInstruments> +<CsScore> + +; Table #1, a sine wave. +f 1 0 16384 10 1 + +; Play Instrument #1 for 5 seconds. +i 1 0 5 +; Play Instrument #2 for 5 seconds. +i 2 0 5 +; Play Instrument #3 for 5 seconds. +i 3 0 5 +e + + +</CsScore> +</CsoundSynthesizer> |