CsoundAC is a Python extension module for doing algorithmic composition, in one which one writes music by programming in Python. Musical events are points in music space with dimensions {time, duration, event type, instrument, pitch as MIDI key, loudness as MIDI velocity, phase, pan, depth, height, pitch-class set, 1}, and pieces are composed by assembling a hierarchical tree of nodes in music space. Each node has its own local transformation of coordinates in music space. Nodes can be empty, contain scores or fragments of scores, generate scores, or transform scores. CsoundAC also contains a Python interface to the Csound API, making it easy to render CsoundAC compositions using Csound.
This software is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "csound.h" int main(int argc, char **argv) { // Create Csound. void *csound = csoundCreate(0); // One complete compile/perform cycle. int result = csoundCompile(csound, argc, argv); if(!result) { while(csoundPerformKsmps(csound) == 0){} csoundCleanup(csound); } // Destroy Csound. csoundDestroy(csound); return result; }
You can build CsoundAC into your own software using the CsoundAC shared library and CsoundAC.hpp header file.
All of the CScore functions are renamed in the Csound API. For example, createv() is now cscoreCreateEvent(), and lcopy() is now cscoreListCopy(). In addition, each function takes an additional first parameter that is a pointer to a CSOUND instance. You can find the details in the header file, cscore.h, which may be included with your Csound distribution, or if not, can be found in Csound CVS `on SourceForge.
Before you can use any of the Cscore API functions, you must create a CSOUND instance and initialize Cscore by calling csoundInitializeCscore() -- see csound.h for an explanation. An example main program that does all of this Top/cscormai.c. You should add a function called () with your own score-processing code. An example that does nothing except write the score back out unchanged can be found in the file Top/cscore_internal.c.
To create your own standalone Cscore program, you must compile cscormai.c (or your own main program) and the file containing your cscore() function, and link them with the Csound API library.
Everything that can be done using C as in the above examples can also be done in a similar manner in Python or any of the other Csound API languages.