manual csound5 barry vercoe

1

Upload: baion87

Post on 04-Apr-2015

116 views

Category:

Documents


0 download

TRANSCRIPT

The OLPCsound Reference Manual

The OLPCsound Reference ManualNext

The OLPCsound Reference ManualVersion 5.08Barry Vercoe MIT Media Lab et. al.

Table of ContentsPreface Preface to the OLPCsound Manual Getting Started with Csound Tootorials Toot 1 Toot 2 Toot 3 Toot 4 Toot 5 Toot 6 Toot 7 Toot 8 Toot 9 Toot 10 I. Overview Using Csound How Csound5 works Amplitude values in Csound Real-Time Audio Optimizing Audio I/O Latency Syntax of the Orchestra Orchestra Header Statements

http://www.csounds.com/manualOLPC/index.html (1 de 29)24/09/2010 10:37:43

The OLPCsound Reference Manual

Instrument and Opcode Block Statements Ordinary Statements Constants and Variables Variable Initialization Expressions Directories and Files Nomenclature Macros Named Instruments User Defined Opcodes (UDO) The Standard Numeric Score Preprocessing of Standard Scores Carry Tempo Sort Score Statements Next-P and Previous-P Symbols Ramping Score Macros Multiple File Score Evaluation of Expressions The Csound Command Order of Precedence Description of the command syntax Csound command line Command-line Flags Csound Environment Variables Unified File Format for Orchestras and Scores Description Example Command Line Parameter File (.csoundrc) Csound Links II. Reference Orchestra Opcodes and Operators != Determines if one value is not equal to another. #define Defines a macro. #include Includes an external file for processing. #undef Un-defines a macro. #ifdef Conditional reading of code. #ifndef Conditional reading of code. $NAME Calls a defined macro.

http://www.csounds.com/manualOLPC/index.html (2 de 29)24/09/2010 10:37:43

The OLPCsound Reference Manual

% Modulus operator. && Logical AND operator. > Determines if one value is greater than another. >= Determines if one value is greater than or equal to another. < Determines if one value is less than another. OPCODEDIR /Library/Frameworks/CsoundLib.framework/Versions/5.1/Resources/Opcodes OPCODEDIR64 /Volumes/ExternalHD/devel/csound5/lib64 INCDIR /Volumes/ExternalHD/CSOUND/include SFDIR /Volumes/ExternalHD/iTunes/csoundaudio and so on, using the XML tag for each environment variable required by the API and the tag for it's corresponding path on the system. Please note that you must login out and login in for these changes to take effect.

Prev

Up

Next

http://www.csounds.com/manualOLPC/CommandEnvironment.html (2 de 3)24/09/2010 10:38:33

Csound Environment Variables

Command-line Flags

Home

Unified File Format for Orchestras and Scores

http://www.csounds.com/manualOLPC/CommandEnvironment.html (3 de 3)24/09/2010 10:38:33

Unified File Format for Orchestras and Scores

Unified File Format for Orchestras and ScoresPrev

The Csound Command

Next

Unified File Format for Orchestras and Scores DescriptionThe 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 ElementsThe first tag in the file must be the start tag . The last tag in the file must be the end tag . This element is used to alert the csound compiler to the .csd format. All text before the start tag and after the end tag is ignored by Csound. The tag may also be spelled .

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.

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 files may be included with the tag , where filename is the name of the file to be included. The Base64 encoded data should be terminated with a tag. For encoding files, the csb64enc and makecsd utilities (included with Csound 5.00 and newer) can be used. The file will be extracted to the current directory, and deleted at end

http://www.csounds.com/manualOLPC/CommandUnifile.html (1 de 2)24/09/2010 10:38:35

Unified File Format for Orchestras and Scores

of performance. If there is an already existing file with the same name, it is not overwritten, but an error will occur instead. 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. Using this tag is not recommended; use instead. 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. Using this tag is not recommended; use instead.

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:

#.#New in Csound version 4.09.

Licence Information ( or )Licencing details can be included in between the start tag and the end tag . There is no format for this information, any text is acceptable. This text will be printed by Csound to the console when the CSD is run.

Prev Csound Environment Variables

Up Home

Next Example

http://www.csounds.com/manualOLPC/CommandUnifile.html (2 de 2)24/09/2010 10:38:35

Example

ExamplePrev

Unified File Format for Orchestras and Scores

Next

ExampleBelow 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 -W -d -o tone.wav Before 4.10 After 4.08 ; optional section ; these two statements check for ; 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

http://www.csounds.com/manualOLPC/CommandUnifileExample.html (1 de 2)24/09/2010 10:38:36

Example

Prev Unified File Format for Orchestras and Scores

Up Home

Next Command Line Parameter File (. csoundrc)

http://www.csounds.com/manualOLPC/CommandUnifileExample.html (2 de 2)24/09/2010 10:38:36

Command Line Parameter File (.csoundrc)

Command Line Parameter File (.csoundrc)Prev

The Csound Command

Next

Command Line Parameter File (.csoundrc)If the file .csoundrc exists, it will be used to set the command line parameters. These can be overridden. Csound 5.00 and newer versions read this file from the HOME directory first (or the full path file name defined by the CSOUNDRC environment variable), and then the current directory. If both exist, options in the .csoundrc in the current directory will have higher precedence. It uses the same form as a .csd file, but no tags are needed. Lines beginning with # or ; are treated as comments. A .csoundrc file can contain something like this:

-+rtaudio=portaudio -odac2 -iadc2 -+rtmidi=winmme -M1 -Q1 -m0

In this case, csound will generate real-time output and take realtime input from device 2, using the portaudio driver interface. It will input and output realtime MIDI on interface 1. It will print very few messages (-m0). These options will be used by default when other options are not given inside the of the .csd file or the command line (See Order of precendence).

Prev Example

Up Home

Next Csound Links

http://www.csounds.com/manualOLPC/CommandUnifileParFile.html24/09/2010 10:38:36

Csound Links

Csound LinksPrev

Part I. Overview

Next

Csound LinksCsound's "home page" is maintained by Richard Boulanger at http://csounds.com. The Csound source code is maintained by John ffitch and others at http://www.sourceforge.net/projects/csound. The most recent versions and precompiled packages for most platforms also can be downloaded here. 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: [email protected]. You can also subscribe to the digest (1 message per day) by sending an empty email to: [email protected]. Posts sent to [email protected] go to all subscribed members of the list. You can browse the csound mailing list archives here Similarly, the Csound-devel mailing list exists to discuss Csound development. For more information on this list, go to http:// lists.sourceforge.net/lists/listinfo/csound-devel. Posts sent to [email protected] go to all subscribed members of the list.

Prev Command Line Parameter File (. csoundrc)

Up Home

Next Part II. Reference

http://www.csounds.com/manualOLPC/CsoundLinks.html24/09/2010 10:38:37

Part II. Reference

Part II. ReferencePrev Next

Part II. ReferenceTable of Contents

Orchestra Opcodes and Operators != Determines if one value is not equal to another. #define Defines a macro. #include Includes an external file for processing. #undef Un-defines a macro. #ifdef Conditional reading of code. #ifndef Conditional reading of code. $NAME Calls a defined macro. % Modulus operator. && Logical AND operator. > Determines if one value is greater than another. >= Determines if one value is greater than or equal to another. < Determines if one value is less than another. ,