*csound* Csound Help File ~ This is the Csound Manual formatted as a Vim Help File by Luis Jure, based on the Alternative Csound Reference Manual edited by Kevin Conder. It's available at: http://www.eumus.edu.uy/docentes/jure/csound/vim/ Please report errors in the formatting or suggest improvements to it sending an e-mail to the Csound mailing list, or to this address: lj@eumus.edu.uy Installation ~ Uncompress the file and copy it to $VIMRUNTIME/doc, where all the other help files should be located. Then, as root run the following command from within vim: :helptags $VIMRUNTIME/doc Basic Usage ~ ":he csound" will jump to the top of this document, once there you can navigate in the usual ways. ":he oscil" or any other opcode name jump directly to the entry for that opcode. When the cursor is on an opcode, typing "K" in normal mode also jump directly to the entry for that opcode For further details, see ":he help" Many thanks to Kevin Conder for maintaining the ACRM and allowing me to use it for this project. The original text follows, with all proper credits. ------------------------------------------------------------------------------ The Alternative Csound Reference Manual ~ Barry Vercoe MIT Media Lab Other Contributors Edited by John ffitch Jean Piché Peter Nix Richard Boulanger Rasmus Ekman David Boothe Kevin Conder 4.23-1 Edition Table of Contents ~ |prefacetop| Preface |prefacepreface| Preface to the Csound Manual |prefacecopy| Copyright Notice |prefaceacknowledgements| Acknowledgements |prefacename| Why is this called the Alternative Csound Reference Manual? |prefacescope| What is the scope of the Alternative Csound Reference Manual? |prefacecsoundav| Where is the documentation for the CsoundAV project? |partoverview| Overview |introtop| Introduction |introget| Where to Get Public Csound and the Csound Manual |introinstall| How to Install Csound |introinstalllinux| Linux |introinstallmac| Macintosh |introinstallmsdos| MS-DOS and Windows 95/NT |introinstallwindow| Windows 95/98/2000 |introinstallother| Other Platforms |introlist| The Csound Mailing List |introlistbugs| Bug Reports |commandtop| The Csound Command |commandorder| Order of Precedence |commanddesc| Description |commandflags| Command-line Flags |commandunifile| Unified File Format for Orchestras and Scores |commandpreproc| Score File Preprocessing |commandpreextract| The Extract Feature |commandpreindie| Independent Pre-Processing with Scsort |orchtop| Syntax of the Orchestra |orchdirfiles| Directories and Files |orchnomen| Nomenclature |orchstatemnt| Orchestra Statement Types |orchkvar| Constants and Variables |orchexpress| Expressions |orchheader| Orchestra Header Statements |orchiblock| Instrument Block Statements |orchvarinit| Variable Initialization |controltop| Instrument Control |controlclockctl| Clock Control |controlconditional| Conditional Values |controldurctl| Duration Control Statements |controlfltkintro| Introduction to FLTK Widgets and GUI controllers |controlfltkcontainers| FLTK Containers |controlfltkvaluators| FLTK Valuators |controlfltkother| Other FLTK Widgets |controlfltkappearance| Modifying FLTK Widget Appearance |controlfltkgeneral| General FLTK Widget-related Opcodes |controlfltksliderbank| FLTK Slider Bank |controlinvocat| Instrument Invocation |controlmacros| Macros |controlpgmctl| Program Flow Control |controlrealtime| Real-time Performance Control |controlreinitn| Reinitialization |controlsensing| Sensing and Control |controlsubinstrument| Sub-instrument Control |controltimeread| Time Reading |tabletop| Function Table Control |tablequeries| Table Queries |tablereadwrit| Read/Write Operations |tableselect| Table Selection |mathtop| Mathematical Operations |mathamp| Amplitude Converters |mathartlogic| Arithmetic and Logic Operations |mathmatfunc| Mathematical Functions |mathopeqfunc| Opcode Equivalents of Functions |mathrndfunc| Random Functions |mathtrig| Trigonometric Functions |miditop| MIDI Support |midicontrol| Controller Input |midiconvert| Converters |midiextender| Event Extenders |midigeneric| Generic Input and Output |midionoff| Note-on/Note-off |midioutput| MIDI Message Output |midirealtime| Real-time Messages |midislidrbk| Slider Banks |pitchtop| Pitch Converters |pitchfuncs| Functions |pitchtuning| Tuning Opcodes |siggentop| Signal Generators |siggenadditive| Additive Synthesis/Resynthesis |siggenbasic| Basic Oscillators |siggendynamic| Dynamic Spectrum Oscillators |siggenfmsynth| FM Synthesis |siggengranular| Granular Synthesis |siggenlineexp| Linear and Exponential Generators |siggenlpcresyn| Linear Predictive Coding (LPC) Resynthesis |siggenmodels| Models and Emulations |siggenphasors| Phasors |siggennoise| Random (Noise) Generators |siggensample| Sample Playback |siggenscantop| Scanned Synthesis |siggenstft| Short-time Fourier Transform (STFT) Resynthesis |siggentableacc| Table Access |siggenwaveterr| Wave Terrain Synthesis |siggenwavguide| Waveguide Physical Modeling |sigiotop| Signal Input and Output |sigiofileio| File Input and Output |sigioinput| Input |sigiooutput| Output |sigiopdisplay| Printing and Display |sigioqueries| Sound File Queries |sigmodtop| Signal Modifiers |sigmodampmod| Amplitude Modifiers |sigmodconmorph| Convolution and Morphing |sigmoddelay| Delay |sigmodenvelope| Envelope Modifiers |sigmodpanspatl| Panning and Spatialization |sigmodreverbtn| Reverberation |sigmodsample| Sample Level Operators |sigmodsiglimit| Signal Limiters |sigmodspeciale| Special Effects |sigmodspeciali| Specialized Filters |sigmodstandard| Standard Filters |sigmodwavguide| Waveguides |spectraltop| Spectral Processing |spectralnonstand| Non-standard Spectral Processing |spectralrealtime| Tools for Real-time Spectral Processing |zaktop| Zak Patch System |scoretop| The Standard Numeric Score |scorepreproc| Preprocessing of Standard Scores |scorecarry| Carry |scoretempo| Tempo |scoresort| Sort |scorenb| N.B. |scorenextp| Next-P and Previous-P Symbols |scoreramping| Ramping |scoremacros| Score Macros |mult| Multiple File Score |scoreeval| Evaluation of Expressions |scorestatements| Score Statements |scoresinegen| Sine/Cosine Generators |scoreseggen| Line/Exponential Segment Generators |scorefilegen| File Access GEN Routines |scorenumgen| Numeric Value Access GEN Routines |scorewingen| Window Function GEN Routines |scorerandgen| Random Function GEN Routines |scorewavegen| Waveshaping GEN Routines |scoreampgen| Amplitude Scaling GEN Routines |scoremixgen| Mixing GEN Routines |partreference| Reference |opcodestop| Orchestra Opcodes and Operators |notequal| != -- Determines if one value is not equal to another. |define| #define -- Defines a macro. |include| #include -- Includes an external file for processing. |undef| #undef -- Un-defines a macro. |dollar| $NAME -- Calls a defined macro. |modulus| % -- Modulus operator. |opand| && -- Logical AND operator. |greaterthan| > -- Determines if one value is greater than another. |greaterequal| >= -- Determines if one value is greater than or equal to another. |lessthan| < -- Determines if one value is less than another. |lessequal| <= -- Determines if one value is less than or equal to another. |multiplies| * -- Multiplication operator. |adds| + -- Addition operator |subtracts| - -- Subtraction operator. |divides| / -- Division operator. |assign| = -- Performs a simple assignment. |equals| == -- Compares two values for equality. |raises| ^ -- "Power of" operator. |opor| || -- Logical OR operator. |zerodbfs| 0dbfs -- Sets the value of 0 decibels using full scale amplitude. |opa| a -- Converts a k-rate parameter to an a-rate value with interpolation. |abetarand| abetarand -- Deprecated. |abexprnd| abexprnd -- Deprecated. |abs| abs -- Returns an absolute value. |acauchy| acauchy -- Deprecated. |active| active -- Returns the number of active instances of an instrument. |adsr| adsr -- Calculates the classical ADSR envelope using linear segments. |adsyn| adsyn -- Output is an additive set of individually controlled sinusoids, using an oscillator bank. |adsynt| adsynt -- Performs additive synthesis with an arbitrary number of partials, not necessarily harmonic. |aexprand| aexprand -- Deprecated. |aftouch| aftouch -- Get the current after-touch value for this channel. |agauss| agauss -- Deprecated. |agogobel| agogobel -- Deprecated. |alinrand| alinrand -- Deprecated. |alpass| alpass -- Reverberates an input signal with a flat frequency response. |ampdb| ampdb -- Returns the amplitude equivalent of the decibel value x. |ampdbfs| ampdbfs -- Returns the amplitude equivalent of the decibel value x, which is relative to full scale amplitude. |ampmidi| ampmidi -- Get the velocity of the current MIDI event. |apcauchy| apcauchy -- Deprecated. |apoisson| apoisson -- Deprecated. |apow| apow -- Deprecated. |areson| areson -- A notch filter whose transfer functions are the complements of the reson opcode. |aresonk| aresonk -- A notch filter whose transfer functions are the complements of the reson opcode. |atone| atone -- A notch filter whose transfer functions are the complements of the tone opcode. |atonek| atonek -- A notch filter whose transfer functions are the complements of the tone opcode. |atonex| atonex -- Emulates a stack of filters using the atone opcode. |atrirand| atrirand -- Deprecated. |aunirand| aunirand -- Deprecated. |aweibull| aweibull -- Deprecated. |babo| babo -- A physical model reverberator. |balance| balance -- Adjust one audio signal according to the values of another. |bamboo| bamboo -- Semi-physical model of a bamboo sound. |bbcutm| bbcutm -- Generates breakbeat-style cut-ups of a mono audio stream. |bbcuts| bbcuts -- Generates breakbeat-style cut-ups of a stereo audio stream. |betarand| betarand -- Beta distribution random number generator (positive values only). |bexprnd| bexprnd -- Exponential distribution random number generator. |biquad| biquad -- A sweepable general purpose biquadratic digital filter. |biquada| biquada -- A sweepable general purpose biquadratic digital filter with a-rate parameters. |birnd| birnd -- Returns a random number in a bi-polar range. |bqrez| bqrez -- A second-order multi-mode filter. |butbp| butbp -- Same as the butterbp opcode. |butbr| butbr -- Same as the butterbr opcode. |buthp| buthp -- Same as the butterhp opcode. |butlp| butlp -- Same as the butterlp opcode. |butterbp| butterbp -- A band-pass Butterworth filter. |butterbr| butterbr -- A band-reject Butterworth filter. |butterhp| butterhp -- A high-pass Butterworth filter. |butterlp| butterlp -- A low-pass Butterworth filter. |button| button -- Sense on-screen controls. |buzz| buzz -- Output is a set of harmonically related sine partials. |cabasa| cabasa -- Semi-physical model of a cabasa sound. |cauchy| cauchy -- Cauchy distribution random number generator. |cent| cent -- Calculates a factor to raise/lower a frequency by a given amount of cents. |cggoto| cggoto -- Conditionally transfer control on every pass. |chanctrl| chanctrl -- Get the current value of a MIDI channel controller. |checkbox| checkbox -- Sense on-screen controls. |cigoto| cigoto -- Conditionally transfer control during the i-time pass. |ckgoto| ckgoto -- Conditionally transfer control during the p-time passes. |clear| clear -- Zeroes a list of audio signals. |clfilt| clfilt -- Implements low-pass and high-pass filters of different styles. |clip| clip -- Clips a signal to a predefined limit. |clock| clock -- Deprecated. |clockoff| clockoff -- Stops one of a number of internal clocks. |clockon| clockon -- Starts one of a number of internal clocks. |cngoto| cngoto -- Transfers control on every pass when a condition is not true. |comb| comb -- Reverberates an input signal with a "colored" frequency response. |control| control -- Configurable slider controls for realtime user input. |convle| convle -- Same as the convolve opcode. |convolve| convolve -- Convolves a signal and an impulse response. |cos| cos -- Performs a cosine function. |cosh| cosh -- Performs a hyperbolic cosine function. |cosinv| cosinv -- Performs a arccosine function. |cps2pch| cps2pch -- Converts a pitch-class value into cycles-per-second for equal divisions of the octave. |cpsmidi| cpsmidi -- Get the note number of the current MIDI event, expressed in cycles-per-second. |cpsmidib| cpsmidib -- Get the note number of the current MIDI event and modify it by the current pitch-bend value, express it in cycles-per-second. |cpsoct| cpsoct -- Converts an octave-point-decimal value to cycles-per-second. |cpspch| cpspch -- Converts a pitch-class value to cycles-per-second. |cpstmid| cpstmid -- Get a MIDI note number (allows customized micro-tuning scales). |cpstun| cpstun -- Returns micro-tuning values at k-rate. |cpstuni| cpstuni -- Returns micro-tuning values at init-rate. |cpsxpch| cpsxpch -- Converts a pitch-class value into cycles-per-second (Hz) for equal divisions of any interval. |cpuprc| cpuprc -- Control allocation of cpu resources on a per-instrument basis, to optimize realtime output. |cross2| cross2 -- Cross synthesis using FFT's. |crunch| crunch -- Semi-physical model of a crunch sound. |ctrl14| ctrl14 -- Allows a floating-point 14-bit MIDI signal scaled with a minimum and a maximum range. |ctrl21| ctrl21 -- Allows a floating-point 21-bit MIDI signal scaled with a minimum and a maximum range. |ctrl7| ctrl7 -- Allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range. |ctrlinit| ctrlinit -- Sets the initial values for a set of MIDI controllers. |cuserrnd| cuserrnd -- Continuous USER-defined-distribution RaNDom generator. |dam| dam -- A dynamic compressor/expander. |db| db -- Returns the amplitude equivalent for a given decibel amount. |dbamp| dbamp -- Returns the decibel equivalent of the raw amplitude x. |dbfsamp| dbfsamp -- Returns the decibel equivalent of the raw amplitude x, relative to full scale amplitude. |dcblock| dcblock -- A DC blocking filter. |dconv| dconv -- A direct convolution opcode. |delay| delay -- Delays an input signal by some time interval. |delay1| delay1 -- Delays an input signal by one sample. |delayr| delayr -- Reads from an automatically established digital delay line. |delayw| delayw -- Writes the audio signal to a digital delay line. |deltap| deltap -- Taps a delay line at variable offset times. |deltap3| deltap3 -- Taps a delay line at variable offset times, uses cubic interpolation. |deltapi| deltapi -- Taps a delay line at variable offset times, uses interpolation. |deltapn| deltapn -- Taps a delay line at variable offset times. |deltapx| deltapx -- Read to or write from a delay line with interpolation. |deltapxw| deltapxw -- Mixes the input signal to a delay line. |diff| diff -- Modify a signal by differentiation. |diskin| diskin -- Reads audio data from an external device or stream and can alter its pitch. |dispfft| dispfft -- Displays the Fourier Transform of an audio or control signal. |display| display -- Displays the audio or control signals as an amplitude vs. time graph. |distort1| distort1 -- Modified hyperbolic tangent distortion. |divz| divz -- Safely divides two numbers. |downsamp| downsamp -- Modify a signal by down-sampling. |dripwater| dripwater -- Semi-physical model of a water drop. |dumpk| dumpk -- Periodically writes an orchestra control-signal value to an external file. |dumpk2| dumpk2 -- Periodically writes two orchestra control-signal values to an external file. |dumpk3| dumpk3 -- Periodically writes three orchestra control-signal values to an external file. |dumpk4| dumpk4 -- Periodically writes four orchestra control-signal values to an external file. |duserrnd| duserrnd -- Discrete USER-defined-distribution RaNDom generator. |else| else -- Executes a block of code when an "if...then" condition is false. |elseif| elseif -- Defines another "if...then" condition when a "if...then" condition is false. |endif| endif -- Closes a block of code that begins with an "if...then" statement. |endin| endin -- Ends the current instrument block. |endop| endop -- Marks the end of an user-defined opcode block. |envlpx| envlpx -- Applies an envelope consisting of 3 segments. |envlpxr| envlpxr -- The envlpx opcode with a final release segment. |event| event -- Generates a score event from an instrument. |exp| exp -- Returns e raised to the x-th power. |expon| expon -- Trace an exponential curve between specified points. |exprand| exprand -- Exponential distribution random number generator (positive values only). |expseg| expseg -- Trace a series of exponential segments between specified points. |expsega| expsega -- An exponential segment generator operating at a-rate. |expsegr| expsegr -- Trace a series of exponential segments between specified points including a release segment. |filelen| filelen -- Returns the length of a sound file. |filenchnls| filenchnls -- Returns the number of channels in a sound file. |filepeak| filepeak -- Returns the peak absolute value of a sound file. |filesr| filesr -- Returns the sample rate of a sound file. |filter2| filter2 -- Performs filtering using a transposed form-II digital filter lattice with no time-varying control. |fin| fin -- Read signals from a file at a-rate. |fini| fini -- Read signals from a file at i-rate. |fink| fink -- Read signals from a file at k-rate. |fiopen| fiopen -- Opens a file in a specific mode. |flanger| flanger -- A user controlled flanger. |flashtxt| flashtxt -- Allows text to be displayed from instruments like sliders |flbox| FLbox -- A FLTK widget that displays text inside of a box. |flbutbank| FLbutBank -- A FLTK widget opcode that creates a bank of buttons. |flbutton| FLbutton -- A FLTK widget opcode that creates a button. |flcolor| FLcolor -- A FLTK opcode that sets the primary colors. |flcolor2| FLcolor2 -- A FLTK opcode that sets the secondary (selection) color. |flcount| FLcount -- A FLTK widget opcode that creates a counter. |flgetsnap| FLgetsnap -- Retrieves a previously stored FLTK snapshot. |flgroup| FLgroup -- A FLTK container opcode that groups child widgets. |flgroupend| FLgroupEnd -- Marks the end of a group of FLTK child widgets. |flhide| FLhide -- Hides the target FLTK widget. |fljoy| FLjoy -- A FLTK opcode that acts like a joystick. |flkeyb| FLkeyb -- Experimental, no documentation exists. May be deprecated in future versions. |flknob| FLknob -- A FLTK widget opcode that creates a knob. |fllabel| FLlabel -- A FLTK opcode that modifies the appearance of a text label. |flloadsnap| FLloadsnap -- Loads all snapshots into the memory bank of the current orchestra. |flpack| FLpack -- Provides the functionality of compressing and aligning FLTK widgets. |flpackend| FLpackEnd -- Marks the end of a group of compressed or aligned FLTK widgets. |flpanel| FLpanel -- Creates a window that contains FLTK widgets. |flpanelend| FLpanelEnd -- Marks the end of a group of FLTK widgets contained inside of a window (panel). |flprintk| FLprintk -- A FLTK opcode that prints a k-rate value at specified intervals. |flprintk2| FLprintk2 -- A FLTK opcode that prints a new value every time a control-rate variable changes. |flroller| FLroller -- A FLTK widget that creates a transversal knob. |flrun| FLrun -- Starts the FLTK widget thread. |flsavesnap| FLsavesnap -- Saves all snapshots currently created into a file. |flscroll| FLscroll -- A FLTK opcode that adds scroll bars to an area. |flscrollend| FLscrollEnd -- A FLTK opcode that marks the end of an area with scrollbars. |flsetalign| FLsetAlign -- Sets the text alignment of a label of a FLTK widget. |flsetbox| FLsetBox -- Sets the appearance of a box surrounding a FLTK widget. |flsetcolor| FLsetColor -- Sets the primary color of a FLTK widget. |flsetcolor2| FLsetColor2 -- Sets the secondary (or selection) color of a FLTK widget. |flsetfont| FLsetFont -- Sets the font type of a FLTK widget. |flsetposition| FLsetPosition -- Sets the position of a FLTK widget. |flsetsize| FLsetSize -- Resizes a FLTK widget. |flsetsnap| FLsetsnap -- Stores the current status of all FLTK valuators into a snapshot location. |flsettext| FLsetText -- Sets the label of a FLTK widget. |flsettextcolor| FLsetTextColor -- Sets the color of the text label of a FLTK widget. |flsettextsize| FLsetTextSize -- Sets the size of the text label of a FLTK widget. |flsettexttype| FLsetTextType -- Sets some font attributes of the text label of a FLTK widget. |flsetvali| FLsetVal_i -- Sets the value of a FLTK valuator to a number provided by the user. |flsetval| FLsetVal -- Sets the value of a FLTK valuator at control-rate. |flshow| FLshow -- Restores the visibility of a previously hidden FLTK widget. |flslidbnk| FLslidBnk -- A FLTK widget containing a bank of horizontal sliders. |flslider| FLslider -- Puts a slider into the corresponding FLTK container. |fltabs| FLtabs -- Creates a tabbed FLTK interface. |fltabsend| FLtabsEnd -- Marks the end of a tabbed FLTK interface. |fltext| FLtext -- A FLTK widget opcode that creates a textbox. |flupdate| FLupdate -- Same as the FLrun opcode. |flvalue| FLvalue -- Shows the current value of a FLTK valuator. |fmb3| fmb3 -- Uses FM synthesis to create a Hammond B3 organ sound. |fmbell| fmbell -- Uses FM synthesis to create a tublar bell sound. |fmmetal| fmmetal -- Uses FM synthesis to create a "Heavy Metal" sound. |fmpercfl| fmpercfl -- Uses FM synthesis to create a percussive flute sound. |fmrhode| fmrhode -- Uses FM synthesis to create a Fender Rhodes electric piano sound. |fmvoice| fmvoice -- FM Singing Voice Synthesis |fmwurlie| fmwurlie -- Uses FM synthesis to create a Wurlitzer electric piano sound. |fof| fof -- Produces sinusoid bursts useful for formant and granular synthesis. |fof2| fof2 -- Produces sinusoid bursts including k-rate incremental indexing with each successive burst. |fog| fog -- Audio output is a succession of grains derived from data in a stored function table |fold| fold -- Adds artificial foldover to an audio signal. |follow| follow -- Envelope follower unit generator. |follow2| follow2 -- Another controllable envelope extractor. |foscil| foscil -- A basic frequency modulated oscillator. |foscili| foscili -- Basic frequency modulated oscillator with linear interpolation. |fout| fout -- Outputs a-rate signals to an arbitrary number of channels. |fouti| fouti -- Outputs i-rate signals of an arbitrary number of channels to a specified file. |foutir| foutir -- Outputs i-rate signals from an arbitrary number of channels to a specified file. |foutk| foutk -- Outputs k-rate signals of an arbitrary number of channels to a specified file. |fprintks| fprintks -- Similar to printks but prints to a file. |fprints| fprints -- Similar to prints but prints to a file. |frac| frac -- Returns the fractional part of a decimal number. |ftchnls| ftchnls -- Returns the number of channels in a stored function table. |ftgen| ftgen -- Generate a score function table from within the orchestra. |ftlen| ftlen -- Returns the size of a stored function table. |ftload| ftload -- Load a set of previously-allocated tables from a file. |ftloadk| ftloadk -- Load a set of previously-allocated tables from a file. |ftlptim| ftlptim -- Returns the loop segment start-time of a stored function table number. |ftmorf| ftmorf -- Morphs between multiple ftables as specified in a list. |ftsave| ftsave -- Save a set of previously-allocated tables to a file. |ftsavek| ftsavek -- Save a set of previously-allocated tables to a file. |ftsr| ftsr -- Returns the sampling-rate of a stored function table. |gain| gain -- Adjusts the amplitude audio signal according to a root-mean-square value. |gauss| gauss -- Gaussian distribution random number generator. |gbuzz| gbuzz -- Output is a set of harmonically related cosine partials. |gogobel| gogobel -- Audio output is a tone related to the striking of a cow bell or similar. |goto| goto -- Transfer control on every pass. |grain| grain -- Generates granular synthesis textures. |grain2| grain2 -- Easy-to-use granular synthesis texture generator. |grain3| grain3 -- Generate granular synthesis textures with more user control. |granule| granule -- A more complex granular synthesis texture generator. |guiro| guiro -- Semi-physical model of a guiro sound. |harmon| harmon -- Analyze an audio input and generate harmonizing voices in synchrony. |hilbert| hilbert -- A Hilbert transformer. |hrtfer| hrtfer -- Creates 3D audio for two speakers. |hsboscil| hsboscil -- An oscillator which takes tonality and brightness as arguments. |opi| i -- Returns an init-type equivalent of a k-rate argument. |ibetarand| ibetarand -- Deprecated. |ibexprnd| ibexprnd -- Deprecated. |icauchy| icauchy -- Deprecated. |ictrl14| ictrl14 -- Deprecated. |ictrl21| ictrl21 -- Deprecated. |ictrl7| ictrl7 -- Deprecated. |iexprand| iexprand -- Deprecated. |if| if -- Branches conditionally at initialization or during performance time. |igauss| igauss -- Deprecated. |igoto| igoto -- Transfer control during the i-time pass. |ihold| ihold -- Creates a held note. |ilinrand| ilinrand -- Deprecated. |imidic14| imidic14 -- Deprecated. |imidic21| imidic21 -- Deprecated. |imidic7| imidic7 -- Deprecated. |in| in -- Reads mono audio data from an external device or stream. |in32| in32 -- Reads a 32-channel audio signal from an external device or stream. |inch| inch -- Reads from a numbered channel in an external audio signal or stream. |inh| inh -- Reads six-channel audio data from an external device or stream. |init| init -- Puts the value of the i-time expression into a k- or a-rate variable. |initc14| initc14 -- Initializes the controllers used to create a 14-bit MIDI value. |initc21| initc21 -- Initializes the controllers used to create a 21-bit MIDI value. |initc7| initc7 -- Initializes the controller used to create a 7-bit MIDI value. |ink| ink -- Passes k-rate values into a sub-instrument. |ino| ino -- Reads eight-channel audio data from an external device or stream. |inq| inq -- Reads quad audio data from an external device or stream. |ins| ins -- Reads stereo audio data from an external device or stream. |instimek| instimek -- Deprecated. |instimes| instimes -- Deprecated. |instr| instr -- Starts an instrument block. |int| int -- Extracts an integer from a decimal number. |integ| integ -- Modify a signal by integration. |interp| interp -- Converts a control signal to an audio signal using linear interpolation. |invalue| invalue -- Reads a k-rate signal from a user-defined channel. |inx| inx -- Reads a 16-channel audio signal from an external device or stream. |inz| inz -- Reads multi-channel audio samples into a ZAK array from an external device or stream. |ioff| ioff -- Deprecated. |ion| ion -- Deprecated. |iondur| iondur -- Deprecated. |iondur2| iondur2 -- Deprecated. |ioutat| ioutat -- Deprecated. |ioutc| ioutc -- Deprecated. |ioutc14| ioutc14 -- Deprecated. |ioutpat| ioutpat -- Deprecated. |ioutpb| ioutpb -- Deprecated. |ioutpc| ioutpc -- Deprecated. |ipcauchy| ipcauchy -- Deprecated. |ipoisson| ipoisson -- Deprecated. |ipow| ipow -- Deprecated. |is16b14| is16b14 -- Deprecated. |is32b14| is32b14 -- Deprecated. |islider16| islider16 -- Deprecated. |islider32| islider32 -- Deprecated. |islider64| islider64 -- Deprecated. |islider8| islider8 -- Deprecated. |itablecopy| itablecopy -- Deprecated. |itablegpw| itablegpw -- Deprecated. |itablemix| itablemix -- Deprecated. |itablew| itablew -- Deprecated. |itrirand| itrirand -- Deprecated. |iunirand| iunirand -- Deprecated. |iweibull| iweibull -- Deprecated. |jitter| jitter -- Generates a segmented line whose segments are randomly generated. |jitter2| jitter2 -- Generates a segmented line with user-controllable random segments. |jspline| jspline -- A jitter-spline generator. |kbetarand| kbetarand -- Deprecated. |kbexprnd| kbexprnd -- Deprecated. |kcauchy| kcauchy -- Deprecated. |kdump| kdump -- Deprecated. |kdump2| kdump2 -- Deprecated. |kdump3| kdump3 -- Deprecated. |kdump4| kdump4 -- Deprecated. |kexprand| kexprand -- Deprecated. |kfilter2| kfilter2 -- Deprecated. |kgauss| kgauss -- Deprecated. |kgoto| kgoto -- Transfer control during the p-time passes. |klinrand| klinrand -- Deprecated. |kon| kon -- Deprecated. |koutat| koutat -- Deprecated. |koutc| koutc -- Deprecated. |koutc14| koutc14 -- Deprecated. |koutpat| koutpat -- Deprecated. |koutpb| koutpb -- Deprecated. |koutpc| koutpc -- Deprecated. |kpcauchy| kpcauchy -- Deprecated. |kpoisson| kpoisson -- Deprecated. |kpow| kpow -- Deprecated. |kr| kr -- Sets the control rate. |kread| kread -- Deprecated. |kread2| kread2 -- Deprecated. |kread3| kread3 -- Deprecated. |kread4| kread4 -- Deprecated. |ksmps| ksmps -- Sets the number of samples in a control period. |ktableseg| ktableseg -- Same as the tableseg opcode. |ktrirand| ktrirand -- Deprecated. |kunirand| kunirand -- Deprecated. |kweibull| kweibull -- Deprecated. |lfo| lfo -- A low frequency oscillator of various shapes. |limit| limit -- Sets the lower and upper limits of the value it processes. |line| line -- Trace a straight line between specified points. |linen| linen -- Applies a straight line rise and decay pattern to an input amp signal. |linenr| linenr -- The linen opcode extended with a final release segment. |lineto| lineto -- Generate glissandos starting from a control signal. |linrand| linrand -- Linear distribution random number generator (positive values only). |linseg| linseg -- Trace a series of line segments between specified points. |linsegr| linsegr -- Trace a series of line segments between specified points including a release segment. |locsend| locsend -- Distributes the audio signals of a previous locsig opcode. |locsig| locsig -- Takes and input signal and distributes between 2 or 4 channels. |log| log -- Returns a natural log. |log10| log10 -- Returns a base 10 log. |logbtwo| logbtwo -- Performs a logarithmic base two calculation. |loopseg| loopseg -- Generate control signal consisting of linear segments delimited by two or more specified points. |lorenz| lorenz -- Implements the Lorenz system of equations. |loscil| loscil -- Read sampled sound from a table. |loscil3| loscil3 -- Read sampled sound from a table using cubic interpolation. |lowpass2| lowpass2 -- A resonant lowpass filter. |lowres| lowres -- Another resonant lowpass filter. |lowresx| lowresx -- Simulates layers of serially connected resonant lowpass filters. |lpf18| lpf18 -- A 3-pole sweepable resonant lowpass filter. |lpfreson| lpfreson -- Modifies the spectrum of an audio signal with time-varying filter coefficients from a control file and frequncy ratio. |lphasor| lphasor -- Generates a table index for sample playback |lpinterp| lpinterp -- Computes a new set of poles from the interpolation between two analysis. |lposcil| lposcil -- Read sampled sound from a table with optional looping and high precision. |lposcil3| lposcil3 -- Read sampled sound from a table with high precision and cubic interpolation. |lpread| lpread -- Reads a control file of time-ordered information frames. |lpreson| lpreson -- Modifies the spectrum of an audio signal with time-varying filter coefficients from a control file. |lpshold| lpshold -- Generate control signal consisting of held segments. |lpslot| lpslot -- Selects the slot to be use by further lp opcodes. |mac| mac -- Multiplies and accumulates a- and k-rate signals. |maca| maca -- Multiply and accumulate a-rate signals only. |madsr| madsr -- Calculates the classical ADSR envelope using the linsegr mechanism. |mandol| mandol -- An emulation of a mandolin. |marimba| marimba -- Physical model related to the striking of a wooden block. |massign| massign -- Assigns a MIDI channel number to a Csound instrument. |maxalloc| maxalloc -- Limits the number of allocations of an instrument. |mclock| mclock -- Sends a MIDI CLOCK message. |mdelay| mdelay -- A MIDI delay opcode. |midic14| midic14 -- Allows a floating-point 14-bit MIDI signal scaled with a minimum and a maximum range. |midic21| midic21 -- Allows a floating-point 21-bit MIDI signal scaled with a minimum and a maximum range. |midic7| midic7 -- Allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range. |midichannelaftertouch| midichannelaftertouch -- Gets a MIDI channel's aftertouch value. |midichn| midichn -- Returns the MIDI channel number from which the note was activated. |midicontrolchange| midicontrolchange -- Gets a MIDI control change value. |midictrl| midictrl -- Get the current value (0-127) of a specified MIDI controller. |mididefault| mididefault -- Changes values, depending on MIDI activation. |midiin| midiin -- Returns a generic MIDI message received by the MIDI IN port. |midinoteoff| midinoteoff -- Gets a MIDI noteoff value. |midinoteoncps| midinoteoncps -- Gets a MIDI note number as a cycles-per-second frequency. |midinoteonkey| midinoteonkey -- Gets a MIDI note number value. |midinoteonoct| midinoteonoct -- Gets a MIDI note number value as octave-point-decimal value. |midinoteonpch| midinoteonpch -- Gets a MIDI note number as a pitch-class value. |midion| midion -- Plays MIDI notes. |midion2| midion2 -- Sends noteon and noteoff messages to the MIDI OUT port. |midiout| midiout -- Sends a generic MIDI message to the MIDI OUT port. |midipitchbend| midipitchbend -- Gets a MIDI pitchbend value. |midipolyaftertouch| midipolyaftertouch -- Gets a MIDI polyphonic aftertouch value. |midiprogramchange| midiprogramchange -- Gets a MIDI program change value. |mirror| mirror -- Reflects the signal that exceeds the low and high thresholds. |moog| moog -- An emulation of a mini-Moog synthesizer. |moogvcf| moogvcf -- A digital emulation of the Moog diode ladder filter configuration. |moscil| moscil -- Sends a stream of the MIDI notes. |mpulse| mpulse -- Generates a set of impulses. |mrtmsg| mrtmsg -- Send system real-time messages to the MIDI OUT port. |multitap| multitap -- Multitap delay line implementation. |mute| mute -- Mutes/unmutes new instances of a given instrument. |mxadsr| mxadsr -- Calculates the classical ADSR envelope using the expsegr mechanism. |nchnls| nchnls -- Sets the number of channels of audio output. |nestedap| nestedap -- Three different nested all-pass filters. |nlfilt| nlfilt -- A filter with a non-linear effect. |noise| noise -- A white noise generator with an IIR lowpass filter. |noteoff| noteoff -- Send a noteoff message to the MIDI OUT port. |noteon| noteon -- Send a noteon message to the MIDI OUT port. |noteondur| noteondur -- Sends a noteon and a noteoff MIDI message both with the same channel, number and velocity. |noteondur2| noteondur2 -- Sends a noteon and a noteoff MIDI message both with the same channel, number and velocity. |notnum| notnum -- Get a note number from a MIDI event. |nreverb| nreverb -- A reverberator consisting of 6 parallel comb-lowpass filters. |nrpn| nrpn -- Sends a Non-Registered Parameter Number to the MIDI OUT port. |nsamp| nsamp -- Returns the number of samples loaded into a stored function table number. |nstrnum| nstrnum -- Returns the number of a named instrument. |ntrpol| ntrpol -- Calculates the weighted mean value of two input signals. |octave| octave -- Calculates a factor to raise/lower a frequency by a given amount of octaves. |octcps| octcps -- Converts a cycles-per-second value to octave-point-decimal. |octmidi| octmidi -- Get the note number, in octave-point-decimal units, of the current MIDI event. |octmidib| octmidib -- Get the note number of the current MIDI event and modify it by the current pitch-bend value, express it in octave-point-decimal. |octpch| octpch -- Converts a pitch-class value to octave-point-decimal. |opcode| opcode -- Defines the start of user-defined opcode block. |oscbnk| oscbnk -- Mixes the output of any number of oscillators. |oscil| oscil -- A simple oscillator. |oscil1| oscil1 -- Accesses table values by incremental sampling. |oscil1i| oscil1i -- Accesses table values by incremental sampling with linear interpolation. |oscil3| oscil3 -- A simple oscillator with cubic interpolation. |oscili| oscili -- A simple oscillator with linear interpolation. |oscilikt| oscilikt -- A linearly interpolated oscillator that allows changing the table number at k-rate. |osciliktp| osciliktp -- A linearly interpolated oscillator that allows allows phase modulation. |oscilikts| oscilikts -- A linearly interpolated oscillator with sync status that allows changing the table number at k-rate. |osciln| osciln -- Accesses table values at a user-defined frequency. |oscils| oscils -- A simple, fast sine oscillator |oscilx| oscilx -- Same as the osciln opcode. |out| out -- Writes mono audio data to an external device or stream. |out32| out32 -- Writes 32-channel audio data to an external device or stream. |outc| outc -- Writes audio data with an arbitrary number of channels to an external device or stream. |outch| outch -- Writes multi-channel audio data, with user-controllable channels, to an external device or stream. |outh| outh -- Writes 6-channel audio data to an external device or stream. |outiat| outiat -- Sends MIDI aftertouch messages at i-rate. |outic| outic -- Sends MIDI controller output at i-rate. |outic14| outic14 -- Sends 14-bit MIDI controller output at i-rate. |outipat| outipat -- Sends polyphonic MIDI aftertouch messages at i-rate. |outipb| outipb -- Sends MIDI pitch-bend messages at i-rate. |outipc| outipc -- Sends MIDI program change messages at i-rate |outk| outk -- Passes k-rate values out of a sub-instrument. |outkat| outkat -- Sends MIDI aftertouch messages at k-rate. |outkc| outkc -- Sends MIDI controller messages at k-rate. |outkc14| outkc14 -- Sends 14-bit MIDI controller output at k-rate. |outkpat| outkpat -- Sends polyphonic MIDI aftertouch messages at k-rate. |outkpb| outkpb -- Sends MIDI pitch-bend messages at k-rate. |outkpc| outkpc -- Sends MIDI program change messages at k-rate. |outo| outo -- Writes 8-channel audio data to an external device or stream. |outq| outq -- Writes 4-channel audio data to an external device or stream. |outq1| outq1 -- Writes samples to quad channel 1 of an external device or stream. |outq2| outq2 -- Writes samples to quad channel 2 of an external device or stream. |outq3| outq3 -- Writes samples to quad channel 3 of an external device or stream. |outq4| outq4 -- Writes samples to quad channel 4 of an external device or stream. |outs| outs -- Writes stereo audio data to an external device or stream. |outs1| outs1 -- Writes samples to stereo channel 1 of an external device or stream. |outs2| outs2 -- Writes samples to stereo channel 2 of an external device or stream. |outvalue| outvalue -- Sends a k-rate signal to a user-defined channel. |outx| outx -- Writes 16-channel audio data to an external device or stream. |outz| outz -- Writes multi-channel audio data from a ZAK array to an external device or stream. |p| p -- Show the value in a given p-field. |pan| pan -- Distribute an audio signal amongst four channels. |pareq| pareq -- Implementation of Zoelzer's parametric equalizer filters. |pcauchy| pcauchy -- Cauchy distribution random number generator (positive values only). |pchbend| pchbend -- Get the current pitch-bend value for this channel. |pchmidi| pchmidi -- Get the note number of the current MIDI event, expressed in pitch-class units. |pchmidib| pchmidib -- Get the note number of the current MIDI event and modify it by the current pitch-bend value, express it in pitch-class units. |pchoct| pchoct -- Converts an octave-point-decimal value to pitch-class. |peak| peak -- Maintains the output equal to the highest absolute value received. |peakk| peakk -- Deprecated. |pgmassign| pgmassign -- Assigns an instrument number to a specified MIDI program. |phaser1| phaser1 -- First-order allpass filters arranged in a series. |phaser2| phaser2 -- Second-order allpass filters arranged in a series. |phasor| phasor -- Produce a normalized moving phase value. |phasorbnk| phasorbnk -- Produce an arbitrary number of normalized moving phase values. |pinkish| pinkish -- Generates approximate pink noise. |pitch| pitch -- Tracks the pitch of a signal. |pitchamdf| pitchamdf -- Follows the pitch of a signal based on the AMDF method. |planet| planet -- Simulates a planet orbiting in a binary star system. |pluck| pluck -- Produces a naturally decaying plucked string or drum sound. |poisson| poisson -- Poisson distribution random number generator (positive values only). |polyaft| polyaft -- Returns the polyphonic after-touch pressure of the selected note number. |port| port -- Applies portamento to a step-valued control signal. |portk| portk -- Applies portamento to a step-valued control signal. |poscil| poscil -- High precision oscillator. |poscil3| poscil3 -- High precision oscillator with cubic interpolation. |pow| pow -- Computes one argument to the power of another argument. |powoftwo| powoftwo -- Performs a power-of-two calculation. |prealloc| prealloc -- Creates space for instruments but does not run them. |print| print -- Displays the values init, control, or audio signals. |printk| printk -- Prints one k-rate value at specified intervals. |printk2| printk2 -- Prints a new value every time a control variable changes. |printks| printks -- Prints at k-rate using a printf() style syntax. |prints| prints -- Prints at init-time using a printf() style syntax. |product| product -- Multiplies any number of a-rate signals. |pset| pset -- Defines and initializes numeric arrays at orchestra load time. |pvadd| pvadd -- Reads from a pvoc file and uses the data to perform additive synthesis. |pvbufread| pvbufread -- Reads from a phase vocoder analysis file and makes the retrieved data available. |pvcross| pvcross -- Applies the amplitudes from one phase vocoder analysis file to the data from a second file. |pvinterp| pvinterp -- Interpolates between the amplitudes and frequencies of two phase vocoder analysis files. |pvoc| pvoc -- Implements signal reconstruction using an fft-based phase vocoder. |pvread| pvread -- Reads from a phase vocoder analysis file and returns the frequency and amplitude from a single analysis channel or bin. |pvsadsyn| pvsadsyn -- Resynthesize using a fast oscillator-bank. |pvsanal| pvsanal -- Generate an fsig from a mono audio source ain, using phase vocoder overlap-add analysis. |pvscross| pvscross -- Performs cross-synthesis between two source fsigs. |pvsfread| pvsfread -- Read a selected channel from a PVOC-EX analysis file. |pvsftr| pvsftr -- Reads amplitude and/or frequency data from function tables. |pvsftw| pvsftw -- Writes amplitude and/or frequency data to function tables. |pvsinfo| pvsinfo -- Get information from a PVOC-EX formatted source. |pvsmaska| pvsmaska -- Modify amplitudes using a function table, with dynamic scaling. |pvsynth| pvsynth -- Resynthesise using a FFT overlap-add. |rand| rand -- Generates a controlled random number series. |randh| randh -- Generates random numbers and holds them for a period of time. |randi| randi -- Generates a controlled random number series with interpolation between each new number. |random| random -- Generates is a controlled pseudo-random number series between min and max values. |randomh| randomh -- Generates random numbers with a user-defined limit and holds them for a period of time. |randomi| randomi -- Generates a user-controlled random number series with interpolation between each new number. |readclock| readclock -- Reads the value of an internal clock. |readk| readk -- Periodically reads an orchestra control-signal value from an external file. |readk2| readk2 -- Periodically reads two orchestra control-signal values from an external file. |readk3| readk3 -- Periodically reads three orchestra control-signal values from an external file. |readk4| readk4 -- Periodically reads four orchestra control-signal values from an external file. |reinit| reinit -- Suspends a performance while a special initialization pass is executed. |release| release -- Indicates whether a note is in its "release" stage. |repluck| repluck -- Physical model of the plucked string. |reson| reson -- A second-order resonant filter. |resonk| resonk -- A second-order resonant filter. |resonr| resonr -- A bandpass filter with variable frequency response. |resonx| resonx -- Emulates a stack of filters using the reson opcode. |resony| resony -- A bank of second-order bandpass filters, connected in parallel. |resonz| resonz -- A bandpass filter with variable frequency response. |reverb| reverb -- Reverberates an input signal with a "natural room" frequency response. |reverb2| reverb2 -- Same as the nreverb opcode. |rezzy| rezzy -- A resonant low-pass filter. |rigoto| rigoto -- Transfers control during a reinit pass. |rireturn| rireturn -- Terminates a reinit pass. |rms| rms -- Determines the root-mean-square amplitude of an audio signal. |rnd| rnd -- Returns a random number in a unipolar range. |rnd31| rnd31 -- 31-bit bipolar random opcodes with controllable distribution. |rspline| rspline -- Generate random spline curves. |rtclock| rtclock -- Read the real time clock from the operating system. |s16b14| s16b14 -- Creates a bank of 16 different 14-bit MIDI control message numbers. |s32b14| s32b14 -- Creates a bank of 32 different 14-bit MIDI control message numbers. |samphold| samphold -- Performs a sample-and-hold operation on its input. |sandpaper| sandpaper -- Semi-physical model of a sandpaper sound. |scanhammer| scanhammer -- Copies from one table to another with a gain control. |scans| scans -- Generate audio output using scanned synthesis. |scantable| scantable -- A simpler scanned synthesis implementation. |scanu| scanu -- Compute the waveform and the wavetable for use in scanned synthesis. |schedkwhen| schedkwhen -- Adds a new score event generated by a k-rate trigger. |schedkwhennamed| schedkwhennamed -- Similar to schedkwhen but uses a named instrument at init-time. |schedule| schedule -- Adds a new score event. |schedwhen| schedwhen -- Adds a new score event. |seed| seed -- Sets the global seed value. |sekere| sekere -- Semi-physical model of a sekere sound. |semitone| semitone -- Calculates a factor to raise/lower a frequency by a given amount of semitones. |sense| sense -- Same as the sensekey opcode. |sensekey| sensekey -- Returns the ASCII code of a key that has been pressed. |seqtime| seqtime -- Generates a trigger signal according to the values stored in a table. |setctrl| setctrl -- Configurable slider controls for realtime user input. |setksmps| setksmps -- Sets the local ksmps value in a user-defined opcode block. |sfilist| sfilist -- Prints a list of all instruments of a previously loaded SoundFont2 (SF2) file. |sfinstr| sfinstr -- Plays a SoundFont2 (SF2) sample instrument, generating a stereo sound. |sfinstr3| sfinstr3 -- Plays a SoundFont2 (SF2) sample instrument, generating a stereo sound with cubic interpolation. |sfinstr3m| sfinstr3m -- Plays a SoundFont2 (SF2) sample instrument, generating a mono sound with cubic interpolation. |sfinstrm| sfinstrm -- Plays a SoundFont2 (SF2) sample instrument, generating a mono sound. |sfload| sfload -- Loads an entire SoundFont2 (SF2) sample file into memory. |sfpassign| sfpassign -- Assigns all presets of a SoundFont2 (SF2) sample file to a sequence of progressive index numbers. |sfplay| sfplay -- Plays a SoundFont2 (SF2) sample preset, generating a stereo sound. |sfplay3| sfplay3 -- Plays a SoundFont2 (SF2) sample preset, generating a stereo sound with cubic interpolation. |sfplay3m| sfplay3m -- Plays a SoundFont2 (SF2) sample preset, generating a mono sound with cubic interpolation. |sfplaym| sfplaym -- Plays a SoundFont2 (SF2) sample preset, generating a mono sound. |sfplist| sfplist -- Prints a list of all presets of a SoundFont2 (SF2) sample file. |sfpreset| sfpreset -- Assigns an existing preset of a SoundFont2 (SF2) sample file to an index number. |shaker| shaker -- Sounds like the shaking of a maraca or similar gourd instrument. |sin| sin -- Performs a sine function. |sinh| sinh -- Performs a hyperbolic sine function. |sininv| sininv -- Performs an arcsine function. |sleighbells| sleighbells -- Semi-physical model of a sleighbell sound. |slider16| slider16 -- Creates a bank of 16 different MIDI control message numbers. |slider16f| slider16f -- Creates a bank of 16 different MIDI control message numbers, filtered before output. |slider32| slider32 -- Creates a bank of 32 different MIDI control message numbers. |slider32f| slider32f -- Creates a bank of 32 different MIDI control message numbers, filtered before output. |slider64| slider64 -- Creates a bank of 64 different MIDI control message numbers. |slider64f| slider64f -- Creates a bank of 64 different MIDI control message numbers, filtered before output. |slider8| slider8 -- Creates a bank of 8 different MIDI control message numbers. |slider8f| slider8f -- Creates a bank of 8 different MIDI control message numbers, filtered before output. |sndwarp| sndwarp -- Reads a mono sound sample from a table and applies time-stretching and/or pitch modification. |sndwarpst| sndwarpst -- Reads a stereo sound sample from a table and applies time-stretching and/or pitch modification. |soundin| soundin -- Reads audio data from an external device or stream. |soundout| soundout -- Writes audio output to a disk file. |space| space -- Distributes an input signal among 4 channels using cartesian coordinates. |spat3d| spat3d -- Positions the input sound in a 3D space and allows moving the sound at k-rate. |spat3di| spat3di -- Positions the input sound in a 3D space with the sound source position set at i-time. |spat3dt| spat3dt -- Can be used to render an impulse response for a 3D space at i-time. |spdist| spdist -- Calculates distance values from xy coordinates. |specaddm| specaddm -- Perform a weighted add of two input spectra. |specdiff| specdiff -- Finds the positive difference values between consecutive spectral frames. |specdisp| specdisp -- Displays the magnitude values of the spectrum. |specfilt| specfilt -- Filters each channel of an input spectrum. |spechist| spechist -- Accumulates the values of successive spectral frames. |specptrk| specptrk -- Estimates the pitch of the most prominent complex tone in the spectrum. |specscal| specscal -- Scales an input spectral datablock with spectral envelopes. |specsum| specsum -- Sums the magnitudes across all channels of the spectrum. |spectrum| spectrum -- Generate a constant-Q, exponentially-spaced DFT. |spsend| spsend -- Generates output signals based on a previously defined space opcode. |sqrt| sqrt -- Returns a square root value. |sr| sr -- Sets the audio sampling rate. |stix| stix -- Semi-physical model of a stick sound. |streson| streson -- A string resonator with variable fundamental frequency. |strset| strset -- Allows a string to be linked with a numeric value. |subinstr| subinstr -- Creates and runs a numbered instrument instance. |subinstrinit| subinstrinit -- Creates and runs a numbered instrument instance at init-time. |sum| sum -- Sums any number of a-rate signals. |svfilter| svfilter -- A resonant second order filter, with simultaneous lowpass, highpass and bandpass outputs. |table| table -- Accesses table values by direct indexing. |table3| table3 -- Accesses table values by direct indexing with cubic interpolation. |tablecopy| tablecopy -- Simple, fast table copy opcode. |tablegpw| tablegpw -- Writes a table's guard point. |tablei| tablei -- Accesses table values by direct indexing with linear interpolation. |tableicopy| tableicopy -- Simple, fast table copy opcode. |tableigpw| tableigpw -- Writes a table's guard point. |tableikt| tableikt -- Provides k-rate control over table numbers. |tableimix| tableimix -- Mixes two tables. |tableiw| tableiw -- Change the contents of existing function tables. |tablekt| tablekt -- Provides k-rate control over table numbers. |tablemix| tablemix -- Mixes two tables. |tableng| tableng -- Interrogates a function table for length. |tablera| tablera -- Reads tables in sequential locations. |tableseg| tableseg -- Creates a new function table by making linear segments between values in stored function tables. |tablew| tablew -- Change the contents of existing function tables. |tablewa| tablewa -- Writes tables in sequential locations. |tablewkt| tablewkt -- Change the contents of existing function tables. |tablexkt| tablexkt -- Reads function tables with linear, cubic, or sinc interpolation. |tablexseg| tablexseg -- Creates a new function table by making exponential segments between values in stored function tables. |tambourine| tambourine -- Semi-physical model of a tambourine sound. |tan| tan -- Performs a tangent function. |tanh| tanh -- Performs a hyperbolic tangent function. |taninv| taninv -- Performs an arctangent function. |taninv2| taninv2 -- Returns an arctangent. |tbvcf| tbvcf -- Models some of the filter characteristics of a Roland TB303 voltage-controlled filter. |tempest| tempest -- Estimate the tempo of beat patterns in a control signal. |tempo| tempo -- Apply tempo control to an uninterpreted score. |tempoval| tempoval -- Reads the current value of the tempo. |tigoto| tigoto -- Transfer control at i-time when a new note is being tied onto a previously held note |timeinstk| timeinstk -- Read absolute time in k-rate cycles. |timeinsts| timeinsts -- Read absolute time in seconds. |timek| timek -- Read absolute time in k-rate cycles. |times| times -- Read absolute time in seconds. |timout| timout -- Conditional branch during p-time depending on elapsed note time. |tival| tival -- Puts the value of the instrument's internal "tie-in" flag into the named i-rate variable. |tlineto| tlineto -- Generate glissandos starting from a control signal. |tone| tone -- A first-order recursive low-pass with variable frequency response. |tonek| tonek -- A first-order recursive low-pass filter with variable frequency response. |tonex| tonex -- Emulates a stack of filters using the tone opcode. |transeg| transeg -- Constructs a user-definable envelope. |trigger| trigger -- Informs when a krate signal crosses a threshold. |trigseq| trigseq -- Accepts a trigger signal as input and outputs a group of values. |trirand| trirand -- Linear distribution random number generator. |turnoff| turnoff -- Enables an instrument to turn itself off. |turnon| turnon -- Activate an instrument for an indefinite time. |unirand| unirand -- Uniform distribution random number generator (positive values only). |upsamp| upsamp -- Modify a signal by up-sampling. |urd| urd -- A discrete user-defined-distribution random generator that can be used as a function. |valpass| valpass -- Variably reverberates an input signal with a flat frequency response. |vbap16| vbap16 -- Distributes an audio signal among 16 channels. |vbap16move| vbap16move -- Distribute an audio signal among 16 channels with moving virtual sources. |vbap4| vbap4 -- Distributes an audio signal among 4 channels. |vbap4move| vbap4move -- Distributes an audio signal among 4 channels with moving virtual sources. |vbap8| vbap8 -- Distributes an audio signal among 8 channels. |vbap8move| vbap8move -- Distributes an audio signal among 8 channels with moving virtual sources. |vbaplsinit| vbaplsinit -- Configures VBAP output according to loudspeaker parameters. |vbapz| vbapz -- Writes a multi-channel audio signal to a ZAK array. |vbapzmove| vbapzmove -- Writes a multi-channel audio signal to a ZAK array with moving virtual sources. |vco| vco -- Implementation of a band limited, analog modeled oscillator. |vco2| vco2 -- Implementation of a band-limited oscillator using pre-calculated tables. |vco2ft| vco2ft -- Returns a table number at k-time for a given oscillator frequency and wavform. |vco2ift| vco2ift -- Returns a table number at i-time for a given oscillator frequency and wavform. |vco2init| vco2init -- Calculates tables for use by vco2 opcode. |vcomb| vcomb -- Variably reverberates an input signal with a "colored" frequency response. |vdelay| vdelay -- An interpolating variable time delay. |vdelay3| vdelay3 -- An variable time delay with cubic interpolation. |vdelayx| vdelayx -- A variable delay opcode with high quality interpolation. |vdelayxq| vdelayxq -- A 4-channel variable delay opcode with high quality interpolation. |vdelayxs| vdelayxs -- A stereo variable delay opcode with high quality interpolation. |vdelayxw| vdelayxw -- Variable delay opcodes with high quality interpolation. |vdelayxwq| vdelayxwq -- Variable delay opcodes with high quality interpolation. |vdelayxws| vdelayxws -- Variable delay opcodes with high quality interpolation. |veloc| veloc -- Get the velocity from a MIDI event. |vibes| vibes -- Physical model related to the striking of a metal block. |vibr| vibr -- Easier-to-use user-controllable vibrato. |vibrato| vibrato -- Generates a natural-sounding user-controllable vibrato. |vincr| vincr -- Accumulates audio signals. |vlowres| vlowres -- A bank of filters in which the cutoff frequency can be separated under user control. |voice| voice -- An emulation of a human voice. |vpvoc| vpvoc -- Implements signal reconstruction using an fft-based phase vocoder and an extra envelope. |waveset| waveset -- A simple time stretch by repeating cycles. |weibull| weibull -- Weibull distribution random number generator (positive values only). |wgbow| wgbow -- Creates a tone similar to a bowed string. |wgbowedbar| wgbowedbar -- A physical model of a bowed bar. |wgbrass| wgbrass -- Creates a tone related to a brass instrument. |wgclar| wgclar -- Creates a tone similar to a clarinet. |wgflute| wgflute -- Creates a tone similar to a flute. |wgpluck| wgpluck -- A high fidelity simulation of a plucked string. |wgpluck2| wgpluck2 -- Physical model of the plucked string. |wguide1| wguide1 -- A simple waveguide model consisting of one delay-line and one first-order lowpass filter. |wguide2| wguide2 -- A model of beaten plate consisting of two parallel delay-lines and two first-order lowpass filters. |wrap| wrap -- Wraps-around the signal that exceeds the low and high thresholds. |wterrain| wterrain -- A simple wave-terrain synthesis opcode. |xadsr| xadsr -- Calculates the classical ADSR envelope. |xin| xin -- Passes variables from a user-defined opcode block, |xout| xout -- Retrieves variables from a user-defined opcode block, |xscanmap| xscanmap -- Allows the position and velocity of a node in a scanned process to be read. |xscansmap| xscansmap -- Allows the position and velocity of a node in a scanned process to be read. |xscans| xscans -- Fast scanned synthesis waveform and the wavetable generator. |xscanu| xscanu -- Compute the waveform and the wavetable for use in scanned synthesis. |xtratim| xtratim -- Extend the duration of real-time generated events. |xyin| xyin -- Sense the cursor position in an output window |zacl| zacl -- Clears one or more variables in the za space. |zakinit| zakinit -- Establishes zak space. |zamod| zamod -- Modulates one a-rate signal by a second one. |zar| zar -- Reads from a location in za space at a-rate. |zarg| zarg -- Reads from a location in za space at a-rate, adds some gain. |zaw| zaw -- Writes to a za variable at a-rate without mixing. |zawm| zawm -- Writes to a za variable at a-rate with mixing. |zfilter2| zfilter2 -- Performs filtering using a transposed form-II digital filter lattice with radial pole-shearing and angular pole-warping. |zir| zir -- Reads from a location in zk space at i-rate. |ziw| ziw -- Writes to a zk variable at i-rate without mixing. |ziwm| ziwm -- Writes to a zk variable to an i-rate variable with mixing. |zkcl| zkcl -- Clears one or more variables in the zk space. |zkmod| zkmod -- Facilitates the modulation of one signal by another. |zkr| zkr -- Reads from a location in zk space at k-rate. |zkw| zkw -- Writes to a zk variable at k-rate without mixing. |zkwm| zkwm -- Writes to a zk variable at k-rate with mixing. |scoregenstop| Score Statements and GEN Routines |scorestatementsref| Score Statements |a| a Statement (or Advance Statement) -- Advance score time by a specified amount. |b| b Statement -- This statement resets the clock. |e| e Statement -- This statement may be used to mark the end of the last section of the score. |f| f Statement (or Function Table Statement) -- Causes a GEN subroutine to place values in a stored function table. |i| i Statement (Instrument or Note Statement) -- Makes an instrument active at a specific time and for a certain duration. |m| m Statement (Mark Statement) -- Sets a named mark in the score. |n| n Statement -- Repeats a section. |q| q Statement -- This statement may be used to quiet an instrument. |r| r Statement (Repeat Statement) -- Starts a repeated section. |s| s Statement -- Marks the end of a section. |t| t Statement (Tempo Statement) -- Sets the tempo. |v| v Statement -- Provides for locally variable time warping of score events. |x| x Statement -- Skip the rest of the current section. |scoregenref| GEN Routines |gen01| GEN01 -- Transfers data from a soundfile into a function table. |gen02| GEN02 -- Transfers data from immediate pfields into a function table. |gen03| GEN03 -- Generates a stored function table by evaluating a polynomial. |gen04| GEN04 -- Generates a normalizing function. |gen05| GEN05 -- Constructs functions from segments of exponential curves. |gen06| GEN06 -- Generates a function comprised of segments of cubic polynomials. |gen07| GEN07 -- Constructs functions from segments of straight lines. |gen08| GEN08 -- Generate a piecewise cubic spline curve. |gen09| GEN09 -- Generate composite waveforms made up of weighted sums of simple sinusoids. |gen10| GEN10 -- Generate composite waveforms made up of weighted sums of simple sinusoids. |gen11| GEN11 -- Generates an additive set of cosine partials. |gen12| GEN12 -- Generates the log of a modified Bessel function of the second kind. |gen13| GEN13 -- Stores a polynomial whose coefficients derive from the Chebyshev polynomials of the first kind. |gen14| GEN14 -- Stores a polynomial whose coefficients derive from Chebyshevs of the second kind. |gen15| GEN15 -- Creates two tables of stored polynomial functions. |gen16| GEN16 -- Creates a table from a starting value to an ending value. |gen17| GEN17 -- Creates a step function from given x-y pairs. |gen18| GEN18 -- Writes composite waveforms made up of pre-existing waveforms. |gen19| GEN19 -- Generate composite waveforms made up of weighted sums of simple sinusoids. |gen20| GEN20 -- Generates functions of different windows. |gen21| GEN21 -- Generates tables of different random distributions. |gen23| GEN23 -- Reads numeric values from a text file. |gen24| GEN24 -- Reads numeric values from another allocated function-table and rescales them. |gen25| GEN25 -- Construct functions from segments of exponential curves in breakpoint fashion. |gen27| GEN27 -- Construct functions from segments of straight lines in breakpoint fashion. |gen28| GEN28 -- Reads a text file which contains a time-tagged trajectory. |gen30| GEN30 -- Generates harmonic partials by analyzing an existing table. |gen31| GEN31 -- Mixes any waveform specified in an existing table. |gen32| GEN32 -- Mixes any waveform, resampled with either FFT or linear interpolation. |gen33| GEN33 -- Generate composite waveforms by mixing simple sinusoids. |gen34| GEN34 -- Generate composite waveforms by mixing simple sinusoids. |gen40| GEN40 -- Generates a random distribution using a distribution histogram. |gen41| GEN41 -- Generates a random list of numerical pairs. |gen42| GEN42 -- Generates a random distribution of discrete ranges of values. |utilitytop| The Utility Programs |utilitydir| Directories. |utilitysoundfile| Soundfile Formats. |utilitycredits| Credits |utilityanalysis| Analysis File Generation |hetro| hetro -- Decomposes an input soundfile into component sinusoids. |lpanal| lpanal -- Performs both linear predictive analysis on a soundfile. |pvanal| pvanal -- Converts a soundfile into a series of short-time Fourier transform frames. |cvanal| cvanal -- Converts a soundfile into a single Fourier transform frame. |utilityqueries| File Queries |sndinfo| sndinfo -- Displays information about a soundfile. |utilityconversion| File Conversion |dnoise| dnoise -- Reduces noise in a file. |pvlook| pvlook -- View formatted text output of STFT analysis files. |sdif2ad| sdif2ad -- Converts SDIF files to files usable by adsynt. |srconv| srconv -- Converts the sample rate of an audio file. |cscoretop| Cscore |cscoreevents| Events, Lists, and Operations |cscoremain| Writing a Main Program |cscoreadvancd| More Advanced Examples |cscorecompile| Compiling a Cscore Program |addmodtop| Adding your own Cmodules to Csound |addmodftables| Function tables |addmodaddspace| Additional Space |addmodfsharing| File Sharing |addmodstringargs| String arguments |miscpitch| Pitch Conversion |miscamp| Sound Intensity Values |miscformants| Formant Values |miscwindows| Window Functions |miscsf2| SoundFont2 File Format |misccsound64| Csound64 ------------------------------------------------------------------------------ *prefacetop* Preface ~ ------------------------------------------------------------------------------ *prefacepreface* Preface to the Csound Manual ~ Barry Vercoe by Barry L. Vercoe, MIT Media Lab Realizing music by digital computer involves synthesizing audio signals with discrete points or samples representative of continuous waveforms. There are many ways to do this, each affording a different manner of control. Direct synthesis generates waveforms by sampling a stored function representing a single cycle; additive synthesis generates the many partials of a complex tone, each with its own loudness envelope; subtractive synthesis begins with a complex tone and filters it. Non-linear synthesis uses frequency modulation and waveshaping to give simple signals complex characteristics, while sampling and storage of a natural sound allows it to be used at will. Since comprehensive moment-by-moment specification of sound can be tedious, control is gained in two ways: 1) from the instruments in an orchestra, and 2) from the events within a score. An orchestra is really a computer program that can produce sound, while a score is a body of data which that program can react to. Whether a rise-time characteristic is a fixed constant in an instrument, or a variable of each note in the score, depends on how the user wants to control it. The instruments in a Csound orchestra (see |orchtop| ) are defined in a simple syntax that invokes complex audio processing routines. A score (see |scoretop| ) passed to this orchestra contains numerically coded pitch and control information, in standard numeric score format. Although many users are content with this format, higher level score processing languages are often convenient. The programs making up the Csound system have a long history of development, beginning with the Music 4 program written at Bell Telephone Laboratories in the early 1960's by Max Mathews. That initiated the stored table concept and much of the terminology that has since enabled computer music researchers to communicate. Valuable additions were made at Princeton by the late Godfrey Winham in Music 4B; my own Music 360 (1968) was very indebted to his work. With Music 11 (1973) I took a different tack: the two distinct networks of control and audio signal processing stemmed from my intensive involvement in the preceding years in hardware synthesizer concepts and design. This division has been retained in Csound. Because it is written entirely in C, Csound is easily installed on any machine running Unix or C. At MIT it runs on VAX/DECstations under Ultrix 4.2, on SUNs under OS 4.1, SGI's under 5.0, on IBM PC's under DOS 6.2 and Windows 3.1, and on the Apple Macintosh under ThinkC 5.0. With this single language for defining the audio signal processing, and portable audio formats like AIFF and WAV, users can move easily from machine to machine. The 1991 version added phase vocoder, FOF, and spectral data types. 1992 saw MIDI converter and control units, enabling Csound to be run from MIDI score-files and external keyboards. In 1994 the sound analysis programs (lpc, pvoc) were integrated into the main load module, enabling all Csound processing to be run from a single executable, and Cscore could pass scores directly to the orchestra for iterative performance. The 1995 release introduced an expanded MIDI set with MIDI-based linseg, butterworth filters, granular synthesis, and an improved spectral-based pitch tracker. Of special importance was the addition of run-time event generating tools (Cscore and MIDI) allowing run-time sensing and response setups that enable interactive composition and experiment. It appeared that real-time software synthesis was now showing some real promise. ------------------------------------------------------------------------------ *prefacecopy* Copyright Notice ~ Copyright (c) 1986, 1992 by the Massachusetts Institute of Technology. All rights reserved. Developed by Barry L. Vercoe at the Experimental Music Studio, Media Laboratory, M.I.T., Cambridge, Massachusetts, with partial support from the System Development Foundation and from National Science Foundation Grant # IRI-8704665. Copyright (c) 2003 by Kevin Conder for modifications made to the Public Csound Reference Manual. 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 this license is available in the examples sub-directory. A legal notice from the Public Csound Reference Manual... "The original Hypertext Edition of the MIT Csound Manual was prepared for the World Wide Web by Peter J. Nix of the Department of Music at the University of Leeds and Jean Piché of the Faculté de musique de l'Université de Montréal. A Print Edition, in Adobe Acrobat format, was then maintained by David M. Boothe. The editors fully acknowledge the rights of the authors of the original documentation and programs, as set out above, and further request that this notice appear wherever this material is held." The Public Csound Reference Manual's last known network location was http://www.lakewoodsound.com/csound/hypertext/manual.htm. The Alternative Csound Reference Manual's network location, for both the Transparent and Opaque copies, is http://kevindumpscore.com/download.html#csound-manual. ------------------------------------------------------------------------------ *prefaceacknowledgements* Acknowledgements ~ In addition to the core code developed by Barry L. Vercoe at M.I.T., a large part of the Csound code was modified, developed and extended by an independent group of programmers, composers and scientists. Copyright to this code is held by the respective authors: Table 1. Contributors Mike Berry Richard Karpen Eli Breder Victor Lazzarini Michael Casey Allan Lee Michael Clark David Macintyre Perry Cook Gabriel Maldonado Sean Costello Max Mathews Richard Dobson Hans Mikelson Mark Dolson Peter Neubäcker Rasmus Ekman Ville Pulkki Dan Ellis Marc Resibois Tom Erbe Paris Smaragdis John ffitch Rob Shaw Bill Gardner Greg Sullivan Matt Ingalls Bill Verplank Istvan Varga Robin Whittle Jean Piché Peter Nix The official manual was compiled from the canonical Csound Manual sources maintained by John ffitch, Richard Boulanger, Jean Piché, Peter Nix, and David M. Boothe. The Alternative Csound Reference Manual is maintained by Kevin Conder. ------------------------------------------------------------------------------ *prefacename* Why is this called the Alternative Csound Reference Manual? ~ When I originally started my manual project, there was already an Official Csound Reference Manual (last known address: http://www.lakewoodsound.com/csound/hypertext/manual.htm). The Official manual was maintained by David M. Boothe. I found its layout confusing and I wanted to change it. But since it was maintained with a commercial word processing program, I couldn't. I could neither afford this program nor was it available for my main computing platform. So I created an alternative to the Official Csound Reference Manual. I distributed my manual using the DocBook/SGML format so that anyone on any platform could edit it with a text editor. This manual can also be produced with freely available programs. David M. Boothe wasn't interested in maintaining my DocBook/SGML version of the manual. He was also concerned that people would confuse his project (the "Official" one) with mine. So out of respect for his wishes, I named my project the Alternative Csound Reference Manual. I made this decision so that nobody would confuse my project (the "Alternative" one) with his. Written by Kevin Conder, October 2002. ------------------------------------------------------------------------------ *prefacescope* What is the scope of the Alternative Csound Reference Manual? ~ While there are numerous Csound-related projects, this manual only covers the canonical Csound program. This program is maintained by John ffitch and is stored on the Bath University FTP server (ftp://www.cs.bath.ac.uk/pub/dream/newest/). I apologize that I can't maintain the documentation for other projects. I simply don't have the time and resources to do so. Written by Kevin Conder, January 2003. ------------------------------------------------------------------------------ *prefacecsoundav* Where is the documentation for the CsoundAV project? ~ The documentation for the CsoundAV project is located at http://www.csounds.com/csoundav/index.html. *partoverview* Overview ~ Table of Contents |introtop| Introduction |commandtop| The Csound Command |orchtop| Syntax of the Orchestra |controltop| Instrument Control |tabletop| Function Table Control |mathtop| Mathematical Operations |miditop| MIDI Support |pitchtop| Pitch Converters |siggentop| Signal Generators |sigiotop| Signal Input and Output |sigmodtop| Signal Modifiers |spectraltop| Spectral Processing |zaktop| Zak Patch System |scoretop| The Standard Numeric Score ------------------------------------------------------------------------------ *introtop* Introduction ~ ------------------------------------------------------------------------------ *introget* Where to Get Public Csound and the Csound Manual ~ Public Csound is available for download from : ftp://ftp.cs.bath.ac.uk/pub/dream/newest/ This Hypertext Edition of the manual, as well as the Print Edition, in Adobe Acrobat format (.pdf) are available for browser download from: http://www.kevindumpscore.com/download/ ------------------------------------------------------------------------------ *introinstall* How to Install Csound ~ ------------------------------------------------------------------------------ *introinstalllinux* Linux ~ Detailed instructions for installing and configuring Csound on a Linux system may be obtained from: http://www.csounds.com/secondprinting/cdroms/installing/linux/ ------------------------------------------------------------------------------ *introinstallmac* Macintosh ~ Detailed instructions for installing and configuring Csound on Macintosh systems may be obtained from: http://www.csounds.com/installing/howtomacintosh/index.html ------------------------------------------------------------------------------ *introinstallmsdos* MS-DOS and Windows 95/NT ~ Detailed instructions for installing and configuring Csound on a MS-DOS or Windows 95/NT system may be obtained from: http://hem.passagen.se/rasmuse/PCinstal.htm ------------------------------------------------------------------------------ *introinstallwindow* Windows 95/98/2000 ~ Detailed instructions for installing and configuring Csound on a Windows 95, Windows 98, or Windows 2000 system may be obtained from: http://www.csounds.com/installing/howtowindows/index.html ------------------------------------------------------------------------------ *introinstallother* Other Platforms ~ For information on availability of Csound for other platforms, see The Csound FrontPage: http://mitpress.mit.edu/e-books/csound/frontpage.html ------------------------------------------------------------------------------ *introlist* The Csound Mailing List ~ A Csound Mailing List exists to discuss Csound. It is run by John ffitch of Bath University, UK. To have your name put on the mailing list send an empty message to: csound-subscribe@lists.bath.ac.uk Posts sent to csound@lists.bath.ac.uk go to all subscribed members of the list. ------------------------------------------------------------------------------ *introlistbugs* Bug Reports ~ Suspected bugs in the code may be entered using the bug tracking system at http://www.cs.bath.ac.uk/cgi-bin/csound. ------------------------------------------------------------------------------ *commandtop* The Csound Command ~ Csound is a command for passing anorchestra file andscore file to Csound to generate a soundfile. The score file can be in one of many different formats, according to user preference. Translation, sorting, and formatting into orchestra-readable numeric text is handled by various preprocessors; all or part of the score is then sent on to the orchestra. Orchestra performance is influenced by command flags, which set the level of displays and console reports, specify I/0 filenames and sample formats, and declare the nature of real-time sensing and control. ------------------------------------------------------------------------------ *commandorder* Order of Precedence ~ With some recent additions to Csound, there are now three places (and in some cases four) where options for Csound performance may be set. They are processed in the following order: 1. Csound's own defaults 2. .csoundrc file 3. Csound command line 4. tag in a .csd file 5. Orchestra header (for sr, kr, ksmps, nchnls) The last assignment of an option will override any earlier ones. ------------------------------------------------------------------------------ *commanddesc* Description ~ Flags may appear anywhere in the command line, either separately or bundled together. A flag taking a Name or Number will find it in that argument, or in the immediately subsequent one. The following are thus equivalent commands: csound -nm3 orchname -Sxxfilename scorename csound -n -m 3 orchname -x xfilename -S scorename All flags and names are optional. The default values are: csound -s -otest -b1024 -B1024 -m7 -P128 orchname scorename where orchname is a file containing Csound orchestra code, and scorename is a file of score data in standard numeric score format, optionally presorted and time-warped. If scorename is omitted, there are two default options: 1. if real-time input is expected (-L, -M or -F), a dummy score file is substituted consisting of the single statement 'f 0 3600' (i.e. listen for RT input for one hour) 2. else CSound uses the previously processed score.srt in the current directory. Csound reports on the various stages of score and orchestra processing as it goes, doing various syntax and error checks along the way. Once the actual performance has begun, any error messages will derive from either the instrument loader or the unit generators themselves. A CSound command may include any rational combination of flag arguments. ------------------------------------------------------------------------------ *commandflags* Command-line Flags ~ Many flags are generic Csound command-line flags. Various platform implementations may not react the same way to different flags! The format of a command is either: csound [-flags] [orchname] [scorename] or csound [-flags] [csdfilename] where the arguments are of 2 types: flags arguments (beginning with a "-"), and name arguments (such as filenames). Certain flag arguments take a following name or numeric argument. Command-line Flags ------------------------------------------------------------------------------ *flagsminusat* -@ FILE ~ Provide an extended command-line in file "FILE" ------------------------------------------------------------------------------ *flagsminus3* -3, --format=24bit ~ Use 24-bit audio samples. ------------------------------------------------------------------------------ *flagsminus8* -8, --format=uchar ~ Use 8-bit unsigned character audio samples. ------------------------------------------------------------------------------ *flagsminusuppera* -A, --aiff ~ Write an AIFF format soundfile. Use with the |flagsminuslowerc| -c, |flagsminuslowers| -s, |flagsminuslowerl| -l, or |flagsminuslowerf| -f flags. ------------------------------------------------------------------------------ *flagsminuslowera* -a, --format=alaw ~ Use a-law audio samples. ------------------------------------------------------------------------------ *flagsminusupperb* -B NUM, --hardwarebufsamps=NUM ~ Number of audio sample-frames held in the DAC hardware buffer. This is a threshold on which software audio I/O (above) will wait before returning. A small number reduces audio I/O delay; but the value is often hardware limited, and small values will risk data lates. The default is 1024. ------------------------------------------------------------------------------ *flagsminuslowerb* -b NUM, --iobufsamps=NUM ~ Number of audio sample-frames per sound i/o software buffer. Large is efficient, but small will reduce audio I/O delay. The default is 1024. In real-time performance, Csound waits on audio I/O on NUM boundaries. It also processes audio (and polls for other input like MIDI) on orchestra ksmps boundaries. The two can be made synchronous. For convenience, if NUM = -NUM (is negative) the effective value is ksmps * NUM (audio synchronous with k-period boundaries). With NUM small (e.g. 1) polling is then frequent and also locked to fixed DAC sample boundaries. ------------------------------------------------------------------------------ *flagsminusupperc* -C, --cscore ~ Use Cscore processing of the scorefile. ------------------------------------------------------------------------------ *flagsminuslowerc* -c, --format=schar ~ Use 8-bit signed character audio samples. ------------------------------------------------------------------------------ *flagsminusupperd* -D, --defer-gen1 ~ Defer GEN01 soundfile loads until performance time. ------------------------------------------------------------------------------ *flagsminuslowerd* -d, --nodisplays ~ Suppress all displays. ------------------------------------------------------------------------------ *flagsminusuppere* -E NUM, --graphs=NUM ~ Mac only. Number of tables in graphics window. (was -G) ------------------------------------------------------------------------------ *flagsminuslowere* -e, --format=rescale ~ Mac only. Rescale floats as shorts to max amplitude. ------------------------------------------------------------------------------ *flagsminusupperf* -F FILE, --midifile=FILE ~ Read MIDI events from MIDI file FILE. ------------------------------------------------------------------------------ *flagsminuslowerf* -f, --format=float ~ Use single-precision float audio samples (not playable, but can be read by |flagsminusloweri| -i, |soundin| soundin and |gen01| GEN01 ------------------------------------------------------------------------------ *flagsminusupperg* -G, --postscriptdisplay ~ Suppress graphics, use PostScript displays instead. ------------------------------------------------------------------------------ *flagsminuslowerg* -g, --asciidisplay ~ Suppress graphics, use ASCII displays instead. ------------------------------------------------------------------------------ *flagsminusupperh* -H#, --heartbeat=NUM ~ Print a heartbeat after each soundfile buffer write: * no NUM, a rotating bar. * NUM = 1, a rotating bar. * NUM = 2, a dot (.) * NUM = 3, filesize in seconds. * NUM = 4, sound a bell. ------------------------------------------------------------------------------ *flagsminuslowerh* -h, --noheader ~ No header on output soundfile. Don't write a file header, just binary samples. ------------------------------------------------------------------------------ *flagsminushelp* --help ~ Display on-line help message. ------------------------------------------------------------------------------ *flagsminusupperi* -I, --i-only ~ i-time only. Allocate and initialize all instruments as per the score, but skip all p-time processing (no k-signals or a-signals, and thus no amplitudes and no sound). Provides a fast validity check of the score pfields and orchestra i-variables. ------------------------------------------------------------------------------ *flagsminusloweri* -i FILE, --input=FILE ~ Input soundfile name. If not a full pathname, the file will be sought first in the current directory, then in that given by the environment variable SSDIR (if defined), then by SFDIR. The name stdin will cause audio to be read from standard input. If RTAUDIO is enabled, the name devaudio will request sound from the host audio input device. ------------------------------------------------------------------------------ *flagsminusupperj* -J, --ircam ~ Write an IRCAM format soundfile. ------------------------------------------------------------------------------ *flagsminuslowerj* -j FILE ~ Currently disabled. Use database FILE for messages to print to console during performance. ------------------------------------------------------------------------------ *flagsminusupperk* -K, --nopeaks ~ Do not generate any PEAK chunks. ------------------------------------------------------------------------------ *flagsminuslowerk* -k NUM, --control-rate=NUM ~ Override the control rate (|kr| KR) supplied by the orchestra. ------------------------------------------------------------------------------ *flagsminusupperl* -L DEVICE, --score-in=DEVICE ~ Read line-oriented real-time score events from device DEVICE. The name stdin will permit score events to be typed at your terminal, or piped from another process. Each line-event is terminated by a carriage-return. Events are coded just like those in a standard numeric score, except that an event with p2=0 will be performed immediately, and an event with p2=T will be performed T seconds after arrival. Events can arrive at any time, and in any order. The score carry feature is legal here, as are held notes (p3 negative) and string arguments, but ramps and pp or np references are not. ------------------------------------------------------------------------------ *flagsminuslowerl* -l, --format=long ~ Use long integer audio samples. ------------------------------------------------------------------------------ *flagsminusupperm* -M DEVICE, --midi-device=DEVICE ~ Read MIDI events from device DEVICE. ------------------------------------------------------------------------------ *flagsminuslowerm* -m NUM, --messagelevel=NUM ~ Message level for standard (terminal) output. Takes the sum of 3 print control flags, turned on by the following values: * 1 = note amplitude messages * 2 = samples out of range message * 4 = warning messages The default value is m7 (all messages on). ------------------------------------------------------------------------------ *flagsminusuppern* -N, --notify ~ Notify (ring the bell) when score or MIDI track is done. ------------------------------------------------------------------------------ *flagsminuslowern* -n, --nosound ~ No sound. Do all processing, but bypass writing of sound to disk. This flag does not change the execution in any other way. ------------------------------------------------------------------------------ *flagsminusuppero* -O FILE, --logfile=FILE ~ Log output to file FILE. ------------------------------------------------------------------------------ *flagsminuslowero* -o FILE, --output=FILE ~ Output soundfile name. If not a full pathname, the soundfile will be placed in the directory given by the environment variable SFDIR (if defined), else in the current directory. The name stdout will cause audio to be written to standard output. If no name is given, the default name will be test. If RTAUDIO is enabled, the name devaudio will send to the host audio output device. ------------------------------------------------------------------------------ *flagsminusupperp* -P NUM, --pollrate=NUM ~ Mac only. Poll events every NUM buffer writes. ------------------------------------------------------------------------------ *flagsminuslowerp* -p, --play-on-end ~ Mac only. Play after rendering. ------------------------------------------------------------------------------ *flagsminusupperq* -Q DEVICE, -Q DIRECTORY, --analysis-directory=DIRECTORY ~ Beos and Linux only. Enables MIDI OUT operations and optionally chooses device id DEVICE (if the DEVICE argument is present). This flag allows parallel MIDI OUT and DAC performance. Unfortunately the real-time timing implemented in Csound is completely managed by DAC buffer sample flow. So MIDI OUT operations can present some time irregularities. These irregularities can be fully eliminated when suppressing DAC operations themselves (see |flagsminusuppery| -Y flag). Mac only. Define the analysis (SADIR) directory. ------------------------------------------------------------------------------ *flagsminuslowerq* -q DIRECTORY, --sample-directory=DIRECTORY ~ Mac only. Define the sound sample-in (SSDIR) directory. ------------------------------------------------------------------------------ *flagsminusupperr* -R, --rewrite ~ Continually rewrite the header while writing the soundfile (WAV/AIFF). ------------------------------------------------------------------------------ *flagsminuslowerr* -r NUM, --sample-rate=NUM ~ Override the sampling rate (|sr| SR) supplied by the orchestra. ------------------------------------------------------------------------------ *flagsminuslowers* -s, --format=short ~ Use short integer audio samples. ------------------------------------------------------------------------------ *flagsminussched* --sched ~ Linux only. Use real-time scheduling and lock memory. (Also requires |flagsminuslowerd| -d and either |flagsminuslowero| -o dac or |flagsminuslowero| -o devaudio). ------------------------------------------------------------------------------ *flagsminusuppert* -T, --terminate-on-midi ~ Terminate the performance when MIDI track is done. ------------------------------------------------------------------------------ *flagsminuslowert0* -t0, --keep-sorted-score ~ Prevents Csound from deleting the sorted score file, score.srt, upon exit. ------------------------------------------------------------------------------ *flagsminuslowert* -t NUM, --tempo=NUM ~ Use the uninterpreted beats of score.srt for this performance, and set the initial tempo at NUM beats per minute. When this flag is set, the tempo of score performance is also controllable from within the orchestra. ------------------------------------------------------------------------------ *flagsminusupperu* -U UTILITY, --utility=UTILITY ~ Invoke the utility program UTILITY. ------------------------------------------------------------------------------ *flagsminusloweru* -u, --format=ulaw ~ Use u-law audio samples. ------------------------------------------------------------------------------ *flagsminusupperv* -V NUM, --screen-buffer=NUM, --volume=NUM ~ Linux only. Set real-time audio output volume to NUM (1 to 100). Mac only. Number of chars in the screen buffer for the output window. ------------------------------------------------------------------------------ *flagsminuslowerv* -v, --verbose ~ Verbose translate and run. Prints details of orch translation and performance, enabling errors to be more clearly located. ------------------------------------------------------------------------------ *flagsminusupperw* -W, --wave ~ Write a WAV format soundfile. ------------------------------------------------------------------------------ *flagsminuslowerw* -w, --save-midi ~ Mac only. Record and save MIDI input to a file. ------------------------------------------------------------------------------ *flagsminusupperx* -X DIRECTORY, --sound-directory=DIRECTORY ~ Mac only. Define the sound file (SFDIR) directory. ------------------------------------------------------------------------------ *flagsminuslowerx* -x FILE, --extract-score=FILE ~ Extract a portion of the sorted score, score.srt, using the extract file FILE (see |commandpreextract| Extract). ------------------------------------------------------------------------------ *flagsminusuppery* -Y NUM, --progress-rate=NUM ~ Currently disabled. Mac only. Enables progress display at rate NUM in seconds, or for negative NUM, at -NUM kperiods. ------------------------------------------------------------------------------ *flagsminuslowery* -y NUM, --profile-rate=NUM ~ Currently disabled. Mac only. Enables profile display at rate NUM in seconds, or for negative NUM, at -NUM kperiods. ------------------------------------------------------------------------------ *flagsminusupperz* -Z, --dither ~ Switch on dithering of audio conversion from internal floating point to 32, 16 and 8-bit formats. ------------------------------------------------------------------------------ *flagsminuslowerz* -z NUM, --list-opcodesNUM ~ List opcodes in this version: * no NUM, just show names * NUM = 0, just show names * NUM = 1, show arguments to each opcode using the format ------------------------------------------------------------------------------ *commandunifile* Unified File Format for Orchestras and Scores ~ Description ~ The Unified File Format , introduced in Csound version 3.50, enables the orchestra and score files, as well as command line flags, to be combined in one file. The file has the extension .csd. This format was originally introduced by Michael Gogins in AXCsound. The file is a structured data file which uses markup language, similar to any SGML such as HTML. Start tags () and end tags () are used to delimit the various elements. The file is saved as a text file. Structured Data File Format Mandatory Elements The Csound Element is used to alert the csound compiler to the .csd format. The file must begin with the start tag . The last line of the file must be the end tag . The remaining elements are defined below. Options Csound command line flags are put in the Options Element. This section is delimited by the start tag and the end tag Lines beginning with # or ; are treated as comments. Instruments (Orchestra) The instrument definitions (orchestra) are put into the Instruments Element. The statements and syntax in this section are identical to the Csound orchestra file, and have the same requirements, including the header statements (sr, kr, etc.) This Instruments Element is delimited with the start tag and the end tag . Score Csound score statements are put in the Score Element. The statements and syntax in this section are identical to the Csound score file, and have the same requirements. The Score Element is delimited by the start tag and the end tag . Optional Elements Included Base64 Files Base64 encoded MIDI files may be included with the tag , where filename is the name of the file containing the MIDI information. There is no matching end tag. New in Csound version 4.07. Base64 encoded sample files may be included with the tag , where filename is the name of the file containing the sample. There is no matching end tag. New in Csound version 4.07. Version Blocking Versions of Csound may blocked by placing one of the following statements between the start tag and the end tag : Before #.# or After #.# where #.# is the requested Csound version number. The second statement may be written simply as: #.# See example below. New in Csound version 4.09. Example ~ Below is a sample file, test.csd, which renders a .wav file at 44.1 kHz sample rate containing one second of a 1 kHz sine wave. Displays are suppressed. test.csd was created from two files, tone.orc and tone.sco, with the addition of command line flags. ; ; test.csd - a Csound structured data file csound -W -d -o tone.wav ;optional section Before 4.10 ;these two statements check for After 4.08 ; Csound version 4.09 ; originally tone.orc sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 instr 1 a1 oscil p4, p5, 1 ; simple oscillator out a1 endin ; originally tone.sco f1 0 8192 10 1 i1 0 1 20000 1000 ;play one second of one kHz tone e Command Line Parameter File If the file .csoundrc exists, it will be used to set the command line parameters. These can be overridden. It uses the same form as a .csd file. Lines beginning with # or ; are treated as comments. ------------------------------------------------------------------------------ *commandpreproc* Score File Preprocessing ~ ------------------------------------------------------------------------------ *commandpreextract* The Extract Feature ~ This feature will extract a segment of a sorted numeric score file according to instructions taken from a control file. The control file contains an instrument list and two time points, from and to, in the form: instruments 1 2 from 1:27.5 to 2:2 The component labels may be abbreviated as i, f and t. The time points denote the beginning and end of the extract in terms of: [section no.] : [beat no.]. each of the three parts is also optional. The default values for missing i, f or t are: all instruments, beginning of score, end of score. ------------------------------------------------------------------------------ *commandpreindie* Independent Pre-Processing with Scsort ~ Although the result of all score preprocessing is retained in the file score.srt after orchestra performance (it exists as soon as score preprocessing has completed), the user may sometimes want to run these phases independently. The command scot filename will process the Scot formatted filename, and leave a |scoretop| standard numeric score result in a file named score for perusal or later processing. The command scscort < infile > outfile will put a numeric score infile through Carry, Tempo, and Sort preprocessing, leaving the result in outfile. Likewise extract, also normally invoked as part of the |commandtop| Csound command, can be invoked as a standalone program: extract xfile < score.sort > score.extract This command expects an already sorted score. An unsorted score should first be sent through Scsort then piped to the extract program: scsort < scorefile | extract xfile > score.extract ------------------------------------------------------------------------------ *orchtop* Syntax of the Orchestra ~ An orchestra statement in Csound has the format: label: result opcode argument1, argument2, ... ;comments The label is optional and identifies the basic statement that follows as the potential target of a go-to operation (see |controlpgmctl| Program Flow Control). A label has no effect on the statement per se. Comments are optional and are for the purpose of letting the user document his orchestra code. Comments always begin with a semicolon (;) and extend to the end of the line. The remainder (result, opcode, and arguments) form the basic statement. This also is optional, i.e. a line may have only a label or comment or be entirely blank. If present, the basic statement must be complete on one line, and is terminated by a carriage return and line feed. The opcode determines the operation to be performed; it usually takes some number of input values (or arguments, with a maximum value of about 800); and it usually has a result field variable to which it sends output values at some fixed rate. There are four possible rates: 1. once only, at orchestra setup time (effectively a permanent assignment) 2. once at the beginning of each note (at initialization (init) time: i-rate) 3. once every performance-time control loop (perf-time control rate, or k-rate) 4. once each sound sample of every control loop (perf-time audio rate, or a-rate) ------------------------------------------------------------------------------ *orchdirfiles* Directories and Files ~ Many generators and the Csound command itself specify filenames to be read from or written to. These are optionally full pathnames, whose target directory is fully specified. When not a full path, filenames are sought in several directories in order, depending on their type and on the setting of certain environment variables. The latter are optional, but they can serve to partition and organize the directories so that source files can be shared rather than duplicated in several user directories. The environment variables can define directories for soundfiles SFDIR, sound samples SSDIR, sound analysis SADIR, and include files for orchestra and score files INCDIR. The search order is: 1. Soundfiles being written are placed in SFDIR (if it exists), else the current directory. 2. Soundfiles for reading are sought in the current directory, then SSDIR, then SFDIR. 3. Analysis control files for reading are sought in the current directory, then SADIR. 4. Files of code to be included in orchestra and score files (with |include| #include) are sought first in the current directory, then in the same directory as the orchestra or score file (as appropriate), then finally INCDIR. Beginning with Csound version 3.54, the file "csound.txt" contains the messages (in binary format) that Csound uses to provide information to the user during performance. This allows for the messages to be in any language, although the default is English. This file must be placed in the same directory as the Csound executable. Alternatively, this file may be stored in SFDIR, SSDIR, or SADIR. Unix users may also keep this file in "/usr/local/lib/". The environment variable CSSTRNGS may be used to define the directory in which the database resides. This can be overridden with the -j command line option. (New in version 3.55) ------------------------------------------------------------------------------ *orchnomen* Nomenclature ~ Throughout this document, opcodes are indicated in boldface and their argument and result mnemonics, when mentioned in the text, are given in italics. Argument names are generally mnemonic (amp, phs), and the result is usually denoted by the letter r. Both are preceded by a type qualifier i, k, a, or x (e.g. kamp, iphs, ar). The prefix i denotes scalar values valid at note init time; prefixes k or a denote control (scalar) and audio (vector) values, modified and referenced continuously throughout performance (i.e. at every control period while the instrument is active). Arguments are used at the prefix-listed times; results are created at their listed times, then remain available for use as inputs elsewhere. With few exceptions, argument rates may not exceed the rate of the result. The validity of inputs is defined by the following: * arguments with prefix i must be valid at init time; * arguments with prefix k can be either control or init values (which remain valid); * arguments with prefix a must be vector inputs; * arguments with prefix x may be either vector or scalar (the compiler will distinguish). All arguments, unless otherwise stated, can be expressions whose results conform to the above. Most opcodes (such as linen and oscil) can be used in more than one mode, which one being determined by the prefix of the result symbol. Thoughout this manual, the term "opcode" is used to indicate a command that usually produces an a-, k-, or i-rate output, and always forms the basis of a complete Csound orchestra statement. Items such as "+" or "sin(x)" or, "( a >= b ? c : d)" are called "operators." ------------------------------------------------------------------------------ *orchstatemnt* Orchestra Statement Types ~ An orchestra program in Csound is comprised of |orchheader| orchestra header statements which set various global parameters, followed by a number of |orchiblock| instrument blocks representing different instrument types. An instrument block, in turn, is comprised of ordinary statements that set values, control the logical flow, or invoke the various signal processing subroutines that lead to audio output. An orchestra header statement operates once only, at orchestra setup time. It is most commonly an assignment of some value to a global reserved symbol , e.g. sr = 20000. All orchestra header statements belong to a pseudo instrument 0, an init pass of which is run prior to all other instruments at score time 0. Any ordinary statement can serve as an orchestra header statement, eg. gifreq = cpspch(8.09) provided it is an init-time only operation. An ordinary statement runs at either init time or performance time or both. Operations which produce a result formally run at the rate of that result (that is, at init time for i-rate results; at performance time for k- and a-rate results), with the sole exception of the init opcode. Most generators and modifiers, however, produce signals that depend not only on the instantaneous value of their arguments but also on some preserved internal state. These performance-time units therefore have an implicit init-time component to set up that state. The run time of an operation which produces no result is apparent in the opcode. Arguments are values that are sent to an operation. Most arguments will accept arithmetic expressions composed of constants, variables, reserved symbols, value converters, arithmetic operations, and conditional values. ------------------------------------------------------------------------------ *orchkvar* Constants and Variables ~ constants are floating point numbers, such as 1, 3.14159, or -73.45. They are available continuously and do not change in value. variables are named cells containing numbers. They are available continuously and may be updated at one of the four update rates (setup only, i-rate, k-rate, or a-rate). i- and k-rate variables are scalars (i.e. they take on only one value at any given time) and are primarily used to store and recall controlling data, that is, data that changes at the note rate (for i-rate variables) or at the control rate (for k-rate variables). i- and k-variables are therefore useful for storing note parameter values, pitches, durations, slow-moving frequencies, vibratos, etc. a-rate variables, on the other hand, are arrays or vectors of information. Though renewed on the same perf-time control pass as k-rate variables, these array cells represent a finer resolution of time by dividing the control period into sample periods (see |ksmps| ksmps). a-rate variables are used to store and recall data changing at the audio sampling rate (e.g. output signals of oscillators, filters, etc.). A further distinction is that between local and global variables. local variables are private to a particular instrument, and cannot be read from or written into by any other instrument. Their values are preserved, and they may carry information from pass to pass (e.g. from initialization time to performance time) within a single instrument. Local variable names begin with the letter p, i, k, or a. The same local variable name may appear in two or more different instrument blocks without conflict. global variables are cells that are accessible by all instruments. The names are either like local names preceded by the letter g, or are special reserved symbols. Global variables are used for broadcasting general values, for communicating between instruments (semaphores), or for sending sound from one instrument to another (e.g. mixing prior to reverberation). given these distinctions, there are eight forms of local and global variables: *variabletypes* Table 1. Types of Variables +-------------------------------------------------------------+ | Type | When Renewable | Local | Global | |---------------------+----------------+----------+-----------| | reserved symbols | permanent | -- | r symbol | |---------------------+----------------+----------+-----------| | score pfields | i-time | p number | -- | |---------------------+----------------+----------+-----------| | v-set symbols | i-time | v number | gv number | |---------------------+----------------+----------+-----------| | init variables | i-time | i name | gi name | |---------------------+----------------+----------+-----------| | MIDI controllers | any time | c number | -- | |---------------------+----------------+----------+-----------| | control signals | p-time, k-rate | k name | gk | |---------------------+----------------+----------+-----------| | audio signals | p-time, k-rate | a name | ga name | |---------------------+----------------+----------+-----------| | spectral data types | k-rate | w name | -- | +-------------------------------------------------------------+ where rsymbol is a special reserved symbol (e.g. sr, kr), number is a positive integer referring to a score pfield or sequence number, and name is a string of letters and/or digits with local or global meaning. As might be apparent, score parameters are local i-rate variables whose values are copied from the invoking score statement just prior to the init pass through an instrument, while MIDI controllers are variables which can be updated asynchronously from a MIDI file or MIDI device. ------------------------------------------------------------------------------ *orchexpress* Expressions ~ Expressions may be composed to any depth. Each part of an expression is evaluated at its own proper rate. For instance, if the terms within a sub-expression all change at the control rate or slower, the sub-expression will be evaluated only at the control rate; that result might then be used in an audio-rate evaluation. For example, in k1 + abs(int(p5) + frac(p5) * 100/12 + sqrt(k1)) the 100/12 would be evaluated at orch init, the p5 expressions evaluated at note i-time, and the remainder of the expression evaluated every k-period. The whole might occur in a unit generator argument position, or be part of an assignment statement. ------------------------------------------------------------------------------ *orchheader* Orchestra Header Statements ~ Statements that are normally placed in an orchestra header are |ctrlinit| ctrlinit, |ftgen| ftgen, |kr| kr, |ksmps| ksmps, |massign| massign, |nchnls| nchnls, |pgmassign| pgmassign, |pset| pset, |seed| seed, |sr| sr, and |strset| strset. ------------------------------------------------------------------------------ *orchiblock* Instrument Block Statements ~ Statements that define an instrument block are |endin| endin and |instr| instr. ------------------------------------------------------------------------------ *orchvarinit* Variable Initialization ~ Opcodes that let one initialize variables are |assign| assign, |divz| divz, |init| init, and |tival| tival. ------------------------------------------------------------------------------ *controltop* Instrument Control ~ ------------------------------------------------------------------------------ *controlclockctl* Clock Control ~ The opcodes to start and stop internal clocks are |clockoff| clockoff and |clockon| clockon. ------------------------------------------------------------------------------ *controlconditional* Conditional Values ~ The opcodes for conditional values are |equals| ==, |greaterequal| >=, |greaterthan| >, |lessthan| <, |lessequal| <=, and |notequal| !=. ------------------------------------------------------------------------------ *controldurctl* Duration Control Statements ~ The opcodes one can use to manipulate a note's duration are |ihold| ihold, |turnoff| turnoff, and |turnon| turnon. ------------------------------------------------------------------------------ *controlfltkintro* Introduction to FLTK Widgets and GUI controllers ~ Written by Gabriel Maldonado (http://csounds.com/maldonado) Widgets allow the design of a custom Graphical User Interface to control an orchestra in real-time. They are derived from the open-source library FLTK (Fast Light Tool Kit). Such library is one of the fastest graphic libraries available, supports OpenGL and should be source compatible with different platforms (Windows, Linux, Unix and Mac OS). The subset of FLTK implemented in Csound provides the following types of objects: * Containers * Valuators * Other widgets Containers are widgets that contain other widgets such as panels, windows, etc. Csound provides the following container objects: * Panels * Scroll areas * Pack * Tabs * Groups The most useful objects are named valuators. These objects allow the user to vary synthesis parameter values in real-time. Csound provides the following valuator objects: * Sliders * Knobs * Rollers * Text fields * Joysticks * Counters There are other widgets that are not valuators nor containers: * Buttons * Button banks * Labels Also there are some other opcodes useful to modify the widget appearance: * Updating widget value. * Setting primary and selection colors of a widget. * Setting font type, size and color of widgets. * Resizing a widget. * Hiding and showing a widget. At last, there are three important opcodes that allow the following actions: * Running the widget thread. * Loading snapshots containing the status of all valuators of an orchestra. * Saving snapshots containing the status of all valuators of an orchestra. Here is an example preview of Csound code for a window containing a valuator. Notice that all opcodes are init-rate and must be called only once per session. The best way to use them is to place them in the header section of an orchestra, externally to any instrument. Even though placing them inside an instrument is not prohibited, unpredictable results can occur if that instrument is called more than once. Each container is made up of a couple of opcodes: the first indicating the start of the container block and the last indicating the end of that container block. Some container blocks can be nested but they must not be crossed. After defining all containers, a widget thread must be run by using the special FLrun opcode that takes no arguments. Here is an example of creating a window: ;******************************* sr=48000 kr=480 ksmps=100 nchnls=1 ;*** It is recommended to put almost all GUI code in the ;*** header section of an orchestra FLpanel "Panel1",450,550 ;***** start of container ; some widgets should contained here FLpanelEnd ;***** end of container FLrun ;***** runs the widget thread, it is always required! instr 1 ;put some synthesis code here endin ;******************************* The previous code simply creates a panel (an empty window because no widgets are defined inside the container). The following example creates two panels and inserts a slider inside each of them: ;******************************* sr=48000 kr=480 ksmps=100 nchnls=1 FLpanel "Panel1",450,550,100,100 ;***** start of container gk1,iha FLslider "FLslider 1", 500, 1000, 2 ,1, ih1, 300,15, 20,50 FLpanelEnd ;***** end of container FLpanel "Panel1",450,550,100,100 ;***** start of container gk2,ihb FLslider "FLslider 2", 100, 200, 2 ,1, ih2, 300,15, 20,50 FLpanelEnd ;***** end of container FLrun ;***** runs the widget thread, it is always required! instr 1 ;put some synthesis code here ; gk1 and gk2 variables that contain the output of valuator ; widgets previously defined, can be used inside any instrument endin ;******************************* All widget opcodes are init-rate opcodes, even if valuators output k-rate variables. This happens because an independent thread is run based on a callback mechanism. It consumes very few processing resources since there is no need of polling. (This differs from other MIDI based controller opcodes.) So you can use any number of windows and valuators without degrading the real-time performance. Since FLTK toolkit is still in evolution process, opcode syntax provided in Csound could be modified in future version. This could cause some incompatibilities between orchestras of a determinate version. However it should not be hard to modify early orchestras in order to make them compatible with later versions. For more information, see the following sections. ------------------------------------------------------------------------------ *controlfltkcontainers* FLTK Containers ~ The opcodes for FTLK containers are |flgroup| FLgroup, |flgroupend| FLgroupEnd, |flpack| FLpack, |flpackend| FLpackEnd, |flpanel| FLpanel, |flpanelend| FLpanelEnd, |flscroll| FLscroll, |flscrollend| FLscrollEnd, |fltabs| FLtabs, and |fltabsend| FLtabsEnd. ------------------------------------------------------------------------------ *controlfltkvaluators* FLTK Valuators ~ The opcodes for FLTK valuators are |flcount| FLcount, |fljoy| FLjoy, |flkeyb| FLkeyb, |flknob| FLknob, |flroller| FLroller, |flslider| FLslider, and |fltext| FLtext. ------------------------------------------------------------------------------ *controlfltkother* Other FLTK Widgets ~ Other FLTK widget opcodes are |flbox| FLbox, |flbutbank| FLbutBank, |flbutton| FLbutton, |flprintk| FLprintk, |flprintk2| FLprintk2, and |flvalue| FLvalue, ------------------------------------------------------------------------------ *controlfltkappearance* Modifying FLTK Widget Appearance ~ Opcodes one can use to modify FLTK widget appearance are |flcolor2| FLcolor2, |flcolor| FLcolor, |flhide| FLhide, |fllabel| FLlabel, |flsetalign| FLsetAlign, |flsetbox| FLsetBox, |flsetcolor2| FLsetColor2, |flsetcolor| FLsetColor, |flsetfont| FLsetFont, |flsetposition| FLsetPosition, |flsetsize| FLsetSize, |flsettext| FLsetText, |flsettextcolor| FLsetTextColor, |flsettextsize| FLsetTextSize, |flsettexttype| FLsetTextType, |flsetval| FLsetVal, |flsetvali| FLsetVal_i, and |flshow| FLshow. ------------------------------------------------------------------------------ *controlfltkgeneral* General FLTK Widget-related Opcodes ~ The general FLTK widget-related opcodes are |flgetsnap| FLgetsnap, |flloadsnap| FLloadsnap, |flrun| FLrun, |flsavesnap| FLsavesnap, |flsetsnap| FLsetsnap, and |flupdate| FLupdate. ------------------------------------------------------------------------------ *controlfltksliderbank* FLTK Slider Bank ~ The opcode for the FLTK slider bank is |flslidbnk| FLslidBnk. ------------------------------------------------------------------------------ *controlinvocat* Instrument Invocation ~ The opcodes one can use to create score events from within a orchestra are |event| event, |schedule| schedule, |schedwhen| schedwhen, and |schedkwhen| schedkwhen. ------------------------------------------------------------------------------ *controlmacros* Macros ~ The opcodes one can use to create, call, or undefine macros are |define| #define, |dollar| $NAME, |include| #include, and |undef| #undef. ------------------------------------------------------------------------------ *controlpgmctl* Program Flow Control ~ The opcodes to manipulate which orchestra statements are executed are |cggoto| cggoto, |cigoto| cigoto, |ckgoto| ckgoto, |cngoto| cngoto, |elseif| elseif, |else| else, |endif| endif, |goto| goto, |if| if, |igoto| igoto, |kgoto| kgoto, |tigoto| tigoto, and |timout| timout. ------------------------------------------------------------------------------ *controlrealtime* Real-time Performance Control ~ Opcodes that monitor and control real-time performance are |active| active, |cpuprc| cpuprc, |maxalloc| maxalloc, and |prealloc| prealloc. ------------------------------------------------------------------------------ *controlreinitn* Reinitialization ~ The opcodes that can generate another initialization phase are |reinit| reinit, |rigoto| rigoto, and |rireturn| rireturn. ------------------------------------------------------------------------------ *controlsensing* Sensing and Control ~ Opcodes that read from signals or on-screen controls are |button| button, |checkbox| checkbox, |control| control, |follow| follow, |follow2| follow2, |peak| peak, |pitch| pitch, |pitchamdf| pitchamdf, |sense| sense, |sensekey| sensekey, |setctrl| setctrl, |tempest| tempest, |tempo| tempo, |tempoval| tempoval, |seqtime| setime, |trigger| trigger, |trigseq| trigseq, and |xyin| xyin. ------------------------------------------------------------------------------ *controlsubinstrument* Sub-instrument Control ~ These opcodes let one define and use a sub-instrument: |ink| ink, |outk| outk, and |subinstr| subinstr. ------------------------------------------------------------------------------ *controltimeread* Time Reading ~ Opcodes one can use to read time values are |readclock| readclock, |rtclock| rtclock, |timeinstk| timeinstk, |timeinsts| timeinsts, |timek| timek, and |times| times. ------------------------------------------------------------------------------ *tabletop* Function Table Control ~ ------------------------------------------------------------------------------ *tablequeries* Table Queries ~ Opcodes the query tables for information are |ftchnls| ftchnls, |ftlen| ftlen, |ftlptim| ftlptim, |ftsr| ftsr, |nsamp| nsamp, and |tableng| tableng. ------------------------------------------------------------------------------ *tablereadwrit* Read/Write Operations ~ Opcodes that read and write to a table are |ftloadk| ftloadk, |ftload| ftload, |ftsavek| ftsavek, |ftsave| ftsave, |tablecopy| tablecopy, |tablegpw| tablegpw, |tableicopy| tableicopy, |tableigpw| tableigpw, |tableimix| tableimix, |tableiw| tableiw, |tablemix| tablemix, |tablera| tablera, |tablew| tablew, |tablewa| tablewa, and |tablewkt| tablewkt. ------------------------------------------------------------------------------ *tableselect* Table Selection ~ Opcodes that let one dynamically select tables are |tableikt| tableikt, |tablekt| tablekt, and |tablexkt| tablexkt. ------------------------------------------------------------------------------ *mathtop* Mathematical Operations ~ ------------------------------------------------------------------------------ *mathamp* Amplitude Converters ~ Opcodes to convert between different amplitude measurements are |ampdb| ampdb, |ampdbfs| ampdbfs, |dbamp| dbamp, and |dbfsamp| dbfsamp. ------------------------------------------------------------------------------ *mathartlogic* Arithmetic and Logic Operations ~ Opcodes that perform arithmetic and logic operations are |subtracts| -, |adds| +, |opand| &&, |opor| ||, |multiplies| *, |divides| /, |raises| ^, and |modulus| %. ------------------------------------------------------------------------------ *mathmatfunc* Mathematical Functions ~ Opcodes that perform mathematical functions are |abs| abs, |exp| exp, |frac| frac, |int| int, |log| log, |log10| log10, |logbtwo| logbtwo, |powoftwo| powoftwo, and |sqrt| sqrt. ------------------------------------------------------------------------------ *mathopeqfunc* Opcode Equivalents of Functions ~ Opcodes that perform the equivalent of mathematical functions are |mac| mac, |maca| maca, |pow| pow, |product| product, and |sum| sum. ------------------------------------------------------------------------------ *mathrndfunc* Random Functions ~ Opcodes that perform random functions are |birnd| birnd and |rnd| rnd. ------------------------------------------------------------------------------ *mathtrig* Trigonometric Functions ~ Opcodes that perform trigonometric functions are |cos| cos, |cosh| cosh, |cosinv| cosinv, |sin| sin, |sinh| sinh, |sininv| sininv, |tan| tan, |tanh| tanh, |taninv| taninv, and |taninv2| taninv2. ------------------------------------------------------------------------------ *miditop* MIDI Support ~ ------------------------------------------------------------------------------ *midicontrol* Controller Input ~ Opocodes that accept MIDI input are |aftouch| aftouch, |chanctrl| chanctrl, |ctrl7| ctrl7, |ctrl14| ctrl14, |ctrl21| ctrl21, |initc7| initc7, |initc14| initc14, |initc21| initc21, |midic7| midic7, |midic14| midic14, |midic21| midic21, |midichannelaftertouch| midichannelaftertouch, |midichn| midichn, |midicontrolchange| midicontrolchange, |mididefault| mididefault, |midinoteoff| midinoteoff, |midinoteoncps| midinoteoncps, |midinoteonkey| midinoteonkey, |midinoteonoct| midinoteonoct, |midinoteonpch| midinoteonpch, |midipitchbend| midipitchbend, |midipolyaftertouch| midipolyaftertouch, |midiprogramchange| midiprogramchange, and |polyaft| polyaft. ------------------------------------------------------------------------------ *midiconvert* Converters ~ Opcodes that convert MIDI values are |ampmidi| ampmidi, |cpsmidi| cpsmidi, |cpsmidib| cpsmidib, |cpstmid| cpstmid, |midictrl| midictrl, |notnum| notnum, |octmidi| octmidi, |octmidib| octmidib, |pchbend| pchbend, |pchmidi| pchmidi, |pchmidib| pchmidib, and |veloc| veloc. ------------------------------------------------------------------------------ *midiextender* Event Extenders ~ Opcodes that let one extend the duration of an event are |release| release and |xtratim| xtratim. ------------------------------------------------------------------------------ *midigeneric* Generic Input and Output ~ Opcodes for generic MIDI input and output are |midiin| midiin and |midiout| midiout. ------------------------------------------------------------------------------ *midionoff* Note-on/Note-off ~ Opcodes to turn MIDI notes on or off are |midion| midion, |midion2| midion2, |moscil| moscil, |noteoff| noteoff, |noteon| noteon, |noteondur| noteondur, and |noteondur2| noteondur2. ------------------------------------------------------------------------------ *midioutput* MIDI Message Output ~ Opcodes that send MIDI output are |mdelay| mdelay, |nrpn| nrpn, |outiat| outiat, |outic| outic, |outic14| outic14, |outipat| outipat, |outipb| outipb, |outipc| outipc, |outkat| outkat, |outkc| outkc, |outkc14| outkc14, |outkpat| outkpat, |outkpb| outkpb, and |outkpc| outkpc. ------------------------------------------------------------------------------ *midirealtime* Real-time Messages ~ Opcodes for real-time MIDI messages are |mclock| mclock and |mrtmsg| mrtmsg. ------------------------------------------------------------------------------ *midislidrbk* Slider Banks ~ Opcodes for slider banks of MIDI controls are |s16b14| s16b14, |s32b14| s32b14, |slider16| slider16, |slider16f| slider16f, |slider32| slider32, |slider32f| slider32f, |slider64| slider64, |slider64f| slider64f, |slider8| slider8, and |slider8f| slider8f. ------------------------------------------------------------------------------ *pitchtop* Pitch Converters ~ ------------------------------------------------------------------------------ *pitchfuncs* Functions ~ Opcodes that provide common pitch functions are |cent| cent, |cpsoct| cpsoct, |cpspch| cpspch, |db| db, |octave| octave, |octcps| octcps, |octpch| octpch, |pchoct| pchoct, and |semitone| semitone. ------------------------------------------------------------------------------ *pitchtuning* Tuning Opcodes ~ Opcodes that provide tuning functions are |cps2pch| cps2pch, |cpsxpch| cpsxpch, |cpstun| cpstun, and |cpstuni| cpstuni. ------------------------------------------------------------------------------ *siggentop* Signal Generators ~ ------------------------------------------------------------------------------ *siggenadditive* Additive Synthesis/Resynthesis ~ The opcodes for additive synthesis and resynthesis are |adsyn| adsyn, |adsynt| adsynt, and |hsboscil| hsboscil. ------------------------------------------------------------------------------ *siggenbasic* Basic Oscillators ~ The basic oscillator opcodes are |lfo| lfo, |oscbnk| oscbnk, |oscil| oscil, |oscil3| oscil3, |oscili| oscili, |oscils| oscils, |poscil| poscil, and |poscil3| poscil3. ------------------------------------------------------------------------------ *siggendynamic* Dynamic Spectrum Oscillators ~ The opcodes that generate dynamic spectra are |buzz| buzz, |gbuzz| gbuzz, |mpulse| mpulse, and |vco| vco. ------------------------------------------------------------------------------ *siggenfmsynth* FM Synthesis ~ The FM synthesis opcodes are |fmb3| fmb3, |fmbell| fmbell, |fmmetal| fmmetal, |fmpercfl| fmpercfl, |fmrhode| fmrhode, |fmvoice| fmvoice, |fmwurlie| fmwurlie, |foscil| fosci