Skip to content

Commit

Permalink
Merge pull request #174 from gogins/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
gogins authored Aug 4, 2021
2 parents d18fef2 + c6a18fa commit 8a2c091
Show file tree
Hide file tree
Showing 27 changed files with 10,498 additions and 465 deletions.
4 changes: 2 additions & 2 deletions CsoundAC/ChordSpaceBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ class SILENCE_PUBLIC Chord : public Matrix {
* NOTE: The code here does NOT remove duplicate pitch-classes.
* "Normal order" is the most compact ordering to the left of
* pitch-classes in a chord, measured by pitch-class interval.
*/
*/
virtual Chord normal_order() const;
/**
* Performs the dominant transformation (which is not a neo-Reimannian
Expand Down Expand Up @@ -1026,7 +1026,7 @@ class SILENCE_PUBLIC Chord : public Matrix {
*/
virtual Chord nrP() const;
/**
* Performs the neo-Riemannian parallel transformation..
* Performs the neo-Riemannian parallel transformation.
*/
virtual Chord nrR() const;
/**
Expand Down
1 change: 0 additions & 1 deletion CsoundAC/ImageToScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <FL/Fl_PNM_Image.H>
#include <FL/Fl_XPM_Image.H>
#include <FL/Fl_GIF_Image.H>
///#include <FL/Fl_BMP_Image.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_JPEG_Image.H>
#include <cmath>
Expand Down
248 changes: 1 addition & 247 deletions CsoundAC/Silence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,253 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once

/**
* \page csoundac CsoundAC
*
* CsoundAC is a C++ class library for algorithmic music
* composition with Csound.
*
* CsoundAC has C++, Java, Python, and Lua interfaces.
*
* CsoundAC implements the idea of a "music graph," similar to a scene
* graph in 3-dimensional computer graphics. A composition is constructed
* by assembling a directed acyclic graph of Node objects, which may generate
* or transform Events that are collected in a Score. Each Node may have its
* own local transformation of coordinagte system. The music graph
* represents a model of a musical score. The Composition class provides
* an abstract base class for managing a music graph. The MusicModel class
* subclasses the Composition class to include the ability to store and
* run a Csound orchestra.
*
* See the <a href="namespacecsound.html">csound</a>
* namespace for information about the classes in CsoundAC.
*/
/**
* \namespace csound
*
* The csound namespace contains classes for doing algorithmic composition,
* and for rendering audio from algorithmically generated scores,
* especially using Csound.
*
* All classes declared for CsoundAC should be #included in Silence.hpp.
*
* SWIG is run on Silence.hpp to generate wrappers for all CsoundAC classes
* in other languages, especially scripting languages such as Python,
* Therefore, all framework headers must be included in this header,
* and all framework headers must use #ifdef SWIG to declare
* the module and make other SWIG declarations (see Node.h for an extensive example).
* The order of declaration is important to SWIG!
*
* It is also expected that doxygen will be used to generate documentation
* from comments in the framework header files.
*/
/** \page csound Csound
*
* Csound is a sound and music computing system. It was originally written
* by Barry Vercoe at the Massachusetts Institute of Technology in
* 1984 as the first C language version of this type of
* software. Since then Csound has received numerous contributions
* from researchers, programmers, and musicians from around the world.
*
* \section silence_section_api_outline Outline of the API
*
* \subsection silence_section_api_apilist The Csound Application Programming Interfaces
*
* The Csound Application Programming Interface (API) reference is contained
* herein.
* The Csound API actually consists of several APIs:
*
* - The basic Csound C API. Include csound.h and link with libcsound.a.
* This also includes the Cscore API (see below).
* - The basic Csound C++ API. Include csound.hpp and link with libcsound.a.
* - The interfaces API, includes a number of auxiliary C++ classes, which
* add functionality and support the wrapping of the Csound API by various
* languages (e.g. Python, Java, Lua).
*
* \b Purposes
*
* The purposes of the Csound API are as follows:
*
* \li Declare a stable public application programming interface (API)
* for Csound in csound.h. This is the only header file that needs
* to be \#included by users of the Csound API.
*
* \li Hide the internal implementation details of Csound from users of
* the API, so that development of Csound can proceed without affecting
* code that uses the API.
*
* \b Users
*
* Users of the Csound API fall into two main categories: hosts and plugins.
*
* \li Hosts are applications that use Csound as a software synthesis engine.
* Hosts can link with the Csound API either statically or dynamically.
*
* \li Plugins are shared libraries loaded by Csound at run time to implement
* external opcodes and/or drivers for audio or MIDI input and output.
* Plugin opcodes need only include the csdl.h header which brings all
* necessary functions and data structures.
* Plugins can be written in C or C++. For C++, OOP support is given through
* `include/plugin.h` (using the Csound allocator, for opcodes
* that do not involve standard C++ library collections) or
* `include/OpcodeBase.hpp` (using the standard ++ allocator, for opcodes
* that do use standard C++ library collections).
*
* \section silence_section_api_c_example Examples Using the Csound (host) API
*
* The Csound command--line program is itself built using the Csound API.
* Its code reads (in outline) as follows:
*
* \code
* #include "csound.h"
*
* int main(int argc, char **argv)
* {
* void *csound = csoundCreate(0);
* int result = csoundCompile(csound, argc, argv);
* if(!result) {
* while(csoundPerformKsmps(csound) == 0){}
* csoundCleanup(csound);
* }
* csoundDestroy(csound);
* return result;
* }
* \endcode
*
* Csound code can also be supplied directly using strings, either as
* a multi-section CSD (with the same format as CSD files) or
* directly as a string. It can be compiled any number of times
* before or during performance.
*
* \subsection silence_s1 Using a CSD text
*
* System options can be passed via the CSD text before the engine
* is started. These are ignored in subsequent compilations.
*
* \code
* #include "csound.h"
*
* const char *csd_text =
* "<CsoundSynthesizer> \n"
* "<CsOptions> -odac </CsOptions> \n"
* "<CsInstruments> \n"
* "instr 1 \n"
* " out(linen(oscili(p4,p5),0.1,p3,0.1)) \n"
* "endin \n"
* "</CsInstruments> \n"
* "<CsScore> \n"
* "i1 0 5 1000 440 \n"
* "</CsScore> \n"
* "</CsoundSynthesizer> \n";
*
* int main(int argc, char **argv)
* {
* void *csound = csoundCreate(0);
* int result = csoundCompileCsdText(csound, csd_text);
* result = csoundStart(csound);
* while (1) {
* result = csoundPerformKsmps(csound);
* if (result != 0) {
* break;
* }
* }
* result = csoundCleanup(csound);
* csoundReset(csound);
* csoundDestroy(csound);
* return result;
* }
* \endcode
*
* \subsection silence_s2 Using Csound code directly.
*
* Options can be passed via csoundSetOption() before the engine starts.
*
* \code
* #include "csound.h"
*
* const char *orc_text =
* "instr 1 \n"
* " out(linen(oscili(p4,p5),0.1,p3,0.1)) \n"
* "endin \n";
*
* const char *sco_text = "i1 0 5 1000 440 \n";
*
* int main(int argc, char **argv)
* {
* void *csound = csoundCreate(0);
* int result = csoundSetOption(csound, "-d");
* result = csoundSetOption(csound, "-odac");
* result = csoundStart(csound);
* result = csoundCompileOrc(csound, orc_text);
* result = csoundReadScore(csound, sco_text);
* while (1) {
* result = csoundPerformKsmps(csound);
* if (result != 0) {
* break;
* }
* }
* result = csoundCleanup(csound);
* csoundReset(csound);
* csoundDestroy(csound);
* return result;
* }
* \endcode
*
* 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.
*
* \file csound.h
*
* \brief Declares the public Csound application programming interface (API).
* \author John P. ffitch, Michael Gogins, Matt Ingalls, John D. Ramsdell,
* Istvan Varga, Victor Lazzarini, Andres Cabrera and Steven Yi.
*
* Hosts using the Csound API must \#include <csound.h>, and link with the
* Csound API library. Plugin libraries should \#include <csdl.h> to get
* access to the API function pointers in the CSOUND structure, and do not
* need to link with the Csound API library.
* Only one of csound.h and csdl.h may be included by a compilation unit.
*
* Hosts must first create an instance of Csound using the \c csoundCreate
* API function. When hosts are finished using Csound, they must destroy the
* instance of csound using the \c csoundDestroy API function.
* Most of the other Csound API functions take the Csound instance as their
* first argument.
* Hosts can only call the standalone API functions declared in csound.h.
*
* Here is the complete code for the simplest possible Csound API host,
* a command-line Csound application:
*
* \code
*
* #include <csound.h>
*
* int main(int argc, char **argv)
* {
* CSOUND *csound = csoundCreate(NULL);
* int result = csoundCompile(csound, argc, argv);
* if (!result)
* result = csoundPerform(csound);
* csoundDestroy(csound);
* return (result >= 0 ? 0 : result);
* }
*
* \endcode
*
* All opcodes, including plugins, receive a pointer to their host
* instance of Csound as the first argument. Therefore, plugins MUST NOT
* compile, perform, or destroy the host instance of Csound, and MUST call
* the Csound API function pointers off the Csound instance pointer.
*
* \code
* MYFLT sr = csound->GetSr(csound);
* \endcode
*
* In general, plugins should ONLY access Csound functionality through the
* API function pointers and public members of the #CSOUND_ structure.
*
/**
* \section silence_section_licenses License
*
* \subsection silence_section_csound_license Csound
Expand Down
12 changes: 7 additions & 5 deletions CsoundAC/musx_csound.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ def to_csound_score(midifile):
for event in track:
if event.is_note_on():
if event.duration > 0:
# Adjust channel and MIDI key for microtonality.
channel = event.channel()
key = event.keynum()
# Adjust channel and MIDI key for microtonality?
if channels_per_instrument > 1:
channel = event.channel()
fraction = fractional_keys_for_channels[channel]
key = event.keynum()
fractional_key = key + fraction
print("fractioal_key:", fractional_key)
#print("fractional_key:", fractional_key, "original channel:", channel)
channel = math.floor(channel / channels_per_instrument)
i_statement = to_i_statement(channel, event.time, event.duration, fractional_key, event.velocity())
#print("corrected channel:", channel)
key = fractional_key
i_statement = to_i_statement(channel, event.time, event.duration, key, event.velocity())
csound_score.append(i_statement + "\n")
return ''.join(csound_score)

Expand Down
6 changes: 3 additions & 3 deletions build-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ export PATH=/usr/local/lib/nodejs/node-$NODEJS_VERSION-$NODEJS_DISTRO/bin:$PATH
unset NODE_ADDON_API_INCLUDE
export NODE_ADDON_API_INCLUDE=/usr/local/lib/nodejs/node-$NODEJS_VERSION-$NODEJS_DISTRO/lib/node_modules/node-addon-api

alias python=python3

unset EMSCRIPTEN_ROOT
export EMSCRIPTEN_ROOT=/home/mkg/emsdk/upstream/emscripten

Expand All @@ -80,7 +78,7 @@ export APULSE_PLAYBACK_DEVICE=plughw:1,0
unset APULSE_CAPTURE_DEVICE
export APULSE_CAPTURE_DEVICE=plughw:1,0

alias python='/usr/bin/python3.9'
#alias python='/usr/bin/python3.9'

echo $PATH
python --version
Expand All @@ -93,3 +91,5 @@ env | grep NODE
env | grep OPCODE
env | grep PYTHON
env | grep RAW

gnome-terminal
Loading

0 comments on commit 8a2c091

Please sign in to comment.